We run Playwright end-to-end tests across several machines on CircleCI. Two features both matter to us, and today we have to pick one:
  • "Rerun failed tests": rerunning only the failed tests instead of the whole job. This saves time and credits when a single test fails.
  • Playwright's own --shard option: splitting tests across machines with Playwright itself. This is Playwright's recommended CircleCI setup. It keeps our CI config close to the commands developers run locally. It also splits the same way every run, so a developer can reproduce exactly what one CI machine ran with npx playwright test --shard=N/M.
Rerun from failed only works when CircleCI does the splitting (circleci tests run or circleci testsuite run). Earlier this year we switched from --shard to CircleCI's splitting to get the rerun button, and gave up the benefits above to do it.
What we'd like is a supported way to rerun only the failed tests when the job uses Playwright's --shard. For example:
  • CircleCI could pass the failed tests from the JUnit results to Playwright for the rerun.
  • Or a rerun could use Playwright's --last-failed option.
Either way, the rerun would cover only those tests, while normal runs keep using Playwright's sharding.