Skip to main content
Swarm mode spreads one Playwright test suite across N continuous integration (CI) machines while the test run is in progress. Each machine takes the next spec file when it frees up, and TestDino merges every machine’s results into one test run with per-machine results.
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:
Each machine connects, runs the batches of spec files it is handed, and exits when the swarm ends. Every machine reports under the same test run. Passing both --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.
Set 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 on tdpw 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 under No 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

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.
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 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.
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.
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.
tdpw swarm exits 0 when the swarm ends, whatever the test results. Read the result from the test run in TestDino.
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.
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.

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.
Last modified on October 12, 2026