@testsprite/testsprite-cli 0.15.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -141
- package/dist/commands/agent.d.ts +12 -4
- package/dist/commands/agent.js +55 -65
- package/dist/commands/auth.d.ts +6 -10
- package/dist/commands/auth.js +44 -56
- package/dist/commands/ci.d.ts +23 -100
- package/dist/commands/ci.js +297 -489
- package/dist/commands/completion.js +2 -1
- package/dist/commands/conversation.d.ts +27 -0
- package/dist/commands/conversation.js +702 -0
- package/dist/commands/doctor.d.ts +5 -1
- package/dist/commands/doctor.js +130 -34
- package/dist/commands/init.d.ts +4 -45
- package/dist/commands/init.js +116 -68
- package/dist/commands/project-env.d.ts +62 -2
- package/dist/commands/project-env.js +426 -53
- package/dist/commands/project-sign-in.d.ts +0 -48
- package/dist/commands/project-sign-in.js +1 -224
- package/dist/commands/project.d.ts +15 -186
- package/dist/commands/project.js +93 -921
- package/dist/commands/result.d.ts +10 -0
- package/dist/commands/result.js +215 -0
- package/dist/commands/schedule.d.ts +0 -29
- package/dist/commands/schedule.js +47 -97
- package/dist/commands/test.d.ts +315 -1824
- package/dist/commands/test.js +1962 -13733
- package/dist/commands/testlist.d.ts +128 -5
- package/dist/commands/testlist.js +269 -329
- package/dist/commands/tunnel.d.ts +2 -2
- package/dist/commands/tunnel.js +43 -41
- package/dist/commands/usage.d.ts +12 -45
- package/dist/commands/usage.js +51 -131
- package/dist/index.js +189 -108
- package/dist/lib/agent-detect.js +9 -5
- package/dist/lib/agent-targets.d.ts +21 -2
- package/dist/lib/agent-targets.js +88 -11
- package/dist/lib/args.d.ts +13 -0
- package/dist/lib/args.js +49 -0
- package/dist/lib/basic-auth.d.ts +3 -0
- package/dist/lib/basic-auth.js +15 -0
- package/dist/lib/billing-refusal.js +4 -3
- package/dist/lib/ci-linkage.d.ts +4 -82
- package/dist/lib/ci-linkage.js +4 -157
- package/dist/lib/ci-run.js +1 -1
- package/dist/lib/client-factory.d.ts +10 -2
- package/dist/lib/client-factory.js +38 -26
- package/dist/lib/commit-signal.d.ts +65 -0
- package/dist/lib/commit-signal.js +305 -0
- package/dist/lib/concurrency-limiter.d.ts +6 -0
- package/dist/lib/concurrency-limiter.js +29 -0
- package/dist/lib/config.js +10 -5
- package/dist/lib/conflict-reason.d.ts +31 -4
- package/dist/lib/conflict-reason.js +38 -4
- package/dist/lib/conversation/answers.d.ts +9 -0
- package/dist/lib/conversation/answers.js +49 -0
- package/dist/lib/conversation/api.d.ts +71 -0
- package/dist/lib/conversation/api.js +150 -0
- package/dist/lib/conversation/change.d.ts +31 -0
- package/dist/lib/conversation/change.js +124 -0
- package/dist/lib/conversation/context.d.ts +19 -0
- package/dist/lib/conversation/context.js +70 -0
- package/dist/lib/conversation/environment.d.ts +15 -0
- package/dist/lib/conversation/environment.js +33 -0
- package/dist/lib/conversation/follow.d.ts +24 -0
- package/dist/lib/conversation/follow.js +42 -0
- package/dist/lib/conversation/render.d.ts +33 -0
- package/dist/lib/conversation/render.js +315 -0
- package/dist/lib/conversation/title.d.ts +2 -0
- package/dist/lib/conversation/title.js +18 -0
- package/dist/lib/conversation/types.d.ts +156 -0
- package/dist/lib/conversation/types.js +6 -0
- package/dist/lib/credentials.js +67 -11
- package/dist/lib/cron.d.ts +1 -1
- package/dist/lib/cron.js +2 -2
- package/dist/lib/dispatch-stop.d.ts +20 -0
- package/dist/lib/dispatch-stop.js +30 -0
- package/dist/lib/download.d.ts +71 -0
- package/dist/lib/download.js +274 -0
- package/dist/lib/dry-run/fetch.d.ts +10 -0
- package/dist/lib/dry-run/fetch.js +20 -0
- package/dist/lib/dry-run/samples.d.ts +6 -34
- package/dist/lib/dry-run/samples.js +389 -751
- package/dist/lib/environment-tunnel.d.ts +16 -26
- package/dist/lib/environment-tunnel.js +161 -157
- package/dist/lib/errors.d.ts +20 -4
- package/dist/lib/errors.js +36 -16
- package/dist/lib/facade.d.ts +7 -29
- package/dist/lib/facade.js +7 -36
- package/dist/lib/failing-fe-resolver.d.ts +13 -58
- package/dist/lib/failing-fe-resolver.js +47 -132
- package/dist/lib/first-suite-hint.d.ts +16 -22
- package/dist/lib/first-suite-hint.js +38 -47
- package/dist/lib/gh-output.d.ts +76 -21
- package/dist/lib/gh-output.js +171 -90
- package/dist/lib/git-utils.d.ts +56 -0
- package/dist/lib/git-utils.js +212 -0
- package/dist/lib/github-context.d.ts +2 -0
- package/dist/lib/github-context.js +40 -8
- package/dist/lib/history-retention.d.ts +6 -2
- package/dist/lib/history-retention.js +10 -7
- package/dist/lib/http.d.ts +58 -134
- package/dist/lib/http.js +352 -271
- package/dist/lib/interrupt.d.ts +14 -8
- package/dist/lib/interrupt.js +28 -10
- package/dist/lib/junit-report.d.ts +60 -4
- package/dist/lib/junit-report.js +209 -32
- package/dist/lib/local-target.d.ts +3 -3
- package/dist/lib/local-target.js +3 -3
- package/dist/lib/output.d.ts +0 -29
- package/dist/lib/output.js +10 -33
- package/dist/lib/pagination.d.ts +2 -5
- package/dist/lib/pagination.js +2 -5
- package/dist/lib/presigned-url.d.ts +22 -0
- package/dist/lib/presigned-url.js +90 -0
- package/dist/lib/prompt.js +36 -2
- package/dist/lib/proxy.js +2 -1
- package/dist/lib/redact.d.ts +2 -2
- package/dist/lib/redact.js +3 -4
- package/dist/lib/removed-commands.d.ts +18 -0
- package/dist/lib/removed-commands.js +154 -0
- package/dist/lib/render-error.d.ts +31 -6
- package/dist/lib/render-error.js +88 -25
- package/dist/lib/response-schemas.d.ts +38 -30
- package/dist/lib/response-schemas.js +210 -207
- package/dist/lib/result/api.d.ts +24 -0
- package/dist/lib/result/api.js +28 -0
- package/dist/lib/result/evidence.d.ts +71 -0
- package/dist/lib/result/evidence.js +420 -0
- package/dist/lib/result/render.d.ts +20 -0
- package/dist/lib/result/render.js +194 -0
- package/dist/lib/result/types.d.ts +122 -0
- package/dist/lib/result/types.js +19 -0
- package/dist/lib/run-output.d.ts +275 -0
- package/dist/lib/run-output.js +227 -0
- package/dist/lib/run-render.d.ts +101 -0
- package/dist/lib/run-render.js +183 -0
- package/dist/lib/run-wait.d.ts +192 -0
- package/dist/lib/run-wait.js +452 -0
- package/dist/lib/runs.types.d.ts +134 -367
- package/dist/lib/runs.types.js +0 -14
- package/dist/lib/secret-file.d.ts +1 -1
- package/dist/lib/secret-file.js +11 -2
- package/dist/lib/skill-nudge.d.ts +7 -27
- package/dist/lib/skill-nudge.js +9 -37
- package/dist/lib/target-path.d.ts +15 -0
- package/dist/lib/target-path.js +35 -0
- package/dist/lib/target-url-advisory.d.ts +19 -0
- package/dist/lib/target-url-advisory.js +31 -0
- package/dist/lib/target-url-preflight.d.ts +9 -0
- package/dist/lib/target-url-preflight.js +214 -106
- package/dist/lib/target-url.d.ts +1 -1
- package/dist/lib/target-url.js +6 -16
- package/dist/lib/telemetry.d.ts +32 -12
- package/dist/lib/telemetry.js +39 -8
- package/dist/lib/terminal-text.d.ts +41 -0
- package/dist/lib/terminal-text.js +127 -0
- package/dist/lib/testlist.types.d.ts +16 -8
- package/dist/lib/testlist.types.js +1 -1
- package/dist/lib/text-equality.d.ts +2 -0
- package/dist/lib/text-equality.js +5 -0
- package/dist/lib/text-file.d.ts +16 -0
- package/dist/lib/text-file.js +41 -0
- package/dist/lib/text-table.d.ts +46 -0
- package/dist/lib/text-table.js +72 -4
- package/dist/lib/ticker.d.ts +9 -2
- package/dist/lib/ticker.js +16 -3
- package/dist/lib/transport-failure.d.ts +22 -0
- package/dist/lib/transport-failure.js +126 -0
- package/dist/lib/tunnel-session.d.ts +7 -1
- package/dist/lib/tunnel-session.js +22 -9
- package/dist/lib/update-check.js +3 -2
- package/dist/lib/url-template.d.ts +43 -0
- package/dist/lib/url-template.js +151 -0
- package/dist/lib/validate.d.ts +0 -64
- package/dist/lib/validate.js +2 -131
- package/dist/lib/version-notice.js +4 -3
- package/dist/lib/wait-exit.d.ts +37 -2
- package/dist/lib/wait-exit.js +88 -30
- package/dist/lib/workspace-status.js +10 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -4
- package/skills/testsprite-ci.skill.md +48 -18
- package/skills/testsprite-onboard.skill.md +66 -151
- package/skills/testsprite-verify.codex.md +54 -56
- package/skills/testsprite-verify.skill.md +194 -358
- package/dist/lib/browser.d.ts +0 -6
- package/dist/lib/browser.js +0 -54
- package/dist/lib/bundle.d.ts +0 -234
- package/dist/lib/bundle.js +0 -781
- package/dist/lib/deprecate.d.ts +0 -10
- package/dist/lib/deprecate.js +0 -13
- package/dist/lib/flaky.d.ts +0 -91
- package/dist/lib/flaky.js +0 -71
- package/dist/lib/plan-poll.d.ts +0 -171
- package/dist/lib/plan-poll.js +0 -441
- package/dist/lib/plans.types.d.ts +0 -130
- package/dist/lib/plans.types.js +0 -31
- package/dist/lib/poll.d.ts +0 -100
- package/dist/lib/poll.js +0 -290
- package/dist/lib/rate-throttle.d.ts +0 -49
- package/dist/lib/rate-throttle.js +0 -75
- package/dist/lib/run-progress.d.ts +0 -41
- package/dist/lib/run-progress.js +0 -56
- package/dist/lib/v3-advisory.d.ts +0 -55
- package/dist/lib/v3-advisory.js +0 -74
- package/schemas/plan.schema.json +0 -61
|
@@ -11,10 +11,10 @@ running the test catches what breaks for a real user.
|
|
|
11
11
|
## When to run
|
|
12
12
|
|
|
13
13
|
Run after a feature or fix lands — one feature → one test run, at the moment it
|
|
14
|
-
lands, not batched at the end.
|
|
15
|
-
project's
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
lands, not batched at the end. You don't write or edit TestSprite tests yourself:
|
|
15
|
+
the project's agent does (`testsprite plan` → `testsprite apply`), and what it
|
|
16
|
+
saves accumulates into the project's suite. Before asking for a new test, check
|
|
17
|
+
`testsprite test list` for an existing one that already covers the behavior.
|
|
18
18
|
|
|
19
19
|
The CLI tests either a **deployed** URL or a frontend test running on this
|
|
20
20
|
machine — it doesn't build or host your environment either way. For a deployed
|
|
@@ -24,14 +24,14 @@ public URL once, then select it with `--env <name>` on runs. Running earlier
|
|
|
24
24
|
verifies the previous build, not your change.
|
|
25
25
|
|
|
26
26
|
For a change that is only running locally, don't wait for a deployment: run
|
|
27
|
-
`testsprite
|
|
27
|
+
`testsprite run <test-id> --local <port>` instead. It tunnels this
|
|
28
28
|
machine's own loopback address (`localhost` / `127.0.0.1` / `::1` — not a LAN
|
|
29
29
|
or RFC1918 address, and not a general local-network escape hatch) to the test
|
|
30
|
-
runner. It is for frontend tests only (a backend test
|
|
31
|
-
|
|
32
|
-
needed.
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
runner. It is for frontend tests only (a backend test reaches its API over HTTP from
|
|
31
|
+
the runner, so run it normally against a deployed environment). Existing API keys work for local runs; no replacement key is
|
|
32
|
+
needed. To use a saved environment's sign-in against the local app, pass
|
|
33
|
+
`--env <name> --local <port>`. Check the name with
|
|
34
|
+
`testsprite project env list <projectId>`.
|
|
35
35
|
|
|
36
36
|
If the user explicitly named a tool (the CLI or the MCP), honor that choice
|
|
37
37
|
regardless of which one the change's reachability would otherwise suggest.
|
|
@@ -55,19 +55,17 @@ Every shipped feature gets **at least one** TestSprite run to a terminal verdict
|
|
|
55
55
|
(`passed` / `failed` / `blocked` / `inconclusive`) before you call it done. What
|
|
56
56
|
counts:
|
|
57
57
|
|
|
58
|
-
- `testsprite
|
|
59
|
-
- `testsprite
|
|
60
|
-
- `testsprite
|
|
61
|
-
|
|
62
|
-
test returning a terminal verdict.
|
|
58
|
+
- `testsprite run --project <projectId> --wait` for the project suite, **or**
|
|
59
|
+
- `testsprite run <id> --wait` against an existing test, **or**
|
|
60
|
+
- `testsprite run <id...> --wait` on the tests `testsprite apply` just
|
|
61
|
+
saved, with at least one returning a terminal verdict.
|
|
63
62
|
|
|
64
|
-
What does **not** count: unit tests / typecheck / lint;
|
|
65
|
-
|
|
63
|
+
What does **not** count: unit tests / typecheck / lint; a plan the agent
|
|
64
|
+
proposed but nobody ran; asking the user to run it for you.
|
|
66
65
|
|
|
67
66
|
If the project has **no tests at all**, that's the `testsprite-onboard` skill's
|
|
68
|
-
job, not this one — seed a suite first
|
|
69
|
-
|
|
70
|
-
local projects require authored plans and `test create --plan-from`). Seeding is a deliberate setup pass, not part of the verify loop.
|
|
67
|
+
job, not this one — seed a suite first with the project's agent (`testsprite plan`
|
|
68
|
+
→ `testsprite apply`). Seeding is a deliberate setup pass, not part of the verify loop.
|
|
71
69
|
|
|
72
70
|
If you can't satisfy this — no creds, no valid target URL, repo not linked —
|
|
73
71
|
**say so explicitly**: "Feature shipped but I could not run any TestSprite test
|
|
@@ -96,22 +94,23 @@ In priority order:
|
|
|
96
94
|
4. Still ambiguous → list the candidates and ask the user which to use (one short
|
|
97
95
|
question; picking the wrong project wastes a run).
|
|
98
96
|
|
|
99
|
-
If no project exists for an app running only locally, bootstrap a frontend project
|
|
100
|
-
|
|
97
|
+
If no project exists for an app running only locally, bootstrap a frontend project,
|
|
98
|
+
ask the agent for tests, and run the ids `apply` saved:
|
|
101
99
|
|
|
102
100
|
```bash
|
|
103
|
-
testsprite project create --type frontend --name "<repo name>"
|
|
104
|
-
testsprite
|
|
105
|
-
testsprite
|
|
101
|
+
testsprite project create --type frontend --name "<repo name>"
|
|
102
|
+
testsprite project env create <projectId> --name local --local <port>
|
|
103
|
+
testsprite plan "<what you built>" --diff --project <projectId> --output json
|
|
104
|
+
testsprite apply --output json
|
|
105
|
+
testsprite run <id> <id> --local <port> --local-host <host> --output json
|
|
106
106
|
```
|
|
107
107
|
|
|
108
108
|
Keep the app listening and use the same `--local-host` for creation and follow-up
|
|
109
109
|
runs. It selects both the probe and stored URL host: `localhost`, `127.0.0.1`
|
|
110
110
|
(default), or `::1`; omit it in both commands to use the default.
|
|
111
111
|
The port probe fails with exit 5 if nothing listens (`--skip-preflight`
|
|
112
|
-
bypasses it).
|
|
113
|
-
|
|
114
|
-
`test run --local`. V2-only local-project creation is unsupported (exit 7).
|
|
112
|
+
bypasses it). The agent's browser can't open an app on this machine, so it works
|
|
113
|
+
from your change (`--diff`) and the project's other environments.
|
|
115
114
|
The Portal shows local environments without a Run action. Create a public
|
|
116
115
|
environment for deployed apps and select it with `--env <name>`.
|
|
117
116
|
|
|
@@ -119,14 +118,13 @@ environment for deployed apps and select it with `--env <name>`.
|
|
|
119
118
|
|
|
120
119
|
Look at the diff (`git diff --stat`, then the changed files) to understand what
|
|
121
120
|
user-facing behavior changed. Pick one sub-mode. For a brand-new feature the
|
|
122
|
-
right default is almost always (b)
|
|
123
|
-
|
|
121
|
+
right default is almost always (b); (a) is for tweaks to behavior an existing
|
|
122
|
+
test already covers; (c) is for a test that is itself wrong.
|
|
124
123
|
|
|
125
124
|
### (a) An existing test covers the change
|
|
126
125
|
|
|
127
126
|
```bash
|
|
128
|
-
testsprite test list --project <projectId> --output json
|
|
129
|
-
testsprite test list --project <projectId> --status failed --output json # what's already red
|
|
127
|
+
testsprite test list --project <projectId> --output json # the cases, as they are written
|
|
130
128
|
```
|
|
131
129
|
|
|
132
130
|
Heuristic: a change to `src/components/CheckoutForm.tsx` is more likely covered
|
|
@@ -135,309 +133,154 @@ backend → `type: backend`.
|
|
|
135
133
|
|
|
136
134
|
### (b) A new test for the change (most common)
|
|
137
135
|
|
|
138
|
-
**
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
"projectId": "prj_abc",
|
|
144
|
-
"type": "frontend",
|
|
145
|
-
"name": "Booking date range change updates the estimated total",
|
|
146
|
-
"description": "When a user opens a listing and extends the booking date range, the booking-panel estimated total updates to reflect the new dates before payment.",
|
|
147
|
-
"priority": "p1",
|
|
148
|
-
"planSteps": [
|
|
149
|
-
{ "type": "action", "description": "Navigate to the homepage" },
|
|
150
|
-
{ "type": "action", "description": "Search for stays with a valid destination and date range" },
|
|
151
|
-
{ "type": "action", "description": "Open a listing from the search results" },
|
|
152
|
-
{
|
|
153
|
-
"type": "action",
|
|
154
|
-
"description": "Select an initial short date range to view the estimated total",
|
|
155
|
-
},
|
|
156
|
-
{ "type": "action", "description": "Change the date range to a longer stay" },
|
|
157
|
-
{
|
|
158
|
-
"type": "assertion",
|
|
159
|
-
"description": "Verify the estimated total on the booking panel updates from the initial value to reflect the new longer dates",
|
|
160
|
-
},
|
|
161
|
-
],
|
|
162
|
-
}
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
- `name` — an assertable behavior statement (subject + verb + outcome), not a noun
|
|
166
|
-
fragment — e.g. "Booking date range change updates the estimated total" tells
|
|
167
|
-
the testing agent what to verify; "date range" tells it nothing.
|
|
168
|
-
- `description` — the condition + expected outcome in one sentence; disambiguates
|
|
169
|
-
a short name.
|
|
170
|
-
- `priority` — `p0` (must-pass) / `p1` (important paths) / `p2` (edge) / `p3`
|
|
171
|
-
(cosmetic). Pick honestly.
|
|
172
|
-
- `planSteps` — `Array<{ type: 'action' | 'assertion', description: string }>`,
|
|
173
|
-
max 200 steps / 256 KB. Describe user intent, not selectors.
|
|
174
|
-
|
|
175
|
-
**Backend — write the Python yourself and use `--code-file`.** There is no
|
|
176
|
-
server-side codegen on the CLI. Read the API surface that changed (OpenAPI, the
|
|
177
|
-
route handler, request/response shapes) and write a pytest-style assertion script
|
|
178
|
-
to a tempfile. **End the file by calling your `test_*` function(s)** — the runner
|
|
179
|
-
executes the file top-to-bottom and does NOT auto-discover/collect test functions
|
|
180
|
-
the way `pytest` does, so a test that is only _defined_ (never called) silently
|
|
181
|
-
passes regardless of its assertions:
|
|
182
|
-
|
|
183
|
-
```python
|
|
184
|
-
# /tmp/login-empty-password.py — runs against the project's target URL, creds injected.
|
|
185
|
-
import requests
|
|
186
|
-
|
|
187
|
-
def test_login_rejects_empty_password():
|
|
188
|
-
r = requests.post(f"{TARGET_URL}/login", json={"email": "a@b.c", "password": ""})
|
|
189
|
-
assert r.status_code == 400
|
|
190
|
-
assert r.json().get("error") == "invalid password"
|
|
191
|
-
|
|
192
|
-
# Required: actually invoke the test so its assertions run.
|
|
193
|
-
test_login_rejects_empty_password()
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
**Execution environment (backend).** The code runs in a locked-down sandbox with
|
|
197
|
-
only the Python **standard library + `requests` + `pytest` + `numpy` + `scipy`**
|
|
198
|
-
(plus `requests`' own deps like `urllib3`). So:
|
|
199
|
-
|
|
200
|
-
- **Test the API over HTTP** with `requests` against the target URL — that's what a
|
|
201
|
-
backend test verifies.
|
|
202
|
-
- **Do NOT `import` the project's own source modules** (e.g. `from app.services import …`,
|
|
203
|
-
`import core`, `import model`) or other third-party/ML packages (e.g. `torch`,
|
|
204
|
-
`pandas`, `django`). They are not installed, so the test fails to even run.
|
|
205
|
-
- Get values from the API's responses (and captured variables), not by importing and
|
|
206
|
-
calling the app's internals.
|
|
207
|
-
|
|
208
|
-
**Authentication — read the injected credential, NEVER hardcode any credential.** This
|
|
209
|
-
applies to **every** secret the API needs — Bearer/JWT tokens **and** API keys, basic-auth
|
|
210
|
-
blobs, session cookies. Do not paste a literal `Bearer …`, `sk-…`, `x-api-key` value, or any
|
|
211
|
-
other credential into the test. Before your script runs, TestSprite prepends a managed
|
|
212
|
-
credential block built from the project's Authentication settings, and `__AUTH_HEADERS__`
|
|
213
|
-
already contains the right header(s) for the configured auth type:
|
|
214
|
-
|
|
215
|
-
```python
|
|
216
|
-
# Auto-injected credentials — do not modify
|
|
217
|
-
__AUTH_CREDENTIAL__ = "..."
|
|
218
|
-
__AUTH_TYPE__ = "Bearer token" # or "API key" / "basic token" / "public"
|
|
219
|
-
__AUTH_HEADERS__ = {"Authorization": "Bearer ..."} # API key → {"X-API-Key": "..."}; basic → {"Authorization": "Basic ..."}
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
Spread `__AUTH_HEADERS__` into every authenticated request — it adapts to whatever auth type
|
|
223
|
-
the project is configured for, so the same line works for Bearer, API-key, or basic auth:
|
|
136
|
+
**Ask the project's agent.** It is the agent the user has in the TestSprite
|
|
137
|
+
portal: it explores the app in a real browser (frontend) or calls the API
|
|
138
|
+
(backend), reads your change, and writes the tests against what the app is
|
|
139
|
+
supposed to do. You review its plan and apply it; you don't write the tests
|
|
140
|
+
yourself, so they don't share your blind spots.
|
|
224
141
|
|
|
225
|
-
```
|
|
226
|
-
|
|
142
|
+
```bash
|
|
143
|
+
testsprite plan "<what you built, and the rules the user gave for it>" --diff \
|
|
144
|
+
[--file <prd-ticket-or-api-spec>] --project <projectId> --output json
|
|
145
|
+
# "state": "proposed" → show the user the plan, then:
|
|
146
|
+
testsprite apply # or: apply --exclude <ref>; reject "<what to change>"
|
|
147
|
+
# "proposal.kind": "question" → show the user its questions and options, then answer by letter:
|
|
148
|
+
testsprite apply --answer 1=b --answer 2=a,c # or your own words: --answer 1="…"
|
|
149
|
+
testsprite run <test-id...> --wait --output json # the ids apply saved, in "applied.tests"
|
|
227
150
|
```
|
|
228
151
|
|
|
229
|
-
|
|
230
|
-
|
|
152
|
+
- Put the rules the user told you in the request. Don't invent expectations: a
|
|
153
|
+
test whose description says its expectation is only what the app does today is
|
|
154
|
+
the user's call, so ask them before you apply it.
|
|
155
|
+
- For distinct paths (happy + error + edge), ask for them in the same request;
|
|
156
|
+
2–5 tests, more only with the user's confirmation.
|
|
157
|
+
- `"state": "replied"` → read `reply`. Answer from the code what you can with
|
|
158
|
+
`testsprite reply "..."`; ask the user only what only they know.
|
|
159
|
+
- Exit 7: the agent is still working; `testsprite status --wait` follows it.
|
|
160
|
+
Exit 13: the agent isn't enabled for this account; tell the user and stop —
|
|
161
|
+
the CLI has no other way to write tests.
|
|
162
|
+
- For an app only on this machine, the agent works from your change and the
|
|
163
|
+
project's other environments; run what it saved with `--local <port>`.
|
|
164
|
+
- When you open the pull request, put `prSummary` from the `apply` output in its
|
|
165
|
+
description, so reviewers see the tests that now guard the change.
|
|
166
|
+
|
|
167
|
+
**Review the plan before you apply it.** A loose plan produces a
|
|
168
|
+
confidently-wrong `passed` or a thrashing `blocked`. Reject (`testsprite reject
|
|
169
|
+
"<what to change>"`) a test that:
|
|
170
|
+
|
|
171
|
+
- asserts only that something is visible — presence ≠ working (an `<img>` whose
|
|
172
|
+
`src` 404s still "renders"); the assertion must say the thing works and is correct;
|
|
173
|
+
- for a visual / layout feature, asserts content only — at least one assertion
|
|
174
|
+
should name geometry or position (side-by-side, stacked, above/below, grid);
|
|
175
|
+
- names no specific page region for its assertion, or a fuzzy target ("open a thing");
|
|
176
|
+
- depends on state outside the test's control: third-party auth (OAuth/SSO/2FA),
|
|
177
|
+
OS-native surfaces (file upload/download, native dialogs), multi-tab or iframes.
|
|
178
|
+
|
|
179
|
+
**Backend credentials.** The agent's backend tests read the project's injected
|
|
180
|
+
credential (`__AUTH_HEADERS__`); they never hardcode a token. Configure it **once on
|
|
181
|
+
the project's environment** (ask the user for the value — never invent or reuse a key
|
|
182
|
+
you happened to see):
|
|
231
183
|
|
|
232
184
|
- **Bearer / API key / basic (static):**
|
|
233
|
-
`testsprite project
|
|
234
|
-
|
|
185
|
+
`testsprite project env update <projectId> <env> --auth bearer|basic|apikey --credential-file <path>`
|
|
186
|
+
(extra headers: `--header "Name: value"`, secret ones in `--header-file <path>`)
|
|
187
|
+
- **Auto-refreshing login (recurring token):**
|
|
188
|
+
`testsprite project env update <projectId> <env> --auto-auth-file <path>` (format: `project env update --help`)
|
|
235
189
|
|
|
236
|
-
|
|
237
|
-
the test breaks on later runs; the managed block is rewritten with a fresh value each run.
|
|
238
|
-
`test create` emits a `[warn]` when it detects an inlined credential literal — treat that as
|
|
239
|
-
a must-fix, not a nuisance.
|
|
190
|
+
### (c) A test that is wrong
|
|
240
191
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
same file). But when the coverage set splits naturally into producer → consumer
|
|
244
|
-
→ cleanup — one test captures an auth token or created-resource id that others
|
|
245
|
-
reuse — declare the graph with the dependency flags instead of duplicating setup
|
|
246
|
-
in every file:
|
|
192
|
+
You don't edit tests. If a test fails because the test itself is wrong (stale
|
|
193
|
+
steps, a wrong expectation), tell the agent and apply its fix:
|
|
247
194
|
|
|
248
195
|
```bash
|
|
249
|
-
|
|
250
|
-
testsprite
|
|
251
|
-
--code-file /tmp/login.py --produces auth_token
|
|
252
|
-
|
|
253
|
-
# consumer — scheduled in a wave after every producer it names
|
|
254
|
-
testsprite test create --type backend --project <projectId> --name "profile update accepts the issued token" \
|
|
255
|
-
--code-file /tmp/profile.py --needs auth_token
|
|
256
|
-
|
|
257
|
-
# cleanup — always scheduled in the final wave
|
|
258
|
-
testsprite test create --type backend --project <projectId> --name "fixture user is deleted" \
|
|
259
|
-
--code-file /tmp/cleanup.py --category teardown
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
- `--produces <var>` / `--needs <var>` are repeatable. All three flags are
|
|
263
|
-
**backend-only** — combined with `--type frontend` the CLI exits 5.
|
|
264
|
-
- **Don't hand-sequence `test run` calls to fake ordering.** The wave engine owns
|
|
265
|
-
ordering: trigger the set with `test run --all` (§4) and producers run before
|
|
266
|
-
consumers, `teardown` last. Chaining `run A --wait && run B --wait` yourself
|
|
267
|
-
loses the engine's variable passing and conflicts with concurrent runs.
|
|
268
|
-
- **Declarations are editable.** `test update` amends them (`--produces` /
|
|
269
|
-
`--needs` / `--category`, repeatable) and `test get` echoes them back —
|
|
270
|
-
still declare the graph at create time when you can, so wave ordering is
|
|
271
|
-
right on the first run.
|
|
272
|
-
|
|
273
|
-
**Show the user the drafted plan / code before creating it** — creating writes to
|
|
274
|
-
their project. One short confirmation; let them edit the tempfile first.
|
|
275
|
-
|
|
276
|
-
#### Authoring planSteps the testing agent will execute reliably
|
|
277
|
-
|
|
278
|
-
Execution reliability tracks plan wording. A loose plan produces a
|
|
279
|
-
confidently-wrong `passed` (bare visibility assertions) or a thrashing
|
|
280
|
-
`blocked`. Write to these rules first:
|
|
281
|
-
|
|
282
|
-
- **One verb per step.** `and` / `then` between two verbs → split — e.g.
|
|
283
|
-
"Search for stays and open the first result" becomes two steps.
|
|
284
|
-
- **Describe outcomes, not selectors.** The testing agent locates targets
|
|
285
|
-
semantically — describe the intent and the match stays robust across copy
|
|
286
|
-
changes; a guessed literal label defeats that. E.g. write `"Submit the form"`,
|
|
287
|
-
not `"Click the blue 'Submit' button"`. If the app tags elements with its own
|
|
288
|
-
attribute (`data-element`, `data-cy`, …), make sure the project knows —
|
|
289
|
-
`testsprite project get <projectId>` shows `testIdAttrs:`; set it once with
|
|
290
|
-
`project update <projectId> --test-id-attributes <attr>,data-testid` — and the
|
|
291
|
-
exported code will locate tagged elements by that attribute instead of text.
|
|
292
|
-
- **`Navigate to` only on step 1** (or a login page). Use clicks for every later
|
|
293
|
-
transition — direct URLs break SPA routing.
|
|
294
|
-
- **FE plans narrate a user journey through their actions.** Each action is
|
|
295
|
-
what a real user does (click, type, navigate, hover, scroll), forming a
|
|
296
|
-
sequence that exercises what gives the feature its value. The final assertion
|
|
297
|
-
verifies what the journey produced — the state the user arrived at, a
|
|
298
|
-
comparison against an earlier state, a derived count — not just that the
|
|
299
|
-
starting page rendered.
|
|
300
|
-
- **Name the target entity type, not a fuzzy noun.** If a page has several
|
|
301
|
-
look-alike row kinds, "open a thing" lets the testing agent pick the wrong
|
|
302
|
-
kind. Name the type and the page/view you expect to land on.
|
|
303
|
-
- **1–2 assertions, at the end, on whether the content is present _and actually
|
|
304
|
-
works_** (see _presence ≠ working_ below) rather than UI copy / formatting.
|
|
305
|
-
(Quoting a literal you submitted earlier in the same plan, to verify it
|
|
306
|
-
round-trips, is fine.)
|
|
307
|
-
- **Presence ≠ working.** A node can exist yet be broken or wrong — e.g. an
|
|
308
|
-
`<img>` whose `src` 404s renders a broken-image box but still passes "element
|
|
309
|
-
present / has alt." Assert the thing actually **works and is correct**, not
|
|
310
|
-
just that the tag exists; trust the testing agent to judge correctness rather
|
|
311
|
-
than hard-coding the expected answer into the assertion.
|
|
312
|
-
- **Assertion targets name the specific page region** (panel / tab / output area).
|
|
313
|
-
Otherwise the testing agent settles for "some element with that text is
|
|
314
|
-
visible anywhere," which passes for wrong reasons.
|
|
315
|
-
- **For visual / CSS / layout-sensitive features, content-presence-only
|
|
316
|
-
assertions are dangerous.** "Verify the methodology section is visible" passes
|
|
317
|
-
even when the stylesheet is missing and three cards render as flat unstyled
|
|
318
|
-
text stacked vertically — the strings exist on the page, and a content-presence
|
|
319
|
-
assertion constrains nothing about layout. For any feature whose value depends on
|
|
320
|
-
layout, include at least one assertion that names geometry or relative
|
|
321
|
-
position (row, column, side-by-side, stacked, grid, above/below, span, card
|
|
322
|
-
background, border), not just content existence:
|
|
323
|
-
|
|
324
|
-
```jsonc
|
|
325
|
-
// BEFORE — content-presence-only (passes even on broken CSS)
|
|
326
|
-
{ "type": "assertion", "description": "Verify the methodology section with three sub-score formulas is visible" }
|
|
327
|
-
|
|
328
|
-
// AFTER — content + layout
|
|
329
|
-
{ "type": "assertion", "description": "Verify the methodology section shows three card cells laid out side-by-side in a single horizontal row, each with a distinct card background and a heading; the three cards together span the full content width" }
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
- **Keep `description` and `planSteps` in scope agreement** — the testing agent
|
|
333
|
-
reads `description` as the test's purpose and shrinks execution to match. If
|
|
334
|
-
you change the steps, re-align the description.
|
|
335
|
-
- **Keep flows that depend on state outside the test's control out of scope:**
|
|
336
|
-
third-party auth (OAuth/SSO/2FA), OS-native surfaces (file upload/download,
|
|
337
|
-
drag-and-drop, native dialogs), cross-context state (iframes, multi-tab,
|
|
338
|
-
external services). Pick a different verification.
|
|
339
|
-
- **Test data must be self-contained** — create what you need within the plan, or
|
|
340
|
-
don't write the plan.
|
|
341
|
-
|
|
342
|
-
### (c) A coverage set — multiple FE plans as a batch
|
|
343
|
-
|
|
344
|
-
When a FE feature has distinct paths (happy + error + edge), draft a
|
|
345
|
-
`plans.jsonl`, one spec per line. Aim for 2–5 plans; more only with explicit user
|
|
346
|
-
confirmation. Max 50 plans / 5 MB per batch.
|
|
347
|
-
|
|
348
|
-
```jsonc
|
|
349
|
-
// plans.jsonl — FE only
|
|
350
|
-
{"projectId":"prj_abc","type":"frontend","name":"login happy path","planSteps":[...]}
|
|
351
|
-
{"projectId":"prj_abc","type":"frontend","name":"login wrong password","planSteps":[...]}
|
|
352
|
-
{"projectId":"prj_abc","type":"frontend","name":"login empty email","planSteps":[...]}
|
|
196
|
+
testsprite plan "the <test name> test should <correct behavior>: <why>" --project <projectId>
|
|
197
|
+
testsprite apply
|
|
353
198
|
```
|
|
354
199
|
|
|
355
|
-
|
|
356
|
-
--project <projectId> --code-file <file>` three times with three Python files.
|
|
357
|
-
|
|
358
|
-
### (d) Refine an existing test
|
|
359
|
-
|
|
360
|
-
- **FE** — replace the steps, then re-run:
|
|
361
|
-
```bash
|
|
362
|
-
testsprite test plan put <test-id> --steps refined.json
|
|
363
|
-
```
|
|
364
|
-
- **BE** — write updated Python and replace the code (optimistic concurrency):
|
|
365
|
-
```bash
|
|
366
|
-
testsprite test code put <test-id> --code-file refined.py --expected-version <current-version>
|
|
367
|
-
```
|
|
200
|
+
Drifted steps are healed during a run; a wrong expectation needs the agent.
|
|
368
201
|
|
|
369
202
|
## 4. Run
|
|
370
203
|
|
|
371
204
|
For a deployed target, create its environment once, then use `--env <name>`
|
|
372
205
|
after that deployment contains the change. Omit `--env` for Default; an unknown
|
|
373
206
|
name fails with available names and never falls back. For a local change,
|
|
374
|
-
use `testsprite
|
|
375
|
-
waiting and defaults to 1200 seconds.
|
|
376
|
-
|
|
207
|
+
use `testsprite run <test-id> --local <port>` (frontend only); it implies
|
|
208
|
+
waiting and defaults to 1200 seconds.
|
|
209
|
+
|
|
210
|
+
For a long `--wait` or a local run, start the CLI as a background task in your
|
|
211
|
+
agent tool (for example, `run_in_background: true` in Claude Code) and poll
|
|
212
|
+
that same task for its output and exit code. If running in the foreground,
|
|
213
|
+
set the tool's wall-clock timeout longer than the CLI wait budget, including
|
|
214
|
+
time for setup and cleanup. A tool timeout can terminate the CLI. After an
|
|
215
|
+
ordinary cloud run detaches, resume with `testsprite run wait <run-id>`.
|
|
216
|
+
Terminating the process that owns a local tunnel closes it and requests
|
|
217
|
+
cancellation by default.
|
|
377
218
|
|
|
378
219
|
```bash
|
|
379
220
|
# One-time setup for a deployed target
|
|
380
221
|
testsprite project env create <projectId> --name staging --url https://staging.example.com
|
|
381
222
|
|
|
223
|
+
# Run the project suite and wait
|
|
224
|
+
testsprite run --project <projectId> --env staging --wait --timeout 600 --output json
|
|
225
|
+
|
|
382
226
|
# (a) existing test
|
|
383
|
-
testsprite
|
|
384
|
-
|
|
385
|
-
# (a-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
testsprite test
|
|
391
|
-
|
|
392
|
-
#
|
|
393
|
-
testsprite
|
|
394
|
-
|
|
395
|
-
# (b-BE) new BE test from Python (backend create needs --project)
|
|
396
|
-
testsprite test create --type backend --name "..." --project <projectId> --code-file foo.py --run --wait --timeout 600
|
|
397
|
-
|
|
398
|
-
# (b-BE coverage set with dependencies) create each test without --run, then one wave-ordered batch
|
|
399
|
-
testsprite test run --all --project <projectId> --env staging --wait --timeout 600 --output json
|
|
400
|
-
testsprite test run --all --project <projectId> --filter <name-substr> --wait --timeout 600 # subset by name
|
|
401
|
-
|
|
402
|
-
# (c) FE coverage set — single-call create + run (FE-only)
|
|
403
|
-
testsprite test create-batch --plans plans.jsonl --run --wait \
|
|
404
|
-
--env staging --max-concurrency 3 --timeout 600 --output json
|
|
405
|
-
# Two-step alternative (inspect before running):
|
|
406
|
-
# testsprite test create-batch --plans plans.jsonl --output json
|
|
407
|
-
# then trigger each id: testsprite test run <test-id> --env staging --wait --timeout 600
|
|
408
|
-
|
|
409
|
-
# (d-FE) refine + re-run
|
|
410
|
-
testsprite test plan put <test-id> --steps refined.json && \
|
|
411
|
-
testsprite test run <test-id> --env staging --wait --timeout 600
|
|
412
|
-
|
|
413
|
-
# (d-BE) refine BE code + re-run. NOTE: if you reach for `test rerun` here instead, a BE rerun
|
|
414
|
-
# dispatches the full producer/teardown closure — use --skip-dependencies while iterating on one
|
|
415
|
-
# script (producers already verified this round), then finish with a closure run before reporting.
|
|
416
|
-
testsprite test code put <test-id> --code-file refined.py --expected-version <current-version> && \
|
|
417
|
-
testsprite test run <test-id> --env staging --wait --timeout 600
|
|
227
|
+
testsprite run <test-id> --env staging --wait --timeout 600 --output json
|
|
228
|
+
|
|
229
|
+
# (a-several) several tests in one batch; --skip-dependencies (BE) runs only the named tests
|
|
230
|
+
testsprite run <test-id> <test-id> --env staging --wait --timeout 600 --output json
|
|
231
|
+
testsprite run <test-id> --skip-dependencies --wait --timeout 600
|
|
232
|
+
|
|
233
|
+
# (b) the tests `apply` saved
|
|
234
|
+
testsprite run <test-id> <test-id> --env staging --wait --timeout 600 --output json
|
|
235
|
+
|
|
236
|
+
# Narrow a project selection by title
|
|
237
|
+
testsprite run --project <projectId> --filter <name-substr> --wait --timeout 600 # subset by name
|
|
418
238
|
```
|
|
419
239
|
|
|
240
|
+
Saved lists retain their pinned project/environment mappings:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
testsprite run --testlist <listId> --wait --output json
|
|
244
|
+
testsprite run <test-id> <test-id> --testlist <listId> --wait --output json
|
|
245
|
+
# Resume or cancel whole executions; these IDs are runId, not testId/resultId
|
|
246
|
+
testsprite run wait <run-id...> --timeout 600 --output json
|
|
247
|
+
testsprite run cancel <run-id...> --output json
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Choose a project, named tests, or a saved list. `--project` cannot combine with
|
|
251
|
+
positional IDs or `--testlist`; named IDs and list selection ignore
|
|
252
|
+
`TESTSPRITE_PROJECT_ID`. Without IDs or a list, that variable supplies the default
|
|
253
|
+
project. Lists reject environment/target overrides and use positional members
|
|
254
|
+
for subsets. `--filter` narrows only project selection. Use `run wait R --timeout
|
|
255
|
+
600` with lifecycle flags after the child; launch flags before a child are errors.
|
|
256
|
+
|
|
420
257
|
Key behaviors:
|
|
421
258
|
|
|
422
|
-
- Environment `--url`
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
- `--wait`
|
|
259
|
+
- Environment `--url` takes a public http/https URL or a loopback http origin
|
|
260
|
+
with an explicit port (frontend only); private and link-local addresses are
|
|
261
|
+
refused. Running against a loopback environment opens a tunnel automatically
|
|
262
|
+
and waits, like `--local <port>`. `--env <name> --local <port>` sends that
|
|
263
|
+
environment's sign-in to your local app; the server applies it or refuses
|
|
264
|
+
before dispatch.
|
|
265
|
+
- `--wait` reads execution status until terminal and handles its own backoff — don't wrap it
|
|
429
266
|
in a retry loop.
|
|
430
|
-
- `--local` implies `--wait`, with a default timeout of 1200 seconds
|
|
431
|
-
waits default to 600). Run several local frontend tests in ONE command (`
|
|
267
|
+
- `--local` implies `--wait`, with a default timeout of 1200 seconds for the command (ordinary
|
|
268
|
+
waits default to 600). Run several local frontend tests in ONE command (`run <id> <id> … --local <port>`) instead of starting one process per test. `run --project <id> --local <port>` runs frontend tests and reports backend tests as skipped. They start one run per project (up to 5000 named test IDs per request) through one tunnel; `--max-concurrency` sets the server dispatch limit per execution, default 5 and maximum 15. Each execution is waited on independently; this limit never queues polling. There are
|
|
432
269
|
5 live tunnel bindings per user; `tunnel_binding_limit` is exit 11 and is not
|
|
433
270
|
auto-retried. Reuse a live tunnel with `--tunnel-client` or stop an unused one.
|
|
434
271
|
On a tunnel-limit error, run `testsprite tunnel list`, then `testsprite tunnel stop <id>`
|
|
435
272
|
or `testsprite tunnel stop --all --confirm` if every binding should be revoked.
|
|
436
|
-
- Keep the
|
|
437
|
-
|
|
273
|
+
- Keep the ids the run prints. A run is one launch (`runId`); each test in it has a
|
|
274
|
+
result (`resultId`). A project or named launch prints `Run <run-id>` on **stderr** at
|
|
275
|
+
once, and so does a saved list (`--testlist`) under `--wait`; the card on stdout lists
|
|
276
|
+
each run (`Run <run-id>`) with its results and, when the server supplies one, a
|
|
277
|
+
`Dashboard: <url>` line (that run's page in the Portal).
|
|
278
|
+
Parse `runs[].runId`, `results[].resultId` and the outcome counts in `summary` for
|
|
279
|
+
any selection or resumed wait. `partial: true` marks an incomplete timeout or
|
|
280
|
+
interruption. A completed failure can be inspected immediately with `result get`.
|
|
438
281
|
- An **owned** local run requests cancellation by default when waiting stops (timeout,
|
|
439
282
|
Ctrl-C, or a polling failure), then its tunnel closes. Read the reported
|
|
440
|
-
cancellation outcome. For a
|
|
283
|
+
cancellation outcome. For a frontend run cancelled before a terminal verdict,
|
|
441
284
|
the backend attempts a refund. Inspect `refund.status`; cancellation does not
|
|
442
285
|
guarantee a refund.
|
|
443
286
|
`--no-cancel-on-interrupt` detaches instead, but the owned tunnel still closes.
|
|
@@ -448,54 +291,39 @@ Key behaviors:
|
|
|
448
291
|
A second `tunnel start` or process using the same credential takes over, and the first exits **10**.
|
|
449
292
|
- Exit codes: `0` = passed; `1` = failed / blocked / cancelled; `7` = timeout
|
|
450
293
|
or unsupported. An owned local timeout is inconclusive: start a **new**
|
|
451
|
-
`testsprite
|
|
452
|
-
`--local-host <host>` if used; do not suggest `
|
|
453
|
-
waits with `testsprite
|
|
294
|
+
`testsprite run <test-id> --local <port> --timeout 1800`, keeping the same
|
|
295
|
+
`--local-host <host>` if used; do not suggest `run wait` for that closed tunnel. Resume **ordinary or adopted-tunnel**
|
|
296
|
+
waits with `testsprite run wait <run-id>` only while the target is reachable
|
|
454
297
|
(and the adopted tunnel's owner remains alive).
|
|
455
298
|
- Exit `13` (`FEATURE_GATED`) and exit `12` (`INSUFFICIENT_CREDITS`) are not retriable: show the user the server's message and the link from `nextAction` or JSON `links`, then stop.
|
|
456
|
-
-
|
|
457
|
-
machine
|
|
458
|
-
|
|
299
|
+
- When `run` selects a saved loopback environment by name or as Default, run
|
|
300
|
+
it on the machine hosting the app. The CLI opens a tunnel and waits. An
|
|
301
|
+
explicit `--no-wait` suppresses automatic tunneling. Without a live tunnel
|
|
302
|
+
the server refuses dispatch (`tunnel-required`, exit 6). The Portal shows
|
|
459
303
|
local environments but offers no Run; backend Portal requests are refused
|
|
460
|
-
without charge.
|
|
461
|
-
|
|
462
|
-
runs normally even if the test ran through a tunnel before.
|
|
304
|
+
without charge. A CLI test-list launch can tunnel to its pinned local
|
|
305
|
+
environment. Scheduled runs cannot start a tunnel on your machine. A deployed environment selected with `--env <name>` or made Default
|
|
306
|
+
runs normally even if the test ran through a tunnel before. Local runs use
|
|
463
307
|
the agent path, never saved-code replay, and preserve the test's saved code.
|
|
464
|
-
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
`create-batch` (≤50 specs) fires all at once under the cap. The 50/min throttle
|
|
475
|
-
is per-invocation — separate batches/processes don't share it — so for >50 specs
|
|
476
|
-
in a minute you lean on the server's 60/min cap + `RATE_LIMITED` retries, not
|
|
477
|
-
client queuing. Re-list and check `draft` rows — "tests created" is
|
|
478
|
-
not the same as "runs triggered".
|
|
479
|
-
- **Backend execution is dependency-aware; frontend is not.** `test run --all
|
|
480
|
-
--project <id>` triggers a fresh wave-ordered batch over the project's backend
|
|
481
|
-
tests (producers → consumers → `teardown` last); FE tests in the project are
|
|
482
|
-
skipped with an advisory, and everything not dispatched is enumerated
|
|
483
|
-
(`conflicts` / `deferred` / `skippedFrontend`) so don't count `accepted[]`
|
|
484
|
-
alone. `test rerun <be-id>` expands the producer/teardown closure by default —
|
|
485
|
-
stderr summarizes `Reran N tests: 1 selected + P producer(s) + T teardown(s)`,
|
|
486
|
-
and failed members surface as `closureFailures[]` without flipping the exit
|
|
487
|
-
code. Pass `--skip-dependencies` only when this round already verified the
|
|
488
|
-
producers and you're iterating fast on one script.
|
|
489
|
-
- `test code put` needs `--expected-version <codeVersion>`; stale etag → exit 6,
|
|
490
|
-
re-fetch via `test get <id>` and retry. `--force` bypasses but is audit-logged.
|
|
308
|
+
- Run-trigger rate limit is 60/min/key, server-enforced; excess triggers return
|
|
309
|
+
`RATE_LIMITED` (exit 11 for a single `run`).
|
|
310
|
+
- **Backend execution is dependency-aware; frontend is not.** `run
|
|
311
|
+
--project <id>` triggers a fresh batch over every test in the project: backend
|
|
312
|
+
tests in wave order (producers → consumers → `teardown` last), frontend tests
|
|
313
|
+
alongside. Check dispatch diagnostics and `summary.skipped` for tests that did not start. A big batch is accepted whole and its tests show `queued` until they
|
|
314
|
+
start; `deferred` is rare (a project's lock stayed busy, or a test went in
|
|
315
|
+
flight during dispatch) and is never resent (exit 7). A BE run expands the
|
|
316
|
+
producer/teardown closure by default. Pass `--skip-dependencies` (`run <test-id> --skip-dependencies`)
|
|
317
|
+
only when this round already verified the producers.
|
|
491
318
|
- Idempotency: the CLI auto-mints an `Idempotency-Key`; replays within 24h return
|
|
492
|
-
the original
|
|
319
|
+
the original run.
|
|
493
320
|
|
|
494
321
|
## 4a. Read the result — plan, or product?
|
|
495
322
|
|
|
496
|
-
Don't take the verdict at face value. After a run,
|
|
497
|
-
(`testsprite
|
|
498
|
-
|
|
323
|
+
Don't take the verdict at face value. After a run, read the result
|
|
324
|
+
(`testsprite result get <result-id> --output json`: `error`, `cause`, `fix`,
|
|
325
|
+
`failedStep` and every step; a backend test adds its traceback `trace` and its
|
|
326
|
+
output `apiOutput`) and ask: **plan quality, or actual product behavior?**
|
|
499
327
|
|
|
500
328
|
The plan is the problem (most common — check first) when:
|
|
501
329
|
|
|
@@ -510,11 +338,10 @@ The product/environment is the problem (believe these) when:
|
|
|
510
338
|
read-only", "page 404s");
|
|
511
339
|
- the trace blames infra (deploy lag, auth gate, missing fixture).
|
|
512
340
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
Older backends may return cumulative bare steps; pin `--run-id` before counting.
|
|
341
|
+
Read the result of the run you are verifying, by the `resultId` that run printed.
|
|
342
|
+
`testsprite result list --run <run-id> --status failed,blocked` lists what did not
|
|
343
|
+
pass in a run; `testsprite result list --test <test-id> --limit 5` lists a test's
|
|
344
|
+
recent results, newest first. A result of an earlier run is not evidence for this one.
|
|
518
345
|
|
|
519
346
|
**Read the testing agent's failure summary skeptically — it can conflate two
|
|
520
347
|
failure phases.** When a flow produces an artifact that then runs against an external
|
|
@@ -525,26 +352,34 @@ and runtime output: if the runtime output references a literal you submitted
|
|
|
525
352
|
earlier in the plan, the action succeeded and the error is runtime-phase.
|
|
526
353
|
|
|
527
354
|
**BE closure runs: root-cause the earliest failed wave, not the selected test.**
|
|
528
|
-
When
|
|
355
|
+
When `run` expanded a dependency closure and a **producer**
|
|
529
356
|
failed, every consumer downstream of it fails or blocks by starvation (missing
|
|
530
357
|
token / missing fixture). The selected test's red verdict does not implicate
|
|
531
|
-
your feature — report it as failed-downstream,
|
|
358
|
+
your feature — report it as failed-downstream, read the producer's result
|
|
532
359
|
first, and only blame the consumer once its producers pass in the same run.
|
|
533
360
|
|
|
534
|
-
If it's the plan:
|
|
535
|
-
then stop. Don't grind. If it's the product/env: report the verdict with the
|
|
361
|
+
If it's the plan: tell the agent what is wrong with it (§3c), apply its fix and
|
|
362
|
+
re-run **once** (two runs total), then stop. Don't grind. If it's the product/env: report the verdict with the
|
|
536
363
|
testing agent's observation; don't auto-fix on the recommendation alone. If you
|
|
537
364
|
genuinely can't tell: report `inconclusive` with the signal that triggered the
|
|
538
365
|
call and ask.
|
|
539
366
|
|
|
540
|
-
## 5. On failure → download the
|
|
367
|
+
## 5. On failure → download the evidence
|
|
541
368
|
|
|
542
369
|
```bash
|
|
543
|
-
testsprite
|
|
370
|
+
testsprite result get <result-id> --out .testsprite/results/<result-id>
|
|
371
|
+
testsprite result get <result-id> --out .testsprite/results/<result-id> --failed-only # failed step ±1
|
|
544
372
|
```
|
|
545
373
|
|
|
546
|
-
|
|
547
|
-
|
|
374
|
+
It writes `result.json` (the result, each link replaced by its file), the video and
|
|
375
|
+
each step's `steps/001.png` / `steps/001.html`. Give each result its own directory:
|
|
376
|
+
in an existing one, `result.json`, `video.*`, `steps/` and `sign-in/` are replaced.
|
|
377
|
+
Read `cause`, `fix` and the failed step in `result.json` first. Raw HTML
|
|
378
|
+
snapshots may contain credentials in form values. Use the neighboring screenshots
|
|
379
|
+
and the video for visual context. Keep the export private and
|
|
380
|
+
use a redacted excerpt when sharing evidence. The CLI creates
|
|
381
|
+
`.testsprite/.gitignore` on first export there and preserves existing rules.
|
|
382
|
+
Check Git's ignore rules when using a custom output directory.
|
|
548
383
|
|
|
549
384
|
## 6. Report
|
|
550
385
|
|
|
@@ -555,8 +390,9 @@ When you tell the user the feature is done, include:
|
|
|
555
390
|
- The verdict. Don't report `passed` if §4a's sanity check tripped — surface as
|
|
556
391
|
`inconclusive` with the specific signal.
|
|
557
392
|
- If the user wants to inspect a test or run themselves, point them at the
|
|
558
|
-
dashboard link from the CLI output (`dashboardUrl` in JSON; a `Dashboard:` line
|
|
559
|
-
in text mode) — `
|
|
560
|
-
|
|
561
|
-
|
|
393
|
+
dashboard link from the CLI output (`runs[].dashboardUrl` in JSON; a `Dashboard:` line
|
|
394
|
+
under each run in text mode) — `run`, `run --wait` and `run wait` all carry one when
|
|
395
|
+
the server supplies it (a saved list launched without `--wait` has none until
|
|
396
|
+
`run wait`). It opens that run's page in the Portal.
|
|
397
|
+
- If failed, a one-line summary of the result's `cause` and `fix`. **Don't auto-fix** on that alone — the recommendation
|
|
562
398
|
can be wrong; the human should look.
|