My workflow to ensure any new Playwright Test test I write is deterministic and repeatable:
- Mark the new test as
.onlytemporarily locally during development
npx playwright test --repeat-each 100where 100 is the number of times you want to run it in parallel locally
- Make sure it passes 100% of the times
Here’s an example of how it looks (using 10 times for conciseness):
Playwright Test results showing consistent test runs
I’ve used this to discover a test failed about 5% of the times I ran it which was one of the only Playwright tests I’ve written so far that needed an explicit wait for element.