mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
Merge remote-tracking branch 'origin/main' into chore/sync-7.0-with-main-12-05-22
This commit is contained in:
@ -1,42 +0,0 @@
|
||||
import { newE2EPage } from '@stencil/core/testing';
|
||||
import { generateE2EUrl } from '@utils/test';
|
||||
|
||||
export const testToast = async (type: string, selector: string, rtl = false) => {
|
||||
try {
|
||||
const pageUrl = generateE2EUrl('toast', type, rtl);
|
||||
|
||||
const page = await newE2EPage({
|
||||
url: pageUrl,
|
||||
});
|
||||
|
||||
const screenshotCompares = [];
|
||||
|
||||
const button = await page.find(selector);
|
||||
await button.waitForVisible();
|
||||
await button.click();
|
||||
|
||||
await page.waitForTimeout(250);
|
||||
|
||||
let toast = await page.find('ion-toast');
|
||||
await toast.waitForVisible();
|
||||
|
||||
expect(toast).not.toBe(null);
|
||||
await toast.waitForVisible();
|
||||
|
||||
screenshotCompares.push(await page.compareScreenshot());
|
||||
|
||||
await toast.callMethod('dismiss');
|
||||
await toast.waitForNotVisible();
|
||||
|
||||
screenshotCompares.push(await page.compareScreenshot('dismiss'));
|
||||
|
||||
toast = await page.find('ion-toast');
|
||||
expect(toast).toBe(null);
|
||||
|
||||
for (const screenshotCompare of screenshotCompares) {
|
||||
expect(screenshotCompare).toMatchScreenshot();
|
||||
}
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user