Skip to content

Commit 87f5840

Browse files
authored
test(picker-internal): screenshot and a11y (axe) (#25150)
1 parent ee3bf31 commit 87f5840

File tree

58 files changed

+337
-205
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+337
-205
lines changed

core/package-lock.json

Lines changed: 267 additions & 132 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"loader/"
3232
],
3333
"dependencies": {
34+
"@axe-core/playwright": "^4.4.2",
3435
"@stencil/core": "^2.14.2",
3536
"ionicons": "^6.0.0",
3637
"tslib": "^2.1.0"

core/src/components/picker-internal/test/a11y/e2e.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import AxeBuilder from '@axe-core/playwright';
2+
import { expect } from '@playwright/test';
3+
import { test } from '@utils/test/playwright';
4+
5+
test.describe('picker-internal: a11y', () => {
6+
test('should not have accessibility violations', async ({ page }) => {
7+
await page.goto(`/src/components/picker-internal/test/a11y`);
8+
9+
const results = await new AxeBuilder({ page }).analyze();
10+
11+
expect(results.violations).toEqual([]);
12+
});
13+
});

core/src/components/picker-internal/test/basic/e2e.ts

Lines changed: 0 additions & 62 deletions
This file was deleted.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { expect } from '@playwright/test';
2+
import { test } from '@utils/test/playwright';
3+
4+
const isMobileSafariLinux = (userAgent?: string) => {
5+
return userAgent?.includes('Linux') === true && userAgent?.includes('Mobile Safari') === true;
6+
};
7+
8+
test.describe('picker-internal', () => {
9+
test('inline pickers should not have visual regression', async ({ page }) => {
10+
await page.goto(`/src/components/picker-internal/test/basic`);
11+
12+
await page.setIonViewport();
13+
14+
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot(
15+
`picker-internal-inline-diff-${page.getSnapshotSettings()}.png`
16+
);
17+
});
18+
19+
test.describe('within overlay:', () => {
20+
// TODO (FW-1397): Remove this test.skip when the issue is fixed.
21+
test.skip(
22+
({ userAgent }) => isMobileSafariLinux(userAgent),
23+
'Mobile Safari on Linux renders the selected option incorrectly'
24+
);
25+
26+
test('popover: should not have visual regression', async ({ page }) => {
27+
await page.goto(`/src/components/picker-internal/test/basic`);
28+
29+
await page.setIonViewport();
30+
31+
await page.click('#popover');
32+
33+
await page.spyOnEvent('ionPopoverDidPresent');
34+
await page.waitForChanges();
35+
36+
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot(
37+
`picker-internal-popover-diff-${page.getSnapshotSettings()}.png`
38+
);
39+
});
40+
41+
test('modal: should not have visual regression', async ({ page }) => {
42+
await page.goto(`/src/components/picker-internal/test/basic`);
43+
44+
await page.setIonViewport();
45+
46+
await page.click('#modal');
47+
48+
await page.spyOnEvent('ionModalDidPresent');
49+
await page.waitForChanges();
50+
51+
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot(
52+
`picker-internal-modal-diff-${page.getSnapshotSettings()}.png`
53+
);
54+
});
55+
});
56+
});

0 commit comments

Comments
 (0)