← Back to microsoft/playwright
microsoft / playwright · Issue No. 41355
test('should repeat 20 times', {
repeat: 20,
}, async ({ page }) => {
// ...
});
The test would execute 20 consecutive times regardless of pass/fail status.
--retries
--repeat-each
This proposal provides a targeted, per-test alternative.
--repeat-each=20 with test.only() Doesn't Satisfy This NeedAs noted in @dgozman's comment, combining --repeat-each with test.only() is not equivalent — test.only() skips all other tests, meaning it cannot run alongside the full suite in a normal run.
The repeat option would enable environment-driven control. For example, with repeat: process.env.REPEAT:
REPEAT=1 (standard single execution alongside the full suite)REPEAT=10 (repeated validation for targeted tests only, while the rest of the suite still runs normally)This makes the feature composable with existing CI workflows without disrupting the broader test suite.
test('should repeat 20 times', {
repeat: 20,
}, async ({ page }) => {
// ...
});
Playwright currently provides:
--retries=N to rerun failed tests--repeat-each=N to rerun every test multiple timesHowever, there is no built-in mechanism to repeatedly execute only a subset of tests.
This becomes useful when investigating flaky tests or validating the stability of a newly added test. In these scenarios, running the entire suite repeatedly is expensive and time-consuming, while --retries only triggers after a failure occurs.
Relay reads this issue against the repository's contribution signals: the files it is likely to touch, how the maintainers triage work this size, and what the first contribution would exercise.
The full analysis for this issue is still being assembled. Until then, the description above and the thread on GitHub are the most reliable context.