Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsTo retry failed visual regression tests in Playwright Test, set a retry count in playwright.config.ts or pass --retries=N to the test command. Retries are additional attempts after the initial run. A test that fails and then passes is reported as flaky, not as a clean, stable pass—use that result to investigate instability rather than to approve a visual change.
Configure retries in Playwright Test
Playwright Test does not retry failed tests by default. Add a retry count to the project configuration:
As an Amazon Associate I earn from qualifying purchases.
import { defineConfig } from '@playwright/test';
export default defineConfig({
retries: 2,
});
Here, retries: 2 means the initial attempt plus up to two retries. You can set retries for a particular run from the command line instead:
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →npx playwright test --retries=2
Use the Playwright Test retry documentation to confirm the configuration supported by the version installed in your project. The option set can change across versions.
#1 Best Overall
Understand what a retry result means
Playwright classifies a test that fails on its first attempt and passes on a retry as flaky. A test that fails on the initial attempt and every retry remains failed. After a test failure, Playwright discards that worker process and starts a replacement; configured retries run in the replacement worker.
A retry can help a run continue despite a transient failure, but it does not show that the test or application is reliable. Track flaky outcomes and investigate their causes. If your CI policy should reject any run containing a flaky test, Playwright provides failOnFlakyTests and a corresponding CLI option; check the documentation for the version in use before enabling it. See Playwright’s retry and flaky-test guidance.
Choose how retries are scheduled
In versions that support retryStrategy, Playwright documents two choices. Verify availability in your installed version before adding this option.
Rank #2
| Strategy | How it runs | Trade-off |
|---|---|---|
immediate |
A failed test is retried as soon as a worker is available; retries can interleave with the rest of the run. | Provides a retry sooner, but concurrent test activity may contribute to interference. |
isolated |
Retries run at the end of the test run, one by one in a single worker. | Reduces interference from other running tests, but can increase total run time. |
These scheduling options are documented by Playwright. The right retry count and strategy depend on your suite and CI environment; the documentation does not prescribe a universally correct count.
Make visual comparisons reproducible
Retries are not a substitute for controlling screenshot inputs. Keep the operating system and browser versions consistent between baseline creation and test runs so that comparisons are made under reproducible conditions. Before treating a mismatch as flakiness, determine whether the expected UI or its approved baseline has intentionally changed.
For CI runs where stability and reproducibility take priority, Playwright recommends using one worker. Parallel workers or sharding can be appropriate when your CI infrastructure supports them, but they can also change execution conditions and resource contention. Select the approach that fits the environment in which the screenshots are captured. See Playwright’s CI guidance.
Keep evidence and make flaky results visible
Configure traces on the first retry so you can inspect what happened during a failed attempt. A trace can help distinguish an intermittent page or interaction problem from a mismatch caused by the screenshot environment. Playwright documents this approach in its retry guidance.
Choose an explicit CI policy: report flaky tests for follow-up, or fail the run when any test is flaky. The latter prevents retries from turning intermittent failures into an apparently healthy CI result. Retain the failure evidence your team needs to investigate, and avoid increasing retries simply to make a run appear green.
Separate test retries from visual-change approval
Playwright Test retries rerun a failed test. They do not approve a screenshot change or update a visual baseline. Visual-testing services may capture and compare snapshots and provide their own baseline review workflow; those are separate responsibilities.
Rank #4
For example, Chromatic documents a Playwright integration that captures page archives, uploads them to its cloud, and performs snapshot comparison. Its documentation also describes baseline review and CI checks. That comparison workflow is not the same thing as Playwright Test’s retry mechanism. See Chromatic’s Playwright integration documentation and Chromatic’s visual testing documentation.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup
If you need a screenshot rather than a Playwright-driven test run, ScreenshotNeo is a website screenshot API and MCP server. A single GET request returns an image or PDF, and its capture flow can accept cookie or consent banners and remove supported consent platforms, newsletter popups, and chat widgets before the shot.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →For an API call, create a ScreenshotNeo account and use your API key. This cURL example saves a WebP screenshot of Stripe:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for parameters and response details. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed; response headers identify the page verdict and billing status. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.
Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month with no card.
Frequently Asked Questions
Does Playwright retry a failed test automatically by default?
No. Retries are disabled unless you configure them or pass the --retries command-line option.
Recommended Free Tools
Does a passing retry mean the visual test is stable?
No. Playwright reports a test that failed and later passed as flaky; the initial failure remains a signal to investigate.
Quick Recap
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.




