Flaky Tests — 15 Causes and Proven Fixes (2026)
The 15 root causes of flaky tests in 2026 and the exact fix for each. Timing, isolation, data, network, browser, CI, and infra causes — with Playwright, Cypress, and Selenium code samples.

Last updated 2026-07-20 · 13 min read · By Avinash K
Flake rate is the single strongest predictor of whether a QA team ships on time. Above 5% flake, engineers stop trusting CI; above 10%, they stop reading it. Here are the 15 causes we see repeatedly across audits — and the proven fix for each.
Key takeaways
- The 15 root causes grouped by category.
- Playwright, Cypress, and Selenium fixes for each.
- A weekly triage ritual that keeps flake below 2%.
- The one metric to track (Flake Rate, not Pass Rate).
1. Timing (5 causes)
- Fixed sleeps — replace with auto-waiting locators.
- Race on network —
page.waitForResponsethen assert. - Animation not settled — disable animations in test config.
- Focus stolen by another tab — pin browser tab, disable notifications.
- System clock skew — freeze time with fake timers.
2. Isolation (3 causes)
- Shared test data — each test creates and cleans its own user.
- Global state — reset localStorage / cookies between tests.
- Parallel worker collision — namespace by workerIndex.
3. Network and data (3 causes)
- Flaky third-party — stub in tests, contract-test separately.
- DB seeded once, mutated by tests — seed per test.
- External auth provider throttling — use a test tenant with high limits.
4. Infra and browser (4 causes)
- CPU-starved CI runner — raise runner size; do not add retries.
- Chrome version drift — pin browser version in Playwright config.
- Docker DNS caching — restart containers between suites.
- Retry masking real bugs — cap retries at 1 and quarantine on second failure.
5. Playwright fix sample — replace sleeps
// Bad
await page.waitForTimeout(3000);
await page.click('#submit');
// Good
await page.getByRole('button', { name: 'Submit' }).click();
await expect(page.getByRole('alert')).toBeVisible();See the Playwright masterclass and Selenium interview questions for framework-specific patterns.
6. Weekly triage ritual
- Every Monday, list top 10 tests by flake rate.
- Owner assigned within 24h.
- Quarantine tests above 20% flake — do not run on PRs.
- Hard cap: quarantine expires after 5 days; test is fixed or deleted.
Reference: Google Testing Blog on flakiness.
Most of the flake we trace back to design, not infrastructure: tests written after the code, against selectors and states nobody planned for. If that sounds familiar, work through our test-driven development (TDD) guide for QA engineers — writing the assertion first removes an entire class of timing and isolation flake before it reaches CI.