In Playwright Test is there an easy way to loop the test multiple times to check for flakiness?

I've found it to be a good practice to run new automated tests or edits to existing tests a few times on a pull request to check for flakiness prior to merging the new code into the main branch of the test suite. To do this you can build out your CI pipeline to run the command npx playwright test --repeat-each=5. The docs for running via command line can be found here.

You could take this a step further and do a git comparison to see what directories have changed and also pass in directories to the commands as well. This command will run all tests within the todo-page and landing-page directories.  npx playwright test tests/todo-page/ tests/landing-page/ --repeat-each=5