How to triage Playwright failures without guessing, rerunning blindly, or loosening the assertion
Every QA lead I know has lived this moment.
CI goes red. Someone says, “It’s probably flaky.” Someone hits rerun. The job goes green. The pull request moves on.
And we tell ourselves we handled it.
After 10+ years in Quality Assurance, I have learned that this habit is more dangerous than a failing test. A red build asks a question. A blind rerun answers a different one. You didn’t learn whether the product broke, whether the test is unstable, or whether the environment hiccupped. You only learned that the next attempt passed.
In January I wrote that I have seen teams spend more time fixing tests than finding defects, and delay a release not because of a bug, but because the automation itself was broken. Flaky Playwright tests are often how that starts.
So this edition is practical. Not another argument about automation. A way to triage a failure before you decide what it is.
The mistake is naming it too early
“Flaky” is a verdict. It is not a starting point.
A test that failed once and passed once might be unstable. It might also be a real defect that only appears under load, a race in the app, shared test data, or a network drop. If you label it flaky too early, you stop looking.
A useful first question is not “should we rerun it?” It is this:
Did this test pass and fail on the same code?
If it failed on every attempt, and the error is the same, you may be looking at a likely real bug, a broken locator, or an environment issue. If you only have one failed attempt, you do not have a diagnosis yet. You need more runs.
The second question is: what does the error actually say?
Not the summary line. The words in the log.
Read the evidence, then put it in a bucket
When I sit with a Playwright failure, I try to put it into one of a few buckets, using the error text, not a hunch:
- Selectors. The locator never found the element, found zero elements, or hit a strict mode violation. A typo in a role name lives here.
- Timing. The test ran out of time, a wait was too short, or the page was still loading. A locator that did resolve, but the element was still hidden, is often timing, not a missing selector.
- Environment. A disconnected network, a connection refused, a 5xx from the server. Infrastructure, not the assertion.
- Test data. The record already existed, the fixture was dirty, or two tests shared state.
- Unknown, for now. The expected value and the received value don’t match, and the error doesn’t point to a locator or a timeout. That can still be a real product bug. It can also be a bad assumption in the test.
Two rules save a lot of pain.
Don’t loosen the assertion just to make the test pass. If the page said “Ready” and the test expected a different heading, the interesting work is to decide which one is wrong.
And don’t hide the first failure behind retries. Playwright retries are useful, but a retry that turns a fail into a pass can bury the original error. If you collect more attempts, keep that first failure visible.
Prefer a Playwright JSON report when you can. It keeps every retry attempt. A default JUnit report usually does not.
This is slow to do by hand. That’s where a tool helps.
Our QA team does this work on Playwright reports. The method is the same whether you do it yourself or with help: parse every attempt the report contains, quote the evidence, name a likely cause, and only then suggest a next step.
That is why we built qa-core-flaky, an open-source CLI on npm. It is not a model guessing at your tests. The likely causes are deterministic rules. The verdict engine does not call a model. It reads a Playwright JSON report or a JUnit XML report and writes a triage report you can share.
If you already have a JSON report from Playwright, this is the command:
npm i -D qa-core-flaky npx qa-core-flaky triage <report.json> --out-dir out --html It writes triage.json, triage.md, and a self-contained HTML report. Passed tests are not listed. Home usernames and token-like strings are hidden by default, so the HTML file is the one I would send to a colleague.
I ran the published package, version 0.1.2, against its own Playwright fixture report. Three failures came back as three different verdicts.
always fails was a likely real bug, with medium confidence. Every attempt failed with the same signature. The evidence was plain:
Expected: "a different heading"
Received: "Ready"
The suggested fix was to compare those values with what the user sees, and not loosen the assertion. “Likely” is the right word. The report does not say the bug is confirmed, and neither should we.
flaky by retry was flaky, with low confidence, because there were only two attempts: one pass and one fail on the same code. The report also added a sentence I agree with: “A flaky test can still point to a real app defect. Check the app behavior too.”
times out was needs more runs. The locator getByRole('button', { name: 'Never Appears' }) never resolved, and the test timed out at 1000ms. That is a signal, not a final verdict. The next step is more attempts, with the first failure still visible.
On a recorded run against the public SauceDemo practice app, the same kind of report is easier to show a team. One test, “login page loads after a network drop,” was marked flaky with high confidence. The evidence was a single line:
Error: page.goto: net::ERR_INTERNET_DISCONNECTED at https://www.saucedemo.com/
The suggested fix was to check the network and the base URL, and to keep retries only for infrastructure errors. That is a very different conversation from “the login test is flaky.”
If you want more attempts, rerun will collect them. It defaults to --retries 0, so a retry inside the rerun cannot hide the first failure.
What still needs human judgment
A tool can quote the error and apply a decision table. It cannot own the release.
Someone still has to decide whether the locator is wrong or the button is genuinely missing. Someone still has to decide whether to fix the test, fix the app, or fix the environment. Someone still has to say whether the build is safe to ship.
A flaky verdict can still be an app defect that only appears sometimes. Shared state, a race in the UI, a slow API: those are product problems that show up as unstable tests.
That is the same point I keep coming back to in this newsletter. Tools can scale the mechanical work. Quality remains a human responsibility.
The takeaway
The next time a Playwright test fails, resist the urge to start with a rerun.
Open the report. Look at every attempt. Ask whether a pass and a fail share the same code. Quote the error. Put it in a bucket. If you only have one failure, say so, and collect more evidence without burying the first one.
If you want help doing that on a real report, try qa-core-flaky. It is free, open source, and takes a JSON or JUnit file you already have:
github.com/sprintsynergyio/qa-core-flaky
npmjs.com/package/qa-core-flaky
SprintSynergy is an AI-based QA automation company: AI testing agents plus our QA team. We use tools like this so our QA team can spend less time guessing at red builds, and more time judging the risk.
What’s the last failure your team reran without reading the error?


