Skip to content

Commit 1253eed

Browse files
ci: more webkit sharding, limit workers. (#45)
1 parent 30735a6 commit 1253eed

File tree

7 files changed

+266
-54
lines changed

7 files changed

+266
-54
lines changed

.github/workflows/playwright.yml

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,33 @@ on:
1414

1515
jobs:
1616
e2e:
17-
name: E2E (Playwright, ${{ matrix.browser }})
17+
name: ${{ matrix.jobName }}
1818
runs-on: ubuntu-latest
1919
timeout-minutes: 35
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
browser:
24-
- chromium
25-
- webkit
23+
include:
24+
- browser: chromium
25+
jobName: E2E (Playwright, chromium)
26+
workers: 2
27+
shardIndex: 1
28+
shardTotal: 1
29+
- browser: webkit
30+
jobName: E2E (Playwright, webkit, shard 1/3)
31+
workers: 1
32+
shardIndex: 1
33+
shardTotal: 3
34+
- browser: webkit
35+
jobName: E2E (Playwright, webkit, shard 2/3)
36+
workers: 1
37+
shardIndex: 2
38+
shardTotal: 3
39+
- browser: webkit
40+
jobName: E2E (Playwright, webkit, shard 3/3)
41+
workers: 1
42+
shardIndex: 3
43+
shardTotal: 3
2644

2745
steps:
2846
- name: Checkout
@@ -54,20 +72,25 @@ jobs:
5472
- name: Run Playwright Tests
5573
env:
5674
CI: 'true'
57-
run: npm run test:e2e -- --project=${{ matrix.browser }}
75+
run: |
76+
SHARD_ARGS=''
77+
if [ '${{ matrix.shardTotal }}' != '1' ]; then
78+
SHARD_ARGS="--shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}"
79+
fi
80+
npm run test:e2e -- --project=${{ matrix.browser }} --workers=${{ matrix.workers }} $SHARD_ARGS
5881
5982
- name: Upload Playwright report
6083
uses: actions/upload-artifact@v6.0.0
6184
if: ${{ failure() }}
6285
with:
63-
name: playwright-report-${{ matrix.browser }}
86+
name: playwright-report-${{ matrix.browser }}-${{ matrix.shardIndex }}of${{ matrix.shardTotal }}
6487
path: playwright-report
6588
if-no-files-found: ignore
6689

6790
- name: Upload Playwright test results
6891
uses: actions/upload-artifact@v6.0.0
6992
if: ${{ failure() }}
7093
with:
71-
name: test-results-${{ matrix.browser }}
94+
name: test-results-${{ matrix.browser }}-${{ matrix.shardIndex }}of${{ matrix.shardTotal }}
7295
path: test-results
7396
if-no-files-found: ignore
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# WebKit Open PR Drawer Triage Handoff
2+
3+
Date: 2026-03-29
4+
Repository: develop
5+
Branch: bananas
6+
7+
## Scope
8+
9+
This document captures investigation and fixes for WebKit failures in Playwright tests in playwright/github-pr-drawer.spec.ts.
10+
11+
Original failing subset:
12+
13+
- Open PR drawer confirms and submits component/styles filepaths
14+
- Open PR drawer validates unsafe filepaths
15+
- Open PR drawer allows dotted file segments that are not traversal
16+
17+
## Original symptoms
18+
19+
- Test flow appeared to continue behind a confirmation dialog in WebKit.
20+
- Assertions expecting browser dialog events failed (browserDialogSeen false).
21+
- In some runs, Open PR status remained at the default neutral text:
22+
Configure repository, file paths, and branch details.
23+
24+
## Root cause summary
25+
26+
- The app uses a shared in-page dialog opened by showModal for Open PR confirmation when confirmBeforeSubmit is wired.
27+
- In WebKit, top-layer dialog timing and interaction can be flaky for test automation.
28+
- The old test logic and app behavior supported two confirmation paths (HTML dialog and native confirm), which increased test complexity and flake risk.
29+
30+
## Relevant app wiring (for context)
31+
32+
- PR drawer submit uses confirmBeforeSubmit when available in src/modules/github-pr-drawer.js.
33+
- App passes confirmBeforeSubmit to confirmAction in src/app.js.
34+
- confirmAction opens the shared dialog element with id clear-confirm-dialog via showModal.
35+
- Native window.confirm fallback has been removed.
36+
37+
## Changes made
38+
39+
Files:
40+
41+
- playwright/github-pr-drawer.spec.ts
42+
- src/app.js
43+
- src/modules/github-pr-drawer.js
44+
45+
1. Simplified tests to one confirmation path: HTML dialog only.
46+
2. Removed dual-path test handling (native browser dialog vs in-page dialog).
47+
3. Removed manual loop-based visibility fallback logic in tests.
48+
4. Kept stable submit/confirm interactions and path-input stabilization in PR drawer tests.
49+
5. Removed fallbackConfirmText usage from app call sites and PR drawer payload.
50+
6. Removed native window.confirm fallback logic from confirmAction.
51+
7. Unsupported dialog environments now no-op silently instead of showing a fallback prompt.
52+
53+
## Current status
54+
55+
Latest runs are green:
56+
57+
Command:
58+
CI=true npx playwright test playwright/github-pr-drawer.spec.ts --project=webkit --headed --grep "Open PR drawer confirms and submits component/styles filepaths"
59+
Result:
60+
1 passed
61+
62+
Command:
63+
CI=true npx playwright test playwright/github-pr-drawer.spec.ts --project=webkit --headed --grep "Open PR drawer confirms and submits component/styles filepaths|Open PR drawer allows dotted file segments that are not traversal|Open PR drawer validates unsafe filepaths"
64+
Result:
65+
3 passed
66+
67+
Command:
68+
npx playwright test playwright/github-pr-drawer.spec.ts --project=chromium
69+
Result:
70+
15 passed
71+
72+
Command:
73+
CI=true npx playwright test playwright/github-pr-drawer.spec.ts --project=webkit
74+
Result:
75+
15 passed
76+
77+
## Local changes currently present
78+
79+
- playwright/github-pr-drawer.spec.ts (modal-only confirmation helper refactor)
80+
- src/app.js (removed native confirm fallback and fallbackConfirmText usage)
81+
- src/modules/github-pr-drawer.js (removed fallbackConfirmText in submit confirmation payload)
82+
- playwright.config.ts (workers changed from CI 2 to CI 1)
83+
- package.json (added test:e2e:webkit using CI=true)
84+
85+
Note: playwright.config.ts worker change may be unrelated to this issue. Treat it as separate unless intentionally part of CI stabilization.
86+
87+
## Evergreen policy alignment
88+
89+
- Project policy is evergreen browsers only.
90+
- HTML dialog support is assumed.
91+
- No compatibility fallback is maintained for non-supporting/legacy environments.
92+
93+
## If this flakes again
94+
95+
1. Re-run only failing test first with headed mode and trace.
96+
2. Confirm clear-confirm-dialog opens and confirm button click is delivered.
97+
3. Confirm request flow occurs by adding temporary request counters for:
98+
99+
- git refs create
100+
- contents upsert
101+
- pulls create
102+
103+
4. If status remains default, verify submit click dispatch with a temporary event probe in test page context.
104+
5. Keep assertions outcome-based (status/request side effects), not browser-event-path assumptions.
105+
106+
## Suggested next validation
107+
108+
1. Run full github-pr-drawer.spec.ts on WebKit.
109+
2. Run same spec on Chromium and Firefox to ensure no regressions from helper changes.
110+
3. If stable, keep helper approach and remove any temporary probes.
111+
112+
## Minimal rollback plan
113+
114+
Use this only if WebKit flakiness returns and you need to quickly de-risk test helper changes.
115+
116+
1. In playwright/github-pr-drawer.spec.ts, rollback only interaction mechanics first:
117+
118+
- replace DOM evaluate click calls with standard Playwright click calls.
119+
120+
2. Keep path validation stabilizers unless proven harmful:
121+
122+
- keep explicit toHaveValue checks.
123+
- keep blur before submit in validation tests.
124+
125+
3. If still flaky, narrow rollback to failing tests only:
126+
127+
- inline confirmation flow in the failing tests and temporarily bypass shared helper usage.
128+
129+
4. Do not reintroduce native confirm fallback as a flake workaround.
130+
5. Do not mix rollback with config churn:
131+
132+
- avoid changing playwright.config.ts in the same rollback commit unless worker count is confirmed root cause.
133+
134+
Quick validation after each rollback step:
135+
136+
Command:
137+
CI=true npx playwright test playwright/github-pr-drawer.spec.ts --project=webkit --headed --grep "Open PR drawer confirms and submits component/styles filepaths"
138+
139+
Then:
140+
141+
Command:
142+
CI=true npx playwright test playwright/github-pr-drawer.spec.ts --project=webkit --headed --grep "Open PR drawer confirms and submits component/styles filepaths|Open PR drawer allows dotted file segments that are not traversal|Open PR drawer validates unsafe filepaths"
143+
144+
Stop rollback at first stable step and keep the smallest diff that remains green.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"check-types": "tsc -p tsconfig.json",
3838
"lint:playwright": "eslint playwright playwright.config.ts src/index.html",
3939
"test:e2e": "npm run build && PLAYWRIGHT_WEB_SERVER_MODE=preview PLAYWRIGHT_PORT=8081 playwright test",
40+
"test:e2e:webkit": "npm run build && PLAYWRIGHT_INCLUDE_WEBKIT=true PLAYWRIGHT_WEB_SERVER_MODE=preview PLAYWRIGHT_PORT=8081 playwright test --project=webkit",
4041
"test:e2e:dev": "playwright test",
4142
"test:e2e:headed": "npm run build && PLAYWRIGHT_WEB_SERVER_MODE=preview PLAYWRIGHT_PORT=8081 playwright test --headed",
4243
"test": "echo \"Error: no test specified\" && exit 1",

playwright.config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineConfig, devices } from '@playwright/test'
22

33
const env = process.env
44
const isCI = env?.CI === 'true'
5+
const includeWebKit = env?.PLAYWRIGHT_INCLUDE_WEBKIT === 'true'
56
const HOST = env?.PLAYWRIGHT_HOST ?? '127.0.0.1'
67
const PORT = Number(env?.PLAYWRIGHT_PORT ?? 4174)
78
const baseURL = env?.PLAYWRIGHT_BASE_URL ?? `http://${HOST}:${PORT}`
@@ -20,7 +21,7 @@ const projects = [
2021
},
2122
]
2223

23-
if (isCI) {
24+
if (isCI || includeWebKit) {
2425
projects.push({
2526
name: 'webkit',
2627
use: { ...devices['Desktop Safari'] },
@@ -31,7 +32,7 @@ export default defineConfig({
3132
testDir: 'playwright',
3233
timeout: isCI ? 120_000 : 20_000,
3334
retries: isCI ? 1 : 0,
34-
workers: isCI ? 2 : undefined,
35+
workers: isCI ? 1 : undefined,
3536
expect: {
3637
timeout: isCI ? 90_000 : 15_000,
3738
},

0 commit comments

Comments
 (0)