test(app): migrate to generators (#27287)
Issue number: N/A --------- <!-- Please refer to our contributing documentation for any questions on submitting a pull request, or let us know here if you need any help: https://ionicframework.com/docs/building/contributing --> <!-- Some docs updates need to be made in the `ionic-docs` repo, in a separate PR. See https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation for details. --> <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> App tests are using legacy E2E format ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - App E2E tests us generator format ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
@ -1,34 +0,0 @@
|
|||||||
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();
|
|
||||||
|
|
||||||
await expect(page).toHaveScreenshot(`app-${screenshotModifier}-diff-${page.getSnapshotSettings()}.png`);
|
|
||||||
};
|
|
||||||
test.beforeEach(async ({ page, skip }) => {
|
|
||||||
skip.rtl('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');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
37
core/src/components/app/test/safe-area/app.e2e.ts
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import { expect } from '@playwright/test';
|
||||||
|
import { configs, test } from '@utils/test/playwright';
|
||||||
|
import type { E2EPage } from '@utils/test/playwright';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Safe area tests only check top and bottom edges. RTL checks are not required here.
|
||||||
|
*/
|
||||||
|
configs({ directions: ['ltr'] }).forEach(({ config, title, screenshot }) => {
|
||||||
|
test.describe(title('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();
|
||||||
|
|
||||||
|
await expect(page).toHaveScreenshot(screenshot(`app-${screenshotModifier}-diff`));
|
||||||
|
};
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
|
await page.goto(`/src/components/app/test/safe-area`, config);
|
||||||
|
});
|
||||||
|
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');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |