test(app): migrate tests to playwright (#25323)

This commit is contained in:
Liam DeBeasi
2022-05-23 09:38:53 -04:00
committed by GitHub
parent 8130f2c509
commit 5aa610709d
26 changed files with 37 additions and 37 deletions

View File

@ -0,0 +1,37 @@
import { expect } from '@playwright/test';
import { test } from '@utils/test/playwright';
import type { E2EPage } from '@utils/test/playwright';
test.describe('app: safe-area', () => {
const testOverlay = async (page: E2EPage, trigger: string, event: string, screenshotModifier: string) => {
const presentEvent = await page.spyOnEvent(event);
await page.click(trigger);
await presentEvent.next();
// Sometimes the inner content takes a frame or two to render
await page.waitForChanges();
expect(await page.screenshot()).toMatchSnapshot(`app-${screenshotModifier}-diff-${page.getSnapshotSettings()}.png`);
};
test.beforeEach(async ({ page }, testInfo) => {
test.skip(
testInfo.project.metadata.rtl === true,
'Safe area tests only check top and bottom edges. RTL checks are not required here.'
);
await page.goto(`/src/components/app/test/safe-area`);
});
test('should not have visual regressions with action sheet', async ({ page }) => {
await testOverlay(page, '#show-action-sheet', 'ionActionSheetDidPresent', 'action-sheet');
});
test('should not have visual regressions with menu', async ({ page }) => {
await testOverlay(page, '#show-menu', 'ionDidOpen', 'menu');
});
test('should not have visual regressions with picker', async ({ page }) => {
await testOverlay(page, '#show-picker', 'ionPickerDidPresent', 'picker');
});
test('should not have visual regressions with toast', async ({ page }) => {
await testOverlay(page, '#show-toast', 'ionToastDidPresent', 'toast');
});
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

View File

@ -1,37 +0,0 @@
import { newE2EPage } from '@stencil/core/testing';
test('app: safe-area', async () => {
const page = await newE2EPage({
url: '/src/components/app/test/safe-area?ionic:_testing=true',
});
expect(await page.compareScreenshot()).toMatchScreenshot();
// Action Sheet
await page.click('#show-action-sheet');
await page.waitForChanges();
const actionSheet = await page.find('ion-action-sheet');
expect(await page.compareScreenshot('action-sheet')).toMatchScreenshot();
await actionSheet.callMethod('dismiss');
// Menu
await page.click('#show-menu');
await page.waitForChanges();
const menu = await page.find('ion-menu');
expect(await page.compareScreenshot('menu')).toMatchScreenshot();
await menu.callMethod('close');
// Picker
await page.click('#show-picker');
await page.waitForChanges();
const picker = await page.find('ion-picker');
expect(await page.compareScreenshot('picker')).toMatchScreenshot();
await picker.callMethod('dismiss');
// Toast
await page.click('#show-toast');
await page.waitForChanges();
const toast = await page.find('ion-toast');
expect(await page.compareScreenshot('toast')).toMatchScreenshot();
await toast.callMethod('dismiss');
});