mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
@ -1,71 +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/alert/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('.alert-wrapper')));
|
|
||||||
return await this.driver.wait(until.elementIsVisible(this.driver.findElement(By.css('.alert-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('alert/basic', () => {
|
|
||||||
register('should init', driver => {
|
|
||||||
const page = new E2ETestPage(driver, platform);
|
|
||||||
return page.navigate('#basic');
|
|
||||||
});
|
|
||||||
|
|
||||||
register('should open basic alert', driver => {
|
|
||||||
const page = new E2ETestPage(driver, platform);
|
|
||||||
return page.present('basic');
|
|
||||||
});
|
|
||||||
|
|
||||||
register('should open alert long message', driver => {
|
|
||||||
const page = new E2ETestPage(driver, platform);
|
|
||||||
return page.present('longMessage');
|
|
||||||
});
|
|
||||||
|
|
||||||
register('should open alert multiple buttons', driver => {
|
|
||||||
const page = new E2ETestPage(driver, platform);
|
|
||||||
return page.present('multipleButtons');
|
|
||||||
});
|
|
||||||
|
|
||||||
register('should open alert no message', driver => {
|
|
||||||
const page = new E2ETestPage(driver, platform);
|
|
||||||
return page.present('noMessage');
|
|
||||||
});
|
|
||||||
|
|
||||||
register('should open confirm alert', driver => {
|
|
||||||
const page = new E2ETestPage(driver, platform);
|
|
||||||
return page.present('confirm');
|
|
||||||
});
|
|
||||||
|
|
||||||
register('should open prompt alert', driver => {
|
|
||||||
const page = new E2ETestPage(driver, platform);
|
|
||||||
return page.present('prompt');
|
|
||||||
});
|
|
||||||
|
|
||||||
register('should open radio alert', driver => {
|
|
||||||
const page = new E2ETestPage(driver, platform);
|
|
||||||
return page.present('radio');
|
|
||||||
});
|
|
||||||
|
|
||||||
register('should open checkbox alert', driver => {
|
|
||||||
const page = new E2ETestPage(driver, platform);
|
|
||||||
return page.present('checkbox');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
28
core/src/components/alert/test/basic/e2e.ts
Normal file
28
core/src/components/alert/test/basic/e2e.ts
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import { newE2EPage } from '@stencil/core/testing';
|
||||||
|
|
||||||
|
it('alert: basic', async () => {
|
||||||
|
const page = await newE2EPage({
|
||||||
|
url: '/src/components/alert/test/basic?ionic:_testing=true'
|
||||||
|
});
|
||||||
|
|
||||||
|
const alerts = [
|
||||||
|
['#basic'],
|
||||||
|
['#longMessage', 'long message'],
|
||||||
|
['#multipleButtons', 'multiple buttons'],
|
||||||
|
['#noMessage', 'no message'],
|
||||||
|
['#confirm', 'confirm'],
|
||||||
|
['#prompt', 'prompt'],
|
||||||
|
['#radio', 'radio'],
|
||||||
|
['#checkbox', 'checkbox']
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const [buttonSelector, message] of alerts) {
|
||||||
|
await page.click(buttonSelector);
|
||||||
|
const alert = await page.find('ion-alert');
|
||||||
|
const compare = await page.compareScreenshot(message);
|
||||||
|
expect(alert).not.toBe(null);
|
||||||
|
expect(compare).toMatchScreenshot();
|
||||||
|
await alert.callMethod('dismiss');
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
@ -1,71 +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/alert/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('.alert-wrapper')));
|
|
||||||
return await this.driver.wait(until.elementIsVisible(this.driver.findElement(By.css('.alert-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('alert/standalone', () => {
|
|
||||||
register('should init', driver => {
|
|
||||||
const page = new E2ETestPage(driver, platform);
|
|
||||||
return page.navigate('#basic');
|
|
||||||
});
|
|
||||||
|
|
||||||
register('should open basic alert', driver => {
|
|
||||||
const page = new E2ETestPage(driver, platform);
|
|
||||||
return page.present('basic');
|
|
||||||
});
|
|
||||||
|
|
||||||
register('should open alert long message', driver => {
|
|
||||||
const page = new E2ETestPage(driver, platform);
|
|
||||||
return page.present('longMessage');
|
|
||||||
});
|
|
||||||
|
|
||||||
register('should open alert multiple buttons', driver => {
|
|
||||||
const page = new E2ETestPage(driver, platform);
|
|
||||||
return page.present('multipleButtons');
|
|
||||||
});
|
|
||||||
|
|
||||||
register('should open alert no message', driver => {
|
|
||||||
const page = new E2ETestPage(driver, platform);
|
|
||||||
return page.present('noMessage');
|
|
||||||
});
|
|
||||||
|
|
||||||
register('should open confirm alert', driver => {
|
|
||||||
const page = new E2ETestPage(driver, platform);
|
|
||||||
return page.present('confirm');
|
|
||||||
});
|
|
||||||
|
|
||||||
register('should open prompt alert', driver => {
|
|
||||||
const page = new E2ETestPage(driver, platform);
|
|
||||||
return page.present('prompt');
|
|
||||||
});
|
|
||||||
|
|
||||||
register('should open radio alert', driver => {
|
|
||||||
const page = new E2ETestPage(driver, platform);
|
|
||||||
return page.present('radio');
|
|
||||||
});
|
|
||||||
|
|
||||||
register('should open checkbox alert', driver => {
|
|
||||||
const page = new E2ETestPage(driver, platform);
|
|
||||||
return page.present('checkbox');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
28
core/src/components/alert/test/standalone/e2e.ts
Normal file
28
core/src/components/alert/test/standalone/e2e.ts
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import { newE2EPage } from '@stencil/core/testing';
|
||||||
|
|
||||||
|
it('alert: standalone', async () => {
|
||||||
|
const page = await newE2EPage({
|
||||||
|
url: '/src/components/alert/test/standalone?ionic:_testing=true'
|
||||||
|
});
|
||||||
|
|
||||||
|
const alerts = [
|
||||||
|
['#basic'],
|
||||||
|
['#longMessage', 'long message'],
|
||||||
|
['#multipleButtons', 'multiple buttons'],
|
||||||
|
['#noMessage', 'no message'],
|
||||||
|
['#confirm', 'confirm'],
|
||||||
|
['#prompt', 'prompt'],
|
||||||
|
['#radio', 'radio'],
|
||||||
|
['#checkbox', 'checkbox']
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const [buttonSelector, message] of alerts) {
|
||||||
|
await page.click(buttonSelector);
|
||||||
|
const alert = await page.find('ion-alert');
|
||||||
|
const compare = await page.compareScreenshot(message);
|
||||||
|
expect(alert).not.toBe(null);
|
||||||
|
expect(compare).toMatchScreenshot();
|
||||||
|
await alert.callMethod('dismiss');
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
Reference in New Issue
Block a user