Example: Your test suite has 500 E2E tests. A full run takes one hour. If 50 tests fail and take about 6 minutes to run, re-running the entire suite means executing 450 passing tests again. With this approach, only the 50 failed tests are re-run. That saves about 54 minutes per re-run.
- Sharded Playwright execution
- Re-run failed jobs in GitHub Actions
- Failed-tests-only re-runs when failure metadata exists
- Full-suite fallback when no test metadata exists
Quick Reference
| Task | Command/Action | Link |
|---|---|---|
| Run full test suite | npx playwright test | - |
| Cache failed test metadata | npx tdpw cache | Setting up cache |
| Get last failed tests | npx tdpw last-failed | How it works |
| Re-run detection | Check github.run_attempt | Workflow logic |
| Upload HTML report | actions/upload-artifact@v4 | Quick start |
How it works
This workflow uses two TestDino CLI commands:npx tdpw cachestores failed test metadata after a runnpx tdpw last-failedreturns Playwright arguments for the last failed tests
github.run_attempt:
| Condition | Behavior |
|---|---|
run_attempt = 1 | Run full test suite |
run_attempt > 1, flags found | Run failed tests only |
run_attempt > 1, no flags | Run full test suite (fallback) |
Playwright compatibility: Since
@playwright/[email protected]+, Playwright has native --last-failed support. TestDino extends this with cross-runner caching, shard awareness, and workflow-level persistence.Quick start
Add this logic to your Playwright step:cache step runs with the if: always() condition, so failures are recorded even when tests fail.
How to re-run failed tests in GitHub Actions?
1
Open the failed job
In the GitHub Actions run, find the failed job for Playwright:
- Go to your GitHub repository’s Actions tab.
- Select the failed workflow run.
- Under Jobs, open the job where Playwright tests get executed & fail.
This is the main job that executes Playwright and sharding.

2
Check the run attempt
Inside the job, open the Playwright execution step. In the logs, you can see:
-
GitHub run attempt: <number> -
Re-run detection output
3
Identify the failed tests
Scroll to the end of the Playwright output. GitHub Actions show:
- Total failed test count
-
Failed test titles
4
Confirm caching
Open the Cache failed test metadata step. Look for:This confirms TestDino stored the failure metadata.

5
Confirm Re-run
Re-run the failed pipeline and confirm the execution of only the last failed tests.
-
The workflow detects
run_attempt > 1 -
tdpw last-failedretrieves the failed tests -
Only those tests are executed
Example: Sharded test execution
Example: Sharded test execution
First run: 12 tests across 3 shards. Two shards fail.
Re-run comparison:Re-runs all tests in failed shards, including tests that already passed.
| Shard | Tests | Result |
|---|---|---|
| Shard 1 | 4 tests | 2 Passed, 2 Failed |
| Shard 2 | 4 tests | Passed |
| Shard 3 | 4 tests | 3 Passed, 1 Failed |
- Without TestDino
- With TestDino
Full workflow
For a complete workflow with sharding and report merging, see the example repository.View full workflow YAML
View full workflow YAML
File name:
.github/workflows/playwright.ymlRepository: github.com/testdino-hq/playwright-sample-tests-javascriptHow the workflow logic works
The workflow uses a conditional check based ongithub.run_attempt:
- On the first attempt (
run_attempt == 1), the full shard is executed. - On subsequent attempts, the workflow attempts to re-run only previously failed tests.
What `last-failed` returns
What `last-failed` returns
The These flags can be passed directly to
tdpw last-failed command outputs test filters formatted for Playwright:npx playwright test.Why `eval` is used
Why `eval` is used
The command uses This keeps the
eval to handle quoted arguments in the test filter:-g "pattern" quoting intact when passed to Playwright.Edge cases
Pipeline fails before tests run
Pipeline fails before tests run
If a job fails during dependency installation or setup, no test metadata exists.On re-run:And then, it will run the normal execution:
tdpw last-failedreturns nothing- The workflow detects the empty result
- The job runs the full shard
Skipped tests due to `--max-failures`
Skipped tests due to `--max-failures`
Playwright’s Playwright stops after 2 failures. Tests that did not run are not recorded.On re-run, only the failed tests execute. Skipped tests are not included as of now.
--max-failures option stops test execution after N failures. For example: