Halmurat T.
Halmurat T.

Senior SDET

Home Blog Books ask About

The Dispatch

Weekly QA notes from the trenches.

Welcome aboard!

You're on the list. Expect real-world QA insights — no fluff, no spam.

© 2026 Halmurat T.

Automation 28
  • Selenium
  • Playwright
  • Appium
  • Cypress
AI Testing 67
CI/CD 12
  • GitHub Actions
  • Slack Reporting
QA Strategy 10
Case Studies 8
Blog/CI/CD
CI/CDHalmurat T./September 22, 2026/3 min

Quick Tip: Diff Passing vs Failing Playwright Traces

Filed underplaywright/cicd/debugging/trace-viewer
Quick Tip: Diff Passing vs Failing Playwright Traces

Table of Contents
  • How does retain-on-failure-and-retries work?
  • Open the two traces side by side
  • The passing trace is the baseline you were missing

On this page

  • How does retain-on-failure-and-retries work?
  • Open the two traces side by side
  • The passing trace is the baseline you were missing

The most useful trace in a flaky-test investigation is the one Playwright throws away. retain-on-failure keeps the failing attempt — but discards the passing retry, your only record of what correct timing looks like. Playwright’s retain-on-failure-and-retries trace mode, shipped in 1.59, keeps both.

That pair is for the flake you can’t reproduce locally: green 50 times on your laptop, red once a day in CI. Stop trying to reproduce it — CI already did, twice, minutes apart. The trace pair is the reproduction.

How does retain-on-failure-and-retries work?

It records a trace for every attempt and, once any attempt fails, retains all of them — including the passing retry every older mode discarded. Teams used to flip between on-first-retry and retain-on-failure and hope (the feature request reads like group therapy). Now it’s one line:

playwright.config.ts
import { defineConfig } from '@playwright/test';
export default defineConfig({
retries: process.env.CI ? 2 : 0,
use: {
trace: 'retain-on-failure-and-retries',
},
});

Open the two traces side by side

Each attempt gets its own folder under test-results/ — the retry carries a -retry1 suffix:

terminal
npx playwright show-trace test-results/checkout-promo-code/trace.zip &
npx playwright show-trace test-results/checkout-promo-code-retry1/trace.zip

Two windows, one screen — the trace viewer has no built-in compare mode. Find the last action both runs share, then read the network panels from there.

The passing trace is the baseline you were missing

A failing trace alone is ambiguous. At a large retail platform we stared at one for three sprints: a cart-totals request took 2.4 seconds and the test clicked a still-disabled button. Slow API, or bad wait? The passing retry’s trace settled it in ten minutes — same request at 310ms, same click, but only after a totals refresh the failing attempt never awaited. The fix was one await, the classic async trap behind flaky Playwright tests.

Two caveats. The mode traces every attempt, so scope it to the project you’re investigating — tracing every retry tripled one team’s artifact bill. And a test that passes on retry is usually a race condition — the retry isn’t the fix, but now it’s evidence.

Next step: find the test marked “flaky” in your last CI run, set trace: 'retain-on-failure-and-retries' on its project only, and re-run until it flips. Diff the pair at the first action where the timelines disagree. That’s your bug — no local reproduction required.

§ Frequently Asked FAQ
+ Doesn't retain-on-failure already cover flaky tests?

No — the passing retry’s trace is discarded. retain-on-failure-and-retries (Playwright 1.59+) keeps every attempt, so you get the pass/fail pair.

+ Can Playwright's trace viewer open two traces at once?

No — one trace per show-trace window. Run it twice, or open each attempt from the HTML report’s retry tabs.

§ Further Reading 03 of 03
01CI/CD

Playwright's New CLI Debugger Finally Works in Headless CI

Playwright 1.59 ships --debug=cli and scriptable trace analysis. The first debug surface that actually works where enterprise tests fail — headless CI.

Read →
02CI/CD

Our AI E2E Suite Cost $400 a Day in CI

Our LLM E2E test CI cost hit $403 a day because tokens grow quadratically with every agent step. Here's where the money went, and the fix that finally worked.

Read →
03CI/CD

Stop Emailing Test Reports — Host Allure on Jenkins

Replace emailed Extent Report HTML files with a persistent Allure portal on Jenkins, so the team gets one URL, full history, and zero downloads to manage.

Read →

Don't miss a thing

Subscribe to get updates straight to your inbox.

HT

No spam · Unsubscribe anytime

Welcome aboard!

You're on the list. Expect real-world QA insights — no fluff, no spam.

§ Colophon

Halmurat T. — Senior SDET writing about test automation, CI/CD, and QA strategy from 10+ years in the enterprise trenches.

Set in
IBM Plex Sans, Lora, and IBM Plex Mono.
Built with
Astro, MDX, Tailwind CSS & Expressive Code. Served by Vercel.
Privacy
No cookies. No tracking scripts on the main thread — analytics run sandboxed via Partytown.
Source
github.com/Halmurat-Uyghur
Terminal
Try /ask to query Halmurat's notes in a shell prompt.

© 2026 Halmurat T. · Written in plain text, shipped in plain time.

Search
Esc

Search is not available in dev mode.

Run npm run build then npm run preview:local to test search locally.