Free tools Windows power users keep installed
One-click scans. No signup required.
Playwright Test lets you set a retry budget—the maximum number of additional attempts after a test fails—but a later passing attempt does not erase the original failure. To understand what happened, preserve evidence for each attempt and report both the final classification and the initial error. Playwright provides retries, test metadata, artifacts, and reporter hooks; a “failure receipt” is a useful reporting pattern, not a built-in Playwright feature.
What a Playwright retry budget means
Retries are attempts made after the initial run. Playwright Test defaults to zero retries; setting retries configures the maximum number of additional attempts. For example, retries: 2 permits one initial attempt plus up to two retries. You can configure retries in the Playwright config or scope them to a describe group or file. See the official retry documentation and TestConfig API.
As an Amazon Associate I earn from qualifying purchases.
import { defineConfig } from '@playwright/test';
export default defineConfig({
retries: 2,
});
A budget is a ceiling, not a target: tests that pass do not consume retries. A higher value may help expose intermittent behavior, but it also allows a failing test to take more attempts before the run finishes. Choose a limit that suits your CI time budget and the value of collecting another diagnostic attempt; do not treat retries as a fix for the underlying failure.
Recommended Free Tools
How Playwright classifies the result
Playwright reports tests as passed, flaky, or failed. A test that passes on its first attempt is passed. A test that fails and then passes on a retry is flaky. A test that continues to fail through its available retries is failed. The retry outcome is useful information, but a flaky result still means the initial attempt failed and should remain visible in diagnostics. The classification rules are described in the Playwright retry documentation.
How to identify and preserve each attempt
Use the retry index
testInfo.retry is 0 for the initial attempt and increases for each subsequent retry. Use it to label attempt-specific setup or evidence. It does not by itself capture or retain artifacts. TestInfo also exposes status information and methods for adding attachments.
test('loads the account page', async ({ page }, testInfo) => {
console.log(`Attempt ${testInfo.retry}`);
// Test steps...
});
Account for worker restarts
When a test fails, Playwright Test discards the worker process and browser, then starts a new worker for a retry. A retry can therefore run with a fresh worker and browser context. That does not necessarily reset external state: a test account, remote service, or other shared resource may still need explicit cleanup or retry-safe setup. Use testInfo.retry when a setup action genuinely needs to vary by attempt, without suppressing or converting the initial failure.
Choose artifact modes to match the evidence you need
Trace, screenshot, and video capture are configured separately. Trace modes include off, on, retain-on-failure, retain-on-first-failure, retain-on-failure-and-retries, on-first-retry, and on-all-retries. Screenshot settings can be off, always on, or failure-only; video has its own capture and retention settings. Consult the current configuration options and Trace Viewer guide, and check that the options are supported by the Playwright version installed in your project.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorson-first-retry is useful when the goal is to inspect a retry, but it does not record the original failed attempt. If retries are disabled, a retry-only trace mode will not produce a trace. When the original failure matters, choose a mode that captures and retains evidence for the first failed run, or make the missing evidence explicit in the report. Do not claim that every attempt has a trace unless the configured mode actually records it and the file survives retention.
Choose capture settings by weighing four factors:
- Which attempts must be recorded: the initial run, retries, or both.
- Which recorded files will be retained after the run.
- The storage and runtime overhead of capturing artifacts.
- Whether the investigation needs the original failure, later retry behavior, or both.
Trace Viewer provides a GUI for examining recorded traces and replaying the action context. A trace is useful only if it was captured and retained for the attempt in question.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.What to put in a failure receipt
Playwright does not define a built-in object called a failure receipt. Treat it as a small per-attempt reporting record assembled from test results, TestInfo, and artifact references. A custom reporter can process test lifecycle events; for example, its onTestEnd hook can centralize reporting. The Reporter API and TestInfo API document the supported surfaces.
Rank #4
A practical receipt should retain:
- Stable test identity, plus project and environment context.
- Attempt number from
testInfo.retry, attempt outcome or status, and elapsed time where available. - The error or assertion message and relevant test or worker output.
- Filenames or links to screenshots, videos, and traces that were actually retained for that attempt.
- The final test classification—passed, flaky, or failed—without dropping evidence from an earlier failed attempt.
Keep artifact references attached to the attempt that produced them. If a retry passes after the initial failure, the final result can say “flaky” while the receipt still points to the initial error and its retained artifacts. A reporter should not imply that an artifact exists when the selected capture or retention mode did not produce it.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Quick Recap
Best Value
How to choose a retry and evidence policy
- Set a bounded retry count. Configure
retriesat the broadest scope that fits the suite, then narrow it only where particular tests need a different policy. - Decide which attempt matters diagnostically. If the original failure is the key signal, configure capture and retention for that failed run. If you also need to see how a retry behaves, select a mode that records retries too.
- Record attempt identity and outcome. Use
testInfo.retryand supported test result data so that initial and later attempts cannot be confused. - Report the final classification alongside attempt evidence. A retry pass should be reported as flaky, not as an unqualified clean pass that hides the failed attempt.
- Verify files and version support. Confirm that the configured mode is supported by the installed Playwright version and that the output pipeline retains and links the artifacts your receipt names.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




