Skip to content

feat(test-runner): add repeat config in test#41287

Open
vctqs1 wants to merge 5 commits into
microsoft:mainfrom
vctqs1:feat/add-repeat-in-test-detail
Open

feat(test-runner): add repeat config in test#41287
vctqs1 wants to merge 5 commits into
microsoft:mainfrom
vctqs1:feat/add-repeat-in-test-detail

Conversation

@vctqs1

@vctqs1 vctqs1 commented Jun 13, 2026

Copy link
Copy Markdown

Motivation

Playwright currently provides:

  • --retries=N to rerun failed tests
  • --repeat-each=N to rerun every test multiple times

However, 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 can be expensive and time-consuming, while retries only execute after failures occur.

Example

test('should repeat 20 times', {
  repeat: 20,
}, async ({ page }) => {
  // ...
});

The test would execute 20 consecutive times regardless of pass/fail status.

Use Cases

  • Investigating flaky tests.
  • Stress-testing newly added tests.
  • Verifying test stability before enabling CI gates.
  • Reproducing intermittent failures locally.
  • Running targeted stability checks without repeating the entire suite.

Why existing features are insufficient

--retries

  • Only reruns failed tests.
  • Does not help proactively validate stability.

--repeat-each

  • Repeats every test in the suite.
  • Can significantly increase execution time when only a few tests need additional validation.

This proposal provides a targeted alternative focused on individual tests.

@vctqs1

vctqs1 commented Jun 13, 2026

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

// drive letter for a URL scheme ("Received protocol 'c:'").
// The `import` condition is present only for ESM resolution, so use it to pick the form.
specifier = context.conditions?.includes('import') ? url.pathToFileURL(resolved).toString() : resolved;
specifier = context.conditions?.includes?.('import') ? url.pathToFileURL(resolved).toString() : resolved;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant