Swarm mode requires
@testdino/playwright 2.10.0 or later. Earlier versions exit with error: unknown command 'swarm'.Swarm mode is available on the Team and Enterprise plans. On other plans, starting a swarm exits with
Swarm is available on the Team and Enterprise plans. Upgrade the plan to run a swarm.Quick Reference
Pick swarm mode or a fixed partition
All 3 spread one test run across parallel CI jobs. They differ in when the partition is decided.
Sharding and split mode fix each machine’s workload before the first test case runs, so one slow machine holds the whole test run open. Swarm mode hands out the next spec file when a machine frees up, so a slow machine ends up with less to do.
The unit of distribution is 1 spec file per Playwright project. A test suite whose runtime sits in a single long spec file gains little from swarm mode: that file always runs whole on 1 machine.
Swarm mode does not combine with sharding or split mode.
Start a swarm and join it
Swarm mode is 1 command in 2 modes.--machines starts a swarm and prints its ID. --id joins one.
Start the swarm once per pipeline, before the matrix fans out:
--out writes the started swarm as JSON with a swarmId key, which the matrix legs read. Set workers to a whole number in your Playwright config so TestDino can balance the test suite.
Then on every machine, pass the same ID:
--machines and --id is an error, and so is passing neither.
Configure a CI matrix
The start step runs once and publishes the swarm ID. Each matrix leg joins with that ID and its own machine ID.fail-fast: false so a leg that fails, for example during npm ci, does not cancel the others.
A machine that never connects leaves its work to the others.
Set a stable machine ID
The machine ID is what attributes a test case to a machine in the dashboard. It must stay the same for the life of the process. TestDino resolves it from the first source that is set:
GitHub Actions publishes no matrix index, so its legs fall through to hostname and process ID unless you set
TESTDINO_MACHINE_ID. Set it: hostname and process ID change when a runner restarts, and the Machines panel then reports 1 machine as 2.
A short ID such as m1 displays as Machine 1. Other IDs, such as runner-1, display as written.
CLI flags
Swarm mode is its own command. Learn about the flags ontdpw test in the Node.js CLI reference.
Scope a swarm with
--grep and --project when you start it.
After -- on the joining machines, pass only run options such as --workers or --retries. A --grep, --project, --shard, or spec path there changes what every machine runs.
A machine that loses its connection reconnects on its own.
Watch a swarm while it runs
An in-progress swarm appears under Active Test Runs with a SWARM label. Expand the row for 1 tab per machine.
The number on a machine tab is finished work, not a share of the test suite.
Read the Machines panel
A swarm run carries a SWARM badge in the Test Runs list. Its Summary tab shows a Machines section, titled with the machine count.
The
Imbalance badge tooltip can name the cause. When the slowest machine ran a single spec file, splitting that file is the only way the run gets faster; adding machines does not help. When it ran several spec files, the work was packed unevenly.
Filter by machine
Machine is a filter on the Summary tab and accepts multiple values.
The filter is saved in the page URL, so a filtered view is shareable.
When a spec runs nowhere
When a machine drops mid-run, another machine picks up its unfinished spec files. When no machine can run a spec file, the test run finalizes as Incomplete. The Machines panel lists those files underNo machine could run.
An incomplete test run is a coverage gap, not a failure: those test cases produced no result at all. Treat it as a red run.
Troubleshooting
Nothing to do: pass --machines <N> to start a swarm, or --id <swarmId> to join one.
Nothing to do: pass --machines <N> to start a swarm, or --id <swarmId> to join one.
The command ran with neither flag.
--machines starts a swarm, --id joins one. A joining step that reads its ID from a previous job usually hits this when that job failed and the output is empty.Pass either --machines (start a swarm) or --id (join one), not both.
Pass either --machines (start a swarm) or --id (join one), not both.
A joining step still carries the starting step’s
--machines, or TESTDINO_MACHINES is set for the whole workflow. Remove both from the matrix legs.--id needs the swarm id to join.
--id needs the swarm id to join.
--id was passed with an empty value, which almost always means the CI expression that supplies it resolved to nothing. Check the output name on the start job.Unexpected argument
Unexpected argument
A spec path or other value was passed before
--. Scope the test suite with --grep or --project when you start the swarm, and put Playwright arguments after -- when you join.workers not set to a positive integer in the Playwright config
workers not set to a positive integer in the Playwright config
The swarm still runs, but each machine gets 1 spec file at a time, so it takes longer. Set
workers in your Playwright config to a whole number, not a percentage, so TestDino can balance the test suite.The CI job passed but test cases failed
The CI job passed but test cases failed
tdpw swarm exits 0 when the swarm ends, whatever the test results. Read the result from the test run in TestDino.The Machines panel shows more machines than the matrix has legs
The Machines panel shows more machines than the matrix has legs
A machine ID changed mid-run, so TestDino counted 1 machine as 2. Set
TESTDINO_MACHINE_ID to a value fixed by the matrix leg rather than letting it fall through to hostname and process ID.The test run finalized as incomplete
The test run finalized as incomplete
At least 1 spec file could not run on any machine. The Machines panel names them. Run those specs locally: a spec that fails to load, rather than fails a test case, is the usual cause.
Related
Node.js CLI reference
Every flag, environment variable, and config field on
tdpw.Split mode
Merge jobs you partition by hand into one test run.
Test runs
Read the run detail, including the Machines breakdown.
CI optimization
Find the slow test cases worth distributing in the first place.