Skip to main content
Engineering Deep Dives

Flaky Tests Are Bugs: A Field Guide

P
Priya Raman

Sep 30, 2026 · 1 min read · 2 comments

A flaky test teaches your team to ignore red builds. That is far more dangerous than the bug it was meant to catch.

Common causes

  • Waiting on time instead of state (sleep(2000)).
  • Tests that share data and depend on order.
  • Animations and network calls that sometimes take longer.

Fixes that work

Wait for conditions, not durations. In Playwright, web-first assertions retry automatically:

await expect(page.getByRole('status')).toHaveText('Saved');

Give every test its own data. Quarantine flaky tests automatically and track them like any other bug.

Share WhatsApp Post LinkedIn
3 Like 5 Insightful 3 Fire
Sign in to react and save

Discussion (2)

Sign in to join the discussion.

Kenechukwu Igwe ·

Web-first assertions removed about 80% of our sleeps. Great guide.

Adaeze Okafor ·

Good guide