Skip to content

Retry E2E tests once in CI and report flaky results - #8318

Draft
isaacroldan wants to merge 1 commit into
mainfrom
isaac/e2e-playwright-retries
Draft

Retry E2E tests once in CI and report flaky results#8318
isaacroldan wants to merge 1 commit into
mainfrom
isaac/e2e-playwright-retries

Conversation

@isaacroldan

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

The E2E suite runs with retries: 0, so one flaky interaction fails the entire shard. Retrying alone would just hide the flake, so this pairs the retry with reporting.

WHAT is this pull request doing?

  • retries: isCI ? 1 : 0 — a test that fails once and passes on retry keeps the shard green. Local runs keep zero retries so flake fails fast during development.
  • maxFailures: 3 → 5 in CI — first attempts of flaky tests count toward the early-stop limit, so the old value could kill a shard before retries got to prove tests flaky rather than broken.
  • JSON reporter in CI + scripts/report-flaky.js — every failed-then-passed test is printed as a grep-able FLAKY: log line and listed in the GitHub job summary, so the nightly failure counter (and humans) can track flake instead of losing it to green shards.

Interaction with the cli-kit throttle retry (#8317)

Layered deliberately: the CLI-level retry absorbs short throttle bursts inside a command; the Playwright retry covers everything else. Worst-case per-test wall clock grows — if shards start brushing the 20-minute job timeout, that's the knob to revisit.

How to test your changes?

cd packages/e2e
mkdir -p test-results && echo '{"suites":[{"title":"x.spec.ts","suites":[{"title":"S","specs":[{"title":"t","file":"x.spec.ts","tests":[{"status":"flaky"}]}]}]}]}' > test-results/results.json
node scripts/report-flaky.js   # prints FLAKY: x.spec.ts › S › t

Measuring impact

  • n/a — CI/test-infra only, no user-facing impact

🤖 Generated with Claude Code

With retries: 0, a single flaky interaction fails the whole shard. CI
now retries each failing test once; a test that passes on retry keeps
the shard green.

Retries are only honest if flake stays visible, so the JSON reporter is
enabled in CI and scripts/report-flaky.js surfaces every
failed-then-passed test as a grep-able FLAKY: log line and in the GitHub
job summary. maxFailures goes from 3 to 5 because first attempts of
flaky tests count toward it, and the old limit could stop a shard
before retries prove tests flaky rather than broken.

Local runs keep retries: 0 so flake fails fast during development.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant