test(loading): migrate e2e tests

references #15803
This commit is contained in:
Cam Wiegert
2018-10-02 10:39:49 -05:00
parent 2f9aaa2e0c
commit 05f3d92af4
4 changed files with 28 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/loading/test/basic?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('.loading-wrapper')));
return await this.driver.wait(until.elementIsVisible(this.driver.findElement(By.css('.loading-wrapper'))));
}
}
platforms.forEach(platform => {
describe('loading/basic', () => {
register('should init', driver => {
const page = new E2ETestPage(driver, platform);
return page.navigate('#basic');
});
register('should open loading', driver => {
const page = new E2ETestPage(driver, platform);
return page.present('basic');
});
register('should open default spinner', driver => {
const page = new E2ETestPage(driver, platform);
return page.present('default');
});
});
});

View File

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

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/loading/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('.loading-wrapper')));
return await this.driver.wait(until.elementIsVisible(this.driver.findElement(By.css('.loading-wrapper'))));
}
}
platforms.forEach(platform => {
describe('loading/standalone', () => {
register('should init', driver => {
const page = new E2ETestPage(driver, platform);
return page.navigate('#basic');
});
register('should open loading', driver => {
const page = new E2ETestPage(driver, platform);
return page.present('basic');
});
});
});

View File

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