Playwright - GitHub Actions
Running Playwright tests in Parallel in GitHub Actions using Matrix Workflow
Last updated
Running Playwright tests in Parallel in GitHub Actions using Matrix Workflow
Last updated
Check out the example repository https://github.com/currents-dev/playwright-gh-actions-demo
Set GH secret variableCURRENTS_RECORD_KEY
Currents collects Playwright test results from GitHub Action CI Runners, together with the generated artifacts (trace files, screenshots, videos) for more efficient troubleshooting and providing insights into the test suite performance:
console output
screenshots
videos
traces
GitHub Actions Matrix and Playwright Sharding speed up you CI pipeline by running tests in parallel - playwright support splitting the tests between multiple CI machines using --shard
CLI flag. Playwright Orchestration improves the parallel execution even more by optimally balancing your tests across the available CI machines.
Read our Playwright Parallelization guide to discover more about parallelizing your Playwright test in GitHub Actions.
The example repository showcases running Playwright tests in GitHub Actions. We've included several config files to exemplify the workflows:
test-basic-pwc.yml - run Playwright tests in parallel using 3 shards of GitHub Actions Matrix and pwc
command.
test-basic-reporter.yml - run Playwright tests in parallel run using 3 shards of GitHub Actions Matrix and configuring Currents Reporter in playwright.config.ts
.
test-or8n.yml - run Playwright tests in parallel Playwright using Playwright Orchestration and GitHub Actions Matrix. Currents Orchestration speeds up CI runs by up to 40% (compared to native sharding) by optimally balancing tests between the available machines.
argos-example.yml - run Playwright tests in parallel using Currents Orchestration, use Argos CI for visual testing.
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 configuring Playwright for rerunning only the failed tests. See Re-run Only Failed Tests guide for details.
If you're using Playwright Sharding for running your tests in parallel, use the Currents Playwright Last Failed GitHub Action to store the last run results and simplify re-run workflows.
Example workflows for setting up re-runs for GitHub Actions can be found at:
rerun-shards-pwc.yml - rerun only the tests that failed in the previous run, using pwc
helper command that is included in @currents/playwright
package.
rerun-shards-reporter.yml - rerun only the tests that failed in the previous run, using reporter explicitly configured in playwright.config.ts
Step-by-step guide:
In case you're using Currents Orchestration for running your Playwright tests in parallel the Currents Playwright Last Failed GitHub Action to fetch the results of the last run from API.
Currents Orchestration dynamically assigns tests to all the available CI runners, that's why you should select Re-run all jobs when using Currents Orchestration. Read more at Re-run Only Failed Tests guide.
Example workflows for setting up re-runs for GitHub Actions can be found at:
reruns-or8n.yml - rerun only the tests that failed in the previous orchestrated run
Step-by-step guide: