Trigger a run
--wait, the command exits 0 as soon as the backend accepts the run and prints a runId:
Wait for the verdict
--wait blocks until the run reaches a terminal status. --timeout <seconds> sets how long the CLI polls (1–3600, default 600; 1200 through a tunnel):
On exit 7 the CLI still prints a partial object to stdout, usually
{ "runId": "...", "status": "running" }, so a script can recover the ID. This is a fallback, not a fresh server observation.
Resuming a run
test wait takes the same --timeout and returns the same exit codes. At a terminal status it prints the run card:
dashboard: line (dashboardUrl in JSON, absent under --dry-run) opens the Portal run view with steps, video, and analysis.
Ctrl-C and timeout
Ctrl-C during--wait detaches the CLI. The run keeps executing and billing on the server (exit 130); stop it with testsprite test cancel <run-id>. A self-minted --local run is the exception: it requests cancellation by default and closes its tunnel. Details, refunds, and --no-cancel-on-interrupt are in Cancelling a Run.
Running against another environment
Each run targets one project environment. Omit--env for Default, or name an existing one:
Run against a URL without creating an environment
--target-url runs a frontend test against a URL, such as a pull-request preview:
- Sign-in. Without
--env, the run signs in with the Default environment’s test account. With--env <name>, that environment’s settings are used against the URL. - Where it works.
test run(including--all --project <id>),test create --run, andtest create-batch --run. Nottest rerunortestlist run. - Reachability. A loopback URL such as
http://localhost:3000opens a tunnel automatically. Other private addresses are refused (exit5). A reachability probe runs from your machine first (exit5if clearly unreachable);--skip-preflightskips it.--target-urlcannot be combined with--local. - Status. A
--target-urlrun is recorded under its temporary environment and does not change the status shown bytest list/test get(see Reading Results).
Testing a locally running app
When a run resolves to a loopback environment URL, the CLI opens a tunnel for you; nothing is deployed or made public. You need the app running and a key with therun:tunnel scope (existing keys already have it; see Scopes).
test run (one, several, or --all), test rerun, test create --run, test create-batch --run, and testlist run. --local is accepted only by test run; it implies --wait. --no-wait is refused before dispatch, without charge (tunnel-required, exit 6).
- Frontend tests only. Backend local runs are rejected.
--localwith--env.--env staging --local 5173runs against your local app and signs in withstaging’s settings. A port matching no saved environment runs in a temporary environment that copies the Default sign-in.- Several tests. Pass several IDs or
--all --project <id>to share one tunnel.
Running a whole suite
--project or set TESTSPRITE_PROJECT_ID. Every test runs (each billed like any run) in dependency waves from --produces / --needs annotations: producers first, teardown last. See Creating Tests.
A project holds one type of test, frontend or backend. If a batch is served by the legacy backend-only engine, frontend tests come back in
skippedFrontend with an advisory; run those individually.
Exit codes
Exit6 means a run is already in flight (wait for it) or a tunnel precondition failed (check the error reason). All codes: Exit Codes.
Where to Go Next
Reading Results
Inspect steps, pull failure bundles, and navigate run history
Rerun & Auto-Heal
Re-run a saved test, or let AI repair UI drift automatically
Exit Codes
Complete exit-code reference for scripts and CI pipelines
CI/CD Integration
Wire the CLI into GitHub Actions or any pipeline