Re-run Only Failed Tests

A guide on rerunning only failed Playwright tests in CI

Starting from version 1.44arrow-up-right Playwright supports running only the failed test from the last runarrow-up-right using --last-failed CLI flag. For example:

playwright test --last-failed
circle-info

@playwright/[email protected]+ has an improved support of --last-failed on CI, we recommend upgrading the package version accordingly.

Rerunning Failed Only Playwright Tests

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.

circle-exclamation

Re-run Only Failed Tests: Playwright Shards

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.

chevron-rightGitHub Actionshashtag

See our step-by-step guide Re-run Only Failed Tests

chevron-rightGitLab CIhashtag
chevron-rightJenkins Pipelinehashtag

See our step-by-step guide to Setting up retries of failed job with Jenkins Pipeline

Re-run Failed Playwright Tests: Currents Orchestration

circle-info

When rerunning failed orchestrated runs, select "Rerun All Jobs" instead of "Rerun Failed Only"

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).

Rerunning Failed Only Playwright Tests using Currents Orchestration

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

chevron-rightGitHub Actionshashtag

See our step-by-step guide Re-run Only Failed Tests

chevron-rightGitLab CIhashtag

See our step-by-step guide Re-run Only Failed Tests

chevron-rightJenkins Pipelinehashtag

Last updated

Was this helpful?