GuidesZero flaky tests
The no-flake strategy
How Endform helps you hold a growing Playwright suite near a 99.9% pass rate, and pull it back quickly whenever change introduces instability.
Keeping a Playwright suite free of flakes is ongoing work, not a one-time cleanup. Hold your suite near a 99.9% pass rate almost all the time, and use three fast mechanisms to pull it straight back whenever it dips: a weekly flake loop, on-demand triage of failed pull requests, and natural-language steps for volatile UI.
Most teams talk about flaky tests as a one-time cleanup problem: pause feature work for a week, stabilize every test, and hope the suite stays green forever.
It never does. Your product changes every day, dependencies move, browsers update, and your test suite grows right alongside your codebase. Things changing is a sign of a healthy team, not a failure of discipline. Expecting a suite to stay stable on its own is what sets teams up to fail.


Why trust breaks faster than pass rates
A flake is a test that sometimes passes and sometimes fails on the same code.
Confidence in an end-to-end suite does not drop linearly with pass rate. Once engineers expect a red pull request to be "probably a flake", they stop investigating failures, hit re-run out of habit, and real regressions start slipping into production. In practice, that trust cliff sits right around 99%: once a suite drops noticeably below 99%, people stop believing it.
Small per-test flake rates compound across a growing suite much faster than intuition suggests. Try adjusting the suite size, per-test flake rate, and retry count below:
Even with one retry turned on, a 5% per-test flake rate leaves a 100-test suite failing more than one in five pull requests.
That math points to a practical split between two kinds of flakiness:
- 1-in-10 to 1-in-100 flakes: These should be fixed. Failures happening this often are usually real problems in your application or a broken wait in a test. In BikeBook (our sample app in
endformdev/playwright-guides), intermittent failures exposed real user-facing bugs: a Settings form that wiped typed text when/api/userresolved slowly, an activity log that shuffled entries sharing a timestamp, and a lagging read-through cache returning stale team data. End-to-end tests are one of the best ways to catch races your users are already hitting in production. - 1-in-1,000 blips: These can be absorbed with retries. Distributed systems, preview deployments, and live networks always have rare hiccups. Retries exist for a reason. A single Playwright retry legitimately absorbs one-in-a-thousand noise without blocking merges or burning engineering time.
Why stored test history is the foundation
You cannot run a no-flake strategy from isolated CI logs or single-run HTML reports.
When a test fails on a pull request, a single trace tells you what threw an error, not what it means. It cannot tell you whether the failure is unique to this branch, a 1-in-20 flake that has been failing on main all week, or an upstream outage hitting five pull requests at once.
Endform stores every suite run, attempt, and trace so humans and coding agents can answer three questions directly:
- Rolling pass-rate rankings: Rank tests on
mainover the last 7 days so work-in-progress pull requests never distort your reliability picture. - Retry visibility: Spot tests that still turn pull requests green only because they passed on retry, before they fail twice in a row and block a merge.
- Automatic failure diffs and replays: Whenever a matching passing run is available, Endform compares a failing attempt side by side against it automatically, surfacing diverging steps, network activity, screenshots, and a shareable replay.
You can explore what this looks like right now in BikeBook's live public Flake Lab organization, where suites/05-flake-lab runs every six hours against an intentionally flaky deployment:
BikeBook Flake Lab organization
A live public Endform organization running robust and intermittently flaky BikeBook tests every six hours, showing real pass-rate trends and top recurring flakes.
Three mechanisms to keep a suite near 99.9%
Instead of heroic cleanup sprints, active flake management relies on three lightweight mechanisms that reinforce each other. Coding agents can run most of the legwork across all three while engineers review small, focused diffs.


- Fix the two most unstable tests every week: Flake pain follows a power law, so a handful of tests almost always cause most red pull requests. A practical cadence for active flake management is a weekly pass (ideally run by a scheduled coding agent): rank the two worst tests on
main, inspect their failing attempts, fix the root cause in the app or test, verify across repeated runs without retries, and open a small pull request. See Solve your most common flakes every week. - Triage pull request failures on demand: When a pull request turns red, run a "why did this fail?" check before anyone presses re-run. If the failure is isolated to this branch, surface the diverging step and replay link so the next human or agent fixes it immediately. If the same test is already failing for everyone else on
main, notify an owner, feed it into the weekly loop, and optionally quarantine it with an expiry to unblock the merge. See Triage failed tests on demand. - Write volatile steps as natural language: Well-described actions hold up much better than raw low-level Playwright code as an app evolves. With Playwright Intent,
ai.do(...)compiles into cached, reviewable Playwright TypeScript files for fast deterministic runs, while a live browser agent handles smaller adjustments on demand without masking real application bugs. See Test steps as natural language.
Start where you are
Pick the guide that addresses your biggest bottleneck right now:
Replace blind CI retries with an immediate "why did this fail?" step and optional time-boxed quarantine.
Solve your most common flakes every weekRun the weekly top-2 maintenance loop manually or via a scheduled coding agent to pull pass rates back toward 99.9%.
Test steps as natural languageDelegate brittle step mechanics to AI with Playwright Intent while keeping tests deterministic and honest on real bugs.
Last updated