Skip to content

Commit a1ba798

Browse files
committed
fix(a11y-testing-spike): move playwright a11y config to root
1 parent 3416bea commit a1ba798

File tree

8 files changed

+28
-26
lines changed

8 files changed

+28
-26
lines changed

1st-gen/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@
9696
"@lit/react": "1.0.8",
9797
"@open-wc/dev-server-hmr": "0.2.0",
9898
"@open-wc/testing": "4.0.0",
99-
"@playwright/test": "1.53.1",
10099
"@rollup/plugin-commonjs": "25.0.8",
101100
"@rollup/plugin-json": "6.1.0",
102101
"@rollup/plugin-node-resolve": "15.3.1",

1st-gen/test/a11y-helpers.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ export async function gotoStory(
8484
elementSelector: string
8585
): Promise<Locator> {
8686
// Navigate to story (baseURL is set by Playwright project config)
87-
await page.goto(`/iframe.html?id=${storyId}&viewMode=story`);
87+
await page.goto(`/iframe.html?id=${storyId}&viewMode=story`, {
88+
waitUntil: 'domcontentloaded',
89+
});
8890

8991
// Wait for story to be ready
9092
return waitForStoryReady(page, elementSelector);

2nd-gen/package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,16 @@
2525
"storybook": "yarn workspace @adobe/swc storybook",
2626
"storybook:build": "yarn workspace @adobe/swc storybook:build",
2727
"test": "yarn workspace @adobe/swc test",
28-
"test:a11y": "playwright test --config=playwright.a11y.config.ts",
29-
"test:a11y:1st": "playwright test --config=playwright.a11y.config.ts --project=1st-gen",
30-
"test:a11y:2nd": "playwright test --config=playwright.a11y.config.ts --project=2nd-gen",
28+
"test:a11y": "playwright test --config=../playwright.a11y.config.ts",
29+
"test:a11y:1st": "playwright test --config=../playwright.a11y.config.ts --project=1st-gen",
30+
"test:a11y:2nd": "playwright test --config=../playwright.a11y.config.ts --project=2nd-gen",
3131
"test:a11y:report": "playwright show-report test/playwright-a11y/report",
32-
"test:a11y:ui": "playwright test --config=playwright.a11y.config.ts --ui"
32+
"test:a11y:ui": "playwright test --config=../playwright.a11y.config.ts --ui"
3333
},
3434
"workspaces": [
3535
"packages/*"
3636
],
3737
"devDependencies": {
38-
"@axe-core/playwright": "4.11.0",
39-
"@playwright/test": "1.53.1",
4038
"eslint": "8.57.1",
4139
"eslint-plugin-simple-import-sort": "12.1.1",
4240
"npm-run-all2": "8.0.4"

2nd-gen/packages/swc/utils/a11y-helpers.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ export async function gotoStory(
8484
elementSelector: string
8585
): Promise<Locator> {
8686
// Navigate to story (baseURL is set by Playwright project config)
87-
await page.goto(`/iframe.html?id=${storyId}&viewMode=story`);
87+
await page.goto(`/iframe.html?id=${storyId}&viewMode=story`, {
88+
waitUntil: 'domcontentloaded',
89+
});
8890

8991
// Wait for story to be ready
9092
return waitForStoryReady(page, elementSelector);

CONTRIBUTOR-DOCS/01_contributor-guides/09_accessibility-testing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ Received: [
384384
385385
### Playwright config
386386
387-
`2nd-gen/playwright.a11y.config.ts` defines two projects:
387+
`playwright.a11y.config.ts` (at the root) defines two projects:
388388
389389
```typescript
390390
projects: [
@@ -426,11 +426,12 @@ webServer: [
426426

427427
```
428428
spectrum-web-components/
429+
├── playwright.a11y.config.ts # Playwright config (both gens)
429430
├── CONTRIBUTOR-DOCS/
430431
│ └── 01_contributor-guides/
431432
│ └── 09_accessibility-testing.md # This guide
432433
├── 1st-gen/
433-
│ ├── package.json # Test scripts (points to 2nd-gen config)
434+
│ ├── package.json # Test scripts (points to root config)
434435
│ ├── test/
435436
│ │ └── a11y-helpers.ts # 1st gen test helpers
436437
│ └── packages/
@@ -441,8 +442,7 @@ spectrum-web-components/
441442
│ ├── status-light.a11y.spec.ts
442443
│ └── status-light.a11y.spec.ts-snapshots/
443444
└── 2nd-gen/
444-
├── playwright.a11y.config.ts # Playwright config (both gens)
445-
├── package.json # Test scripts
445+
├── package.json # Test scripts (points to root config)
446446
└── packages/swc/
447447
├── utils/
448448
│ └── a11y-helpers.ts # 2nd gen test helpers

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
"start:1st-gen": "yarn workspace @spectrum-web-components/1st-gen start",
2828
"start:2nd-gen": "yarn workspace @spectrum-web-components/2nd-gen start",
2929
"test": "run-p test:2nd-gen test:1st-gen",
30-
"test:a11y": "playwright test --config=../2nd-gen/playwright.a11y.config.ts",
31-
"test:a11y:ui": "playwright test --config=../2nd-gen/playwright.a11y.config.ts --ui",
32-
"test:a11y:1st": "playwright test --config=../2nd-gen/playwright.a11y.config.ts --project=1st-gen",
33-
"test:a11y:2nd": "playwright test --config=../2nd-gen/playwright.a11y.config.ts --project=2nd-gen",
34-
"test:a11y:report": "playwright show-report ../2nd-gen/test/playwright-a11y/report",
30+
"test:a11y": "playwright test --config=playwright.a11y.config.ts",
31+
"test:a11y:ui": "playwright test --config=playwright.a11y.config.ts --ui",
32+
"test:a11y:1st": "playwright test --config=playwright.a11y.config.ts --project=1st-gen",
33+
"test:a11y:2nd": "playwright test --config=playwright.a11y.config.ts --project=2nd-gen",
34+
"test:a11y:report": "playwright show-report 2nd-gen/test/playwright-a11y/report",
3535
"test:1st-gen": "yarn workspace @spectrum-web-components/1st-gen test",
3636
"test:2nd-gen": "yarn workspace @spectrum-web-components/2nd-gen test"
3737
},
@@ -47,9 +47,11 @@
4747
"playwright": "1.53.1"
4848
},
4949
"devDependencies": {
50+
"@axe-core/playwright": "4.11.0",
5051
"@changesets/cli": "2.29.7",
5152
"@commitlint/cli": "19.8.1",
5253
"@commitlint/config-conventional": "19.8.1",
54+
"@playwright/test": "1.53.1",
5355
"genversion": "3.2.0",
5456
"husky": "9.1.7",
5557
"lint-staged": "16.2.6",
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const config: PlaywrightTestConfig = {
1919
forbidOnly: !!process.env.CI,
2020
retries: process.env.CI ? 2 : 0,
2121
reporter: [
22-
['html', { outputFolder: 'test/playwright-a11y/report' }],
22+
['html', { outputFolder: '2nd-gen/test/playwright-a11y/report' }],
2323
['list'],
2424
],
2525

@@ -32,7 +32,7 @@ const config: PlaywrightTestConfig = {
3232
projects: [
3333
{
3434
name: '1st-gen',
35-
testDir: '../1st-gen/',
35+
testDir: './1st-gen/',
3636
testMatch: '**/packages/*/test/**/*.a11y.spec.ts',
3737
use: {
3838
...devices['Desktop Chrome'],
@@ -41,7 +41,7 @@ const config: PlaywrightTestConfig = {
4141
},
4242
{
4343
name: '2nd-gen',
44-
testDir: './',
44+
testDir: './2nd-gen/',
4545
testMatch: '**/packages/swc/components/*/test/**/*.a11y.spec.ts',
4646
use: {
4747
...devices['Desktop Chrome'],
@@ -52,13 +52,13 @@ const config: PlaywrightTestConfig = {
5252

5353
webServer: [
5454
{
55-
command: 'cd ../1st-gen && yarn storybook',
55+
command: 'cd 1st-gen && yarn storybook',
5656
port: 8080,
5757
reuseExistingServer: !process.env.CI,
5858
timeout: 120 * 1000,
5959
},
6060
{
61-
command: 'cd packages/swc && yarn storybook',
61+
command: 'cd 2nd-gen/packages/swc && yarn storybook',
6262
port: 6006,
6363
reuseExistingServer: !process.env.CI,
6464
timeout: 120 * 1000,

yarn.lock

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5323,7 +5323,6 @@ __metadata:
53235323
"@lit/react": "npm:1.0.8"
53245324
"@open-wc/dev-server-hmr": "npm:0.2.0"
53255325
"@open-wc/testing": "npm:4.0.0"
5326-
"@playwright/test": "npm:1.53.1"
53275326
"@rollup/plugin-commonjs": "npm:25.0.8"
53285327
"@rollup/plugin-json": "npm:6.1.0"
53295328
"@rollup/plugin-node-resolve": "npm:15.3.1"
@@ -5430,8 +5429,6 @@ __metadata:
54305429
version: 0.0.0-use.local
54315430
resolution: "@spectrum-web-components/2nd-gen@workspace:2nd-gen"
54325431
dependencies:
5433-
"@axe-core/playwright": "npm:4.11.0"
5434-
"@playwright/test": "npm:1.53.1"
54355432
eslint: "npm:8.57.1"
54365433
eslint-plugin-simple-import-sort: "npm:12.1.1"
54375434
npm-run-all2: "npm:8.0.4"
@@ -27167,9 +27164,11 @@ __metadata:
2716727164
version: 0.0.0-use.local
2716827165
resolution: "root-workspace-0b6124@workspace:."
2716927166
dependencies:
27167+
"@axe-core/playwright": "npm:4.11.0"
2717027168
"@changesets/cli": "npm:2.29.7"
2717127169
"@commitlint/cli": "npm:19.8.1"
2717227170
"@commitlint/config-conventional": "npm:19.8.1"
27171+
"@playwright/test": "npm:1.53.1"
2717327172
genversion: "npm:3.2.0"
2717427173
husky: "npm:9.1.7"
2717527174
lint-staged: "npm:16.2.6"

0 commit comments

Comments
 (0)