QA Automation Hub

Tutorials › Flaky Tests: What They Are and How to Fix Them

Flaky Tests: What They Are and How to Fix Them

By the QA Automation Hub team, powered by AtumCode · Updated 2026-11-20

A flaky test passes on one run and fails on the next, with no code change. Flaky tests waste time and make people stop trusting the results.

Common causes

How to fix them

  1. Wait for something visible that proves the step finished, such as a heading or a message.
  2. Use tools that wait for you. In Playwright, await expect(locator).toBeVisible() keeps checking until it is true or time runs out.
  3. Give every test its own data, for example a unique name with a random id.
  4. Open the trace or video of the failed run to see what really happened.

What not to do

Do not raise the number of retries to hide the problem. Retries can help a little, but the real fix is to find the cause.

Want to practise this step by step?
Our free Playwright course teaches it in simple English, one day at a time.
Open the free course