Re-run Only Failed Tests

A guide on rerunning only failed Playwright tests in CI

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

playwright test --last-failed

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

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.

GitHub Actions
GitLab CI
Jenkins Pipeline

Re-run Failed Playwright Tests: Currents Orchestration

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

GitHub Actions
GitLab CI
Jenkins Pipeline

Last updated

Was this helpful?