Re-run Only Failed Tests
A guide on rerunning only failed Playwright tests in CI
Last updated
Was this helpful?
A guide on rerunning only failed Playwright tests in CI
Last updated
Was this helpful?
Starting from version 1.44 Playwright supports running only the failed test from the last run using --last-failed
CLI flag. For example:
While this feature works well for local environments, using it in CI with Playwright shards or Currents Orchestration is not straightforward.
We have created a set of tools that simplify rerunning only the failed Playwright tests in CI, including sharded parallel CI runs and runs created by Currents Orchestration.
Tests that randomly fail and then pass without any change are considered flaky (see Flaky Tests). Even if tests pass after a rerun, it is recommended to explore the failures and eliminate the flakiness.
The suggested templates do not require maintaining complex CI configurations and scripts - they are compatible with popular CI providers and can be used even without Currents reporter.
Orchestrated runs are conceptually different from the native playwright sharding. Currents assigns the tests dynamically to all the available machines - i.e. the more machines are available, the better (also, there's no need to provide the overall number of CI machines in advance).
That's why when rerunning failed orchestrated CI runs, you'd select "Rerun All Jobs" instead of "Rerun Failed Only":
The CI provider will spin up all the containers
Currents will dynamically assign the failed tests to all the available containers
More available containers will run the tests in parallel faster
See our step-by-step guide
See our step-by-step guide to
See our step-by-step guide to
See our step-by-step guide
See our step-by-step guide to
See our step-by-step guide to