Re-run Only Failed Tests
How to setup failed tests re-run on GitHub Actions
When a workflow fails in GitHub Actions you have the option to re-run the failed jobs. However, an additional setup is required for properly configure Playwright for rerunning only the failed tests.
See Re-run Only Failed Tests guide for more details on re-runs.
For GitHub Actions, we provide the Last Failed GitHub Action to simplify the re-runs.
Playwright Sharding
If you're using Reporting in CI for running your tests in parallel, you can use the Last Failed GitHub Action to include the data from the last run.
Step-by-step guide:
Full examples:
rerun-shards-pwc.yml - rerun only the tests that failed in the previous run, using
pwchelper command that is included in@currents/playwrightpackage.rerun-shards-reporter.yml - rerun only the tests that failed in the previous run, using reporter explicitly configured in
playwright.config.ts
Currents Orchestration
If you're using Currents Orchestration for running your Playwright tests you can also fetch the results of from Runs.
Step-by-step guide:
Example workflow:
reruns-or8n.yml - rerun only the tests that failed in the previous orchestrated run.
Custom CI Build ID for Reruns
The last-failed-action gets the previous run information using the default CI build ID pattern:
${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt }}
If you are using a different CI Build ID, specify the previous-ci-build-id configuration property.

For example:
Last updated
Was this helpful?