Skip to content
Debug failures

Debugging basics

From a red run to the cause - the failing attempt, its error, screenshot, trace and console, and the test's history.

Open the run, then its Tests tab: failed tests are marked, and the status filter shows only them. A test’s row opens the test’s page in that run.

If Playwright retried the test, an attempt switcher sits at the top: Attempt 1, then Retry 1, Retry 2. The page opens on the last failed attempt; the header shows how the last attempt ended. For a flaky test, Attempt 1 is the failure and the last retry the pass.

Each attempt shows what it has, in this order:

  • Error - message and stack, with an assertion split into Expected and Received. Whether it is the same error as the test’s previous failure, and when the test last passed, is in the line under the page’s title.
  • Screenshot - the page at the failure.
  • Browser console - what the page logged.
  • Test output - what your test process printed (stdout and stderr), cut at 16 KB.
  • Trace - Open in Trace Viewer opens it in Playwright’s own viewer, trace.playwright.dev, through a link that expires after ten minutes.

Long console and output blocks show their first 20 lines; the rest is a click away.

Evidence In playwright.config.ts Reporter
Screenshot use: { screenshot: "only-on-failure" } 0.7.0 or newer
Trace use: { trace: "retain-on-failure" } (or "on-first-retry") 0.7.0 or newer
Browser console a trace - it is read out of it 0.8.0 or newer
Error, test output nothing every version

The reporter uploads screenshots, traces and the browser console only for attempts that failed or were retries - never for a test that passed on its first try. When a file is missing, the page says why: no trace was recorded, the file was over its size limit (50 MB for a screenshot or trace, 4 MB for the browser console), one shard sent more than 250 files with a reporter before 0.18.0 (the first 250 are kept), the organization’s storage was full, or it expired - files are kept 7 days for passes and 21 days for failures.

  • The History column of the test in a run shows up to 10 runs that contain the test, on every branch: this run, the runs before it and up to 4 after it, each with its result - enough to see whether it broke here or has been failing for a while. On a narrow screen it is a row of 7 runs, with up to 2 after this one.
  • The test’s own page - from the Test explorer - covers every run in the period: stability, flaky rate and failure rate, the median duration, a Runs per day chart, every run with its result, and the errors the test failed with.

Next: Fix in your agent hands the same evidence to your coding agent.