test(toast): migrate e2e tests

This commit is contained in:
Cam Wiegert
2018-09-28 08:57:08 -05:00
parent 2f500697f8
commit 4d8b460310
4 changed files with 42 additions and 67 deletions

View File

@@ -1,36 +0,0 @@
'use strict';
const { By, until } = require('selenium-webdriver');
const { register, Page, platforms } = require('../../../../../scripts/e2e');
class E2ETestPage extends Page {
constructor(driver, platform) {
super(driver, `http://localhost:3333/src/components/toast/test/basic?ionic:mode=${platform}`);
}
async present(buttonId) {
await this.navigate('#content');
this.driver.findElement(By.id(buttonId)).click();
await this.driver.wait(until.elementLocated(By.css('.toast-wrapper')));
return await this.driver.wait(until.elementIsVisible(this.driver.findElement(By.css('.toast-wrapper'))));
}
async closeWithBackdrop() {
this.driver.findElement(By.css('ion-backdrop')).click();
return await this.driver.wait(until.elementIsNotVisible(this.driver.findElement(By.css('ion-backdrop'))));
}
}
platforms.forEach(platform => {
describe('toast/basic', () => {
register('should init', driver => {
const page = new E2ETestPage(driver, platform);
return page.navigate('#content');
});
register('shows bottom toast', driver => {
const page = new E2ETestPage(driver, platform);
return page.present('showBottomToast');
});
});
});

View File

@@ -0,0 +1,25 @@
import { newE2EPage } from '@stencil/core/testing';
it('toast: basic', async () => {
const page = await newE2EPage({
url: '/src/components/toast/test/basic?ionic:animated=false'
});
const button = await page.find('#showBottomToast');
await button.click();
let toast = await page.find('ion-toast');
await toast.waitForVisible();
let compare = await page.compareScreenshot();
expect(compare).toMatchScreenshot();
await toast.callMethod('dismiss');
await toast.waitForNotVisible();
compare = await page.compareScreenshot('dismissed');
expect(compare).toMatchScreenshot();
toast = await page.find('ion-toast');
expect(toast).toBeNull();
});

View File

@@ -1,31 +0,0 @@
'use strict';
const { By, until } = require('selenium-webdriver');
const { register, Page, platforms } = require('../../../../../scripts/e2e');
class E2ETestPage extends Page {
constructor(driver, platform) {
super(driver, `http://localhost:3333/src/components/toast/test/standalone?ionic:mode=${platform}`);
}
async present(buttonId) {
await this.navigate('#basic');
this.driver.findElement(By.id(buttonId)).click();
await this.driver.wait(until.elementLocated(By.css('.toast-wrapper')));
return await this.driver.wait(until.elementIsVisible(this.driver.findElement(By.css('.toast-wrapper'))));
}
}
platforms.forEach(platform => {
describe('toast/standalone', () => {
register('should init', driver => {
const page = new E2ETestPage(driver, platform);
return page.navigate('#basic');
});
register('shows basic toast', driver => {
const page = new E2ETestPage(driver, platform);
return page.present('basic');
});
});
});

View File

@@ -0,0 +1,17 @@
import { newE2EPage } from '@stencil/core/testing';
it('toast: standalone', async () => {
const page = await newE2EPage({
url: '/src/components/toast/test/standalone?ionic:animated=false'
});
const button = await page.find('#basic');
await button.click();
const toast = await page.find('ion-toast');
await toast.waitForVisible();
const compare = await page.compareScreenshot();
expect(compare).toMatchScreenshot();
});