Orchestration Setup
Playwright Orchestration setup instructions
Orchestration helps decrease the duration of Playwright tests in CI pipelines. Read our detailed guide on Playwright Parallelization that compares the native sharding with orchestration.
How does it work
@currents/playwright
contains a command-line executable pwc-p
— a lightweight wrapper that implements Orchestration and runs Playwright behind the scenes.
it scans the testing suite
it establishes an orchestration session with Currents servers
it runs Playwright, executing spec files in the optimal order
the results are recorded to Currents for troubleshooting and analysis
Setup
Install @currents/playwright
Replace playwright
command with pwc-p
Read more about CI Build ID and Reporting Strategy
pwc-p
accepts additional playwright arguments and flags (see @currents/playwright), for example:
There's no need to define shards,
Make sure to remove --shard
flag — Currents uses all the available machines automatically.
A successfully created orchestration prints an output similar to this:
Examples
Check out the following example configuration of running orchestration in popular CI providers:
Orchestration and Reporters
Adding Additional Reporters
pwc-p
automatically injects Currents reporter @currents/playwright into playwright, replacing all other reporters configured in playwright.config.ts
. To add additional reporters use one of the two options
Add additional reporters via a CLI parameter.
Prevent automatic injection of Currents reporter, add it manually.
Create
currents.config.ts
with the following contents:
Update
playwright.config.ts
Optional: Update
pwc-p
CLI command
pwc-p
reads all the configuration from currents.config.ts
- no need to use CLI params.
Merging Fragmented Reports
Orchestration dynamically pulls test files from a central server, and each pull starts a fresh Playwright process. This can impact reporters that write output files—since a new process runs for each pull, you may need to handle file overwrites and merge results correctly.
The solution is to use the blob
reporter to gather all the fragmented results and merge them.
You can generate other reports by passing the blob results to the merge-reports
command.
Orchestration and Multiple Workers
@currents/playwright#13.0.0+
supports automatic detection of multiple workers and the orchestration adjusts to make the best use of the available workers.
When multiple workers are enabled, the orchestrator creates a "batch" of multiple test files to ensure the most optimal utilization of all the available workers. The batch runs as single playwright command.
Also see Fully Parallel Mode.
Re-running Only Failed Tests
Re-running only failed tests for orchestrated runs requires collecting the results from multiple machines, or alternatively getting the failed test from Currents API. We have created a set of tools to simplify the setup. See Re-run Only Failed Tests.
Limitations and Nuances
Orchestration works on a file level - i.e. it balances test files (rather than tests)
Next Steps
Use Cloud Spot Instances to reduce your CI bills by 90%
Explore how to Re-run Only Failed Tests
Last updated
Was this helpful?