WEB-1238: [CI/CD] Surface retry outcomes from Playwright E2E as a flake signal - #3991
Conversation
…ke signal playwright.config.ts retries failed tests twice in CI. That keeps PRs unblocked on transient noise, but a test can fail and then pass on a retry inside a run that ends green. The github reporter names such tests in its run-summary annotation, yet the failed attempt is annotated as an error indistinguishable from a real failure, nothing is written to the job summary, and nothing is kept in machine-readable form. Add the json reporter to `playwright:ci`, writing to playwright-report/results.json so the existing always-on upload keeps it, and add a step that renders the report into the job summary: pass, fail, skip and flaky counts on every run, plus a table naming each flaky test with its project, attempt count and first failure. The json reporter is listed after html on purpose. Reporters finish in the order listed and the html reporter clears its output folder when it finishes, so the reverse order deletes results.json. The summary step runs with continue-on-error, so it can report on any run but never change its result. Retry and worker settings are unchanged.
|
Note
|
| Layer / File(s) | Summary |
|---|---|
Generate Playwright JSON reports package.json, scripts/summarize-flaky-tests.js |
The CI Playwright command adds the json reporter. The summary script defines report-processing configuration and dependencies. |
Collect and sanitize flaky tests scripts/summarize-flaky-tests.js |
The script recursively collects flaky tests, normalizes report paths, and sanitizes first-failure messages for Markdown output. |
Render and publish the summary scripts/summarize-flaky-tests.js |
The script renders test statistics and flaky-test details. It validates the report argument and writes output to GITHUB_STEP_SUMMARY or stdout. |
Priority: ⬇️ Low
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Feature
Suggested reviewers: alberto-art3ch
Sequence Diagram(s)
sequenceDiagram
participant PlaywrightCI
participant JSONReport
participant SummaryScript
participant GitHubStepSummary
PlaywrightCI->>JSONReport: Generate Playwright test results
SummaryScript->>JSONReport: Read report
SummaryScript->>SummaryScript: Find and sanitize flaky tests
SummaryScript->>GitHubStepSummary: Write Markdown summary
Merge Risk: ⚪ Minimal · up to 3c278
The CI reporting change has no confirmed merge-blocking risk.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 1 files. (1 skipped: 1 … | Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title clearly and concisely describes the main change: reporting Playwright retry outcomes as a signal for flaky tests in CI/CD. |
Full details: Docstring Coverage
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 1 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Description
playwright.config.tsretries failed tests twice in CI (retries: process.env.CI ? 2 : 0). That keeps PRs unblocked on transient noise, but it means a test can fail and then pass on a retry inside a run that ends green.The
githubreporter already names such tests — its🎭 Playwright Run Summaryannotation has anN flakyline — but the signal is easy to miss and hard to use:This adds:
jsonreporter tonpm run playwright:ci, writing toplaywright-report/results.jsonviaPLAYWRIGHT_JSON_OUTPUT_FILE. It sits insideplaywright-report/, so the existingif: always()upload keeps it on every run — no new artifact.scripts/summarize-flaky-tests.js, which reads that report and writes to$GITHUB_STEP_SUMMARY:0 flaky · 236 passed · 0 failed · 5 skipped, so silence is never the signal;Summarize flaky testsstep right afterRun Playwright tests, withif: always()andcontinue-on-error: true, so it reports on any run but can never change the job's result.Illustrative output — this repo's real test list, with two tests forced flaky:
Design notes worth reviewing:
jsonhas to stay afterhtmlinplaywright:ci. Playwright calls each reporter'sonEndin list order, and the html reporter clearsplaywright-report/when it finishes. Withhtml,github,jsonthe JSON file is written after that and survives; withjsonfirst it is deleted. A comment next toPLAYWRIGHT_JSON_OUTPUT_FILErecords this.--reporteron the CLI replaces the config's reporter list, so anoutputFileinplaywright.config.tswould not apply. Without the variable, the JSON goes to stdout.Current baseline, for context: across 159 completed
Playwright E2Eruns between 2026-09-02 and 2026-09-11, 2 runs had one flaky test each —clients/create-client.spec.ts:95andclose-client.spec.ts:128, both locator timeouts. So0 flakyis the expected line on nearly every run; the point is that it stays measured rather than assumed.Note for reviewers:
.gitignoreline 76 (scripts/, added together withdocs/in b23dcbc) matches this directory even though every script in it is tracked —render-amplify-env.jswas added after the rule. The new script is tracked the same way; the ignore rule itself is left untouched here.Related issues and discussion
WEB-1238
Related: #3917 (WEB-1184) — the nightly drift canary this gives a flaky-test baseline to.
Screenshots, if any
N/A — the job summary of this PR's own
Playwright E2Erun shows the output.Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
If you have multiple commits please combine them into one commit by squashing them.
Read and understood the contribution guidelines at
web-app/.github/CONTRIBUTING.md.Summary by CodeRabbit
New Features
Testing