@testsprite/testsprite-cli 0.10.0 → 0.11.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 +25 -2
- package/dist/commands/auth.d.ts +5 -1
- package/dist/commands/auth.js +17 -5
- package/dist/commands/init.d.ts +6 -1
- package/dist/commands/init.js +13 -5
- package/dist/commands/project.d.ts +9 -0
- package/dist/commands/project.js +89 -18
- package/dist/commands/test.d.ts +14 -2
- package/dist/commands/test.js +141 -33
- package/dist/commands/tunnel.d.ts +2 -2
- package/dist/commands/tunnel.js +139 -31
- package/dist/index.js +29 -11
- package/dist/lib/client-factory.d.ts +4 -1
- package/dist/lib/client-factory.js +12 -4
- package/dist/lib/credentials.d.ts +4 -0
- package/dist/lib/credentials.js +43 -4
- package/dist/lib/http.d.ts +14 -2
- package/dist/lib/http.js +38 -6
- package/dist/lib/response-schemas.d.ts +5 -2
- package/dist/lib/response-schemas.js +21 -1
- package/dist/lib/runs.types.d.ts +11 -0
- package/dist/lib/target-url.d.ts +1 -1
- package/dist/lib/target-url.js +4 -0
- package/dist/lib/telemetry.d.ts +6 -2
- package/dist/lib/telemetry.js +12 -0
- package/dist/lib/tunnel-session.d.ts +13 -2
- package/dist/lib/tunnel-session.js +92 -23
- package/dist/lib/tunnel.types.d.ts +3 -1
- package/dist/vendor/tunnel-client/client.d.ts +11 -0
- package/dist/vendor/tunnel-client/client.js +383 -56
- package/dist/vendor/tunnel-client/config.d.ts +11 -3
- package/dist/vendor/tunnel-client/config.js +11 -3
- package/dist/vendor/tunnel-client/types.d.ts +26 -1
- package/dist/vendor/tunnel-client/types.js +1 -0
- package/dist/vendor/tunnel-client/ws-compat.d.ts +3 -2
- package/dist/vendor/tunnel-client/ws-compat.js +3 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -1
- package/skills/testsprite-onboard.skill.md +74 -59
- package/skills/testsprite-verify.codex.md +82 -97
- package/skills/testsprite-verify.skill.md +62 -15
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* - the endpoints are internal infrastructure names, and a default value is
|
|
8
8
|
* still a value that ships;
|
|
9
9
|
* - a default endpoint is the failure mode the facade exists to prevent.
|
|
10
|
-
* `POST /api/cli/v1/tunnel` returns `controlUrl
|
|
11
|
-
* environment the caller authenticated
|
|
12
|
-
* endpoints this client may dial. A default would let a
|
|
10
|
+
* `POST /api/cli/v1/tunnel` returns `controlUrl`, `tunnelAddr`, and
|
|
11
|
+
* optionally `tunnelTlsAddr` for the environment the caller authenticated
|
|
12
|
+
* against, and those are the ONLY endpoints this client may dial. A default would let a
|
|
13
13
|
* misconfigured/partially-constructed client silently connect somewhere
|
|
14
14
|
* else and fail in a way that reads like an auth problem.
|
|
15
15
|
*
|
|
@@ -28,6 +28,14 @@ export const DEFAULT_HEARTBEAT_MS = 10_000;
|
|
|
28
28
|
* accepted the transport but never authenticated it.
|
|
29
29
|
*/
|
|
30
30
|
export const DEFAULT_AUTH_TIMEOUT_MS = 10_000;
|
|
31
|
+
/** Maximum time allowed for each plaintext TCP connect. */
|
|
32
|
+
export const DEFAULT_CONNECT_TIMEOUT_MS = 10_000;
|
|
33
|
+
/** Maximum time allowed for each TLS connect + handshake. */
|
|
34
|
+
export const DEFAULT_TLS_HANDSHAKE_TIMEOUT_MS = 10_000;
|
|
35
|
+
/** Retry window after the first failed data-plane dial. Zero retries forever. */
|
|
36
|
+
export const DEFAULT_DATA_PLANE_RETRY_DEADLINE_MS = 60_000;
|
|
37
|
+
/** Post-hello interval after which an otherwise-idle data-plane session is established. */
|
|
38
|
+
export const DEFAULT_DATA_PLANE_SETTLE_MS = 5_000;
|
|
31
39
|
/** Delay between control/tunnel reconnect attempts. Upstream default. */
|
|
32
40
|
export const DEFAULT_RECONNECT_MS = 3_000;
|
|
33
41
|
/** Log verbosity floor. Upstream default. */
|
|
@@ -5,7 +5,8 @@ export declare enum ErrCode {
|
|
|
5
5
|
TunnelDisconnected = "0003",
|
|
6
6
|
TargetConnectFailed = "0004",
|
|
7
7
|
StreamFailed = "0005",
|
|
8
|
-
BlockedTargetRejected = "0006"
|
|
8
|
+
BlockedTargetRejected = "0006",
|
|
9
|
+
DataPlaneUnreachable = "0007"
|
|
9
10
|
}
|
|
10
11
|
export interface TunnelClientError {
|
|
11
12
|
code: ErrCode;
|
|
@@ -22,6 +23,30 @@ export interface TunnelClientOptions {
|
|
|
22
23
|
controlUrl: string;
|
|
23
24
|
/** VENDOR DELTA: required. `host:port` of the tunnel DATA plane. */
|
|
24
25
|
tunnelAddr: string;
|
|
26
|
+
/**
|
|
27
|
+
* TLS `host:port` (or `[v6]:port`) for the tunnel DATA plane. When set,
|
|
28
|
+
* transport is fixed to TLS and `tunnelAddr` is never dialled as fallback.
|
|
29
|
+
*/
|
|
30
|
+
tunnelTlsAddr?: string;
|
|
31
|
+
/** TLS SNI/verification name. Defaults to the hostname in `tunnelTlsAddr`. */
|
|
32
|
+
tunnelTlsServername?: string;
|
|
33
|
+
/** Extra PEM roots appended to Node's built-in root certificate set. */
|
|
34
|
+
tunnelTlsCa?: string | Buffer | Array<string | Buffer>;
|
|
35
|
+
/** Maximum time to complete each plaintext TCP connect. Defaults to 10 seconds. */
|
|
36
|
+
connectTimeoutMs?: number;
|
|
37
|
+
/** Maximum time to complete each TLS connect + handshake. Defaults to 10 seconds. */
|
|
38
|
+
tlsHandshakeTimeoutMs?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Maximum retry window after the first failed data-plane attempt. The first
|
|
41
|
+
* inbound yamux stream or the settle interval ends it. Defaults to 60
|
|
42
|
+
* seconds; `0` retries forever.
|
|
43
|
+
*/
|
|
44
|
+
dataPlaneRetryDeadlineMs?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Time a post-TunnelHello socket must remain open before the session counts
|
|
47
|
+
* as established without an inbound yamux stream. Defaults to 5 seconds.
|
|
48
|
+
*/
|
|
49
|
+
dataPlaneSettleMs?: number;
|
|
25
50
|
/**
|
|
26
51
|
* VENDOR DELTA: maximum time `start()` waits for the current control
|
|
27
52
|
* connection's first Ack, which is the server's authentication acknowledgement.
|
|
@@ -21,8 +21,9 @@
|
|
|
21
21
|
* - **The control socket uses the process-global undici dispatcher**, so an
|
|
22
22
|
* `HTTP(S)_PROXY` this CLI honours (`lib/proxy.ts`) also carries the
|
|
23
23
|
* control WebSocket. Deliberate — but note it does NOT help the tunnel
|
|
24
|
-
* DATA plane, which
|
|
25
|
-
*
|
|
24
|
+
* DATA plane, which uses a direct TLS socket for advertised TLS endpoints
|
|
25
|
+
* and raw TCP only for the explicit legacy transport. Both bypass HTTP
|
|
26
|
+
* proxies. `lib/tunnel-session.ts` warns about that asymmetry rather than
|
|
26
27
|
* pretending a proxied environment is supported.
|
|
27
28
|
*
|
|
28
29
|
* ## Why `close()` cannot just call `WebSocket.close()` and wait
|
|
@@ -21,8 +21,9 @@
|
|
|
21
21
|
* - **The control socket uses the process-global undici dispatcher**, so an
|
|
22
22
|
* `HTTP(S)_PROXY` this CLI honours (`lib/proxy.ts`) also carries the
|
|
23
23
|
* control WebSocket. Deliberate — but note it does NOT help the tunnel
|
|
24
|
-
* DATA plane, which
|
|
25
|
-
*
|
|
24
|
+
* DATA plane, which uses a direct TLS socket for advertised TLS endpoints
|
|
25
|
+
* and raw TCP only for the explicit legacy transport. Both bypass HTTP
|
|
26
|
+
* proxies. `lib/tunnel-session.ts` warns about that asymmetry rather than
|
|
26
27
|
* pretending a proxied environment is supported.
|
|
27
28
|
*
|
|
28
29
|
* ## Why `close()` cannot just call `WebSocket.close()` and wait
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.11.0";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testsprite/testsprite-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Official TestSprite command-line interface",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
"globals": "^17.7.0",
|
|
76
76
|
"msw": "^2.14.3",
|
|
77
77
|
"prettier": "^3.3.3",
|
|
78
|
+
"selfsigned": "^5.5.0",
|
|
78
79
|
"typescript": "^5.6.3",
|
|
79
80
|
"typescript-eslint": "^8.13.0",
|
|
80
81
|
"vitest": "^2.1.4"
|
|
@@ -7,16 +7,12 @@
|
|
|
7
7
|
|
|
8
8
|
# TestSprite: onboard a repo with a seed test suite
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
**coherent, runnable suite** plus a couple of **already-green** smoke tests — in one pass.
|
|
12
|
-
A new user who can immediately run a real, passing test is an activated user; an empty
|
|
13
|
-
project is the #1 drop-off.
|
|
10
|
+
Seed a repo with no tests into a coherent suite and 2–3 passing smoke tests.
|
|
14
11
|
|
|
15
12
|
This skill only uses shipped CLI commands. Do **not** call backend APIs directly.
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
(always works). Everything else here is identical either way.
|
|
14
|
+
For deployed targets, try generation first (V3 required), then author by hand.
|
|
15
|
+
Local projects use authored plans directly; exploration is unavailable.
|
|
20
16
|
|
|
21
17
|
## When to use
|
|
22
18
|
|
|
@@ -32,29 +28,46 @@ Step 3 offers two paths to a suite, tried in order: let TestSprite **generate**
|
|
|
32
28
|
|
|
33
29
|
`testsprite setup` has run (an API key is configured). If `testsprite project list` errors on
|
|
34
30
|
auth, stop and tell the user to run `testsprite setup` first — don't try to configure for them.
|
|
31
|
+
In a sandbox, `testsprite setup --from-env` can use `TESTSPRITE_API_KEY` even when HOME
|
|
32
|
+
is read-only: credential-write permission failures warn and continue session-only.
|
|
33
|
+
The JSON summary has `credentials.persisted: false`; export the key in every invoking
|
|
34
|
+
shell. Agent installation still needs a writable target; `--no-agent` skips it.
|
|
35
35
|
|
|
36
36
|
## Steps
|
|
37
37
|
|
|
38
|
-
### 1. Understand the app
|
|
38
|
+
### 1. Understand the app
|
|
39
39
|
|
|
40
|
-
Read the
|
|
40
|
+
Read the source to identify:
|
|
41
41
|
|
|
42
42
|
- **Frontend**: the deployed/local **URL**, the 4–8 most important user flows (auth, core
|
|
43
43
|
CRUD, checkout, search, settings…), and whether flows need **login**.
|
|
44
44
|
- **Backend**: the key **API endpoints** and their success/error contracts.
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
beats a blind crawl.
|
|
46
|
+
Use code-derived routes/handlers; do not guess.
|
|
48
47
|
|
|
49
|
-
### 2. Create the project
|
|
48
|
+
### 2. Create the project
|
|
50
49
|
|
|
51
|
-
|
|
50
|
+
Deployed frontend:
|
|
52
51
|
|
|
53
52
|
```bash
|
|
54
53
|
testsprite project create --type frontend --name "<repo name>" --url <app-url> \
|
|
55
54
|
[--username <user> --password-file <path-to-secret>]
|
|
56
55
|
```
|
|
57
56
|
|
|
57
|
+
Local frontend (start the app first; V3 required):
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
testsprite project create --type frontend --name "<repo name>" --local <port> --local-host <host>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`--local` stores `http://<host>:<port>`; `--local-host` sets both probe and URL host:
|
|
64
|
+
`localhost`, `127.0.0.1` (default), or `::1` (`http://[::1]:<port>`).
|
|
65
|
+
Reuse the host on runs; omit for default IPv4.
|
|
66
|
+
`project get/list`: JSON `originMode: 'local'`, text `(Local)`.
|
|
67
|
+
No `--url`. Dead port: exit 5 (`--skip-preflight` bypasses).
|
|
68
|
+
V2-only: exit 7 (`local-origin-requires-v3`). Local runs work on Free and need
|
|
69
|
+
`run:tunnel` (mint a new key if missing).
|
|
70
|
+
|
|
58
71
|
Backend:
|
|
59
72
|
|
|
60
73
|
```bash
|
|
@@ -63,9 +76,10 @@ testsprite project create --type backend --name "<repo name>"
|
|
|
63
76
|
|
|
64
77
|
Capture the returned `projectId`.
|
|
65
78
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
79
|
+
For frontend, configure login with
|
|
80
|
+
`--username/--password-file` if needed; the cloud agent logs in through the tunnel
|
|
81
|
+
using the project environment's username/password. OTP environments are refused
|
|
82
|
+
before charge (exit 6).
|
|
69
83
|
|
|
70
84
|
#### 2b. FE: register the app's test-hook attribute
|
|
71
85
|
|
|
@@ -73,19 +87,26 @@ If the source tags elements with something other than `data-testid` (e.g. `data-
|
|
|
73
87
|
run `testsprite project update <projectId> --test-id-attributes data-element,data-testid`
|
|
74
88
|
once; exported locators then use the tag (check: `project get` → `testIdAttrs:`).
|
|
75
89
|
|
|
76
|
-
### 3. Get the tests
|
|
90
|
+
### 3. Get the tests
|
|
91
|
+
|
|
92
|
+
**Local project: go directly to 3b.** Creation does no exploration/generation;
|
|
93
|
+
`test plan generate` is refused before charge (exit 6). Author a plan, then use:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
testsprite test create --plan-from plan.json --project <projectId>
|
|
97
|
+
testsprite test run <testId> --local <port> --local-host <host>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Portal runs are blocked for free until `project update <id> --url https://…` sets
|
|
101
|
+
a public URL. For deployed projects, try 3a first.
|
|
77
102
|
|
|
78
103
|
#### 3a. Preferred: generate → review → accept
|
|
79
104
|
|
|
80
|
-
|
|
81
|
-
repo) and you accept the ones worth keeping.
|
|
105
|
+
Proposals stage on the server for review; no files are written locally.
|
|
82
106
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
shapes the feature map (`--role prd`, 0.5 credits). A PRD alone can charge the strategy
|
|
87
|
-
stage and then fail with no endpoints found. Frontend projects skip this, since exploring
|
|
88
|
-
the live app creates their inputs.
|
|
107
|
+
API projects require an API spec (`no_processed_inputs` without one). An optional
|
|
108
|
+
PRD supplements it (`--role prd`, 0.5 credits); a PRD alone can charge strategy and
|
|
109
|
+
then fail for missing endpoints. Deployed frontend exploration supplies its inputs.
|
|
89
110
|
|
|
90
111
|
```bash
|
|
91
112
|
testsprite project docs upload ./openapi.yaml --project <projectId> --role api-doc
|
|
@@ -96,14 +117,11 @@ testsprite project docs upload ./prd.md --project <projectId> --role prd # opt
|
|
|
96
117
|
testsprite test plan generate --project <projectId>
|
|
97
118
|
```
|
|
98
119
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
Ctrl-C only detaches, the work continues. If it says inputs are still processing, wait
|
|
102
|
-
and re-run.
|
|
120
|
+
Only missing stages run. Frontend exploration can take minutes; Ctrl-C detaches
|
|
121
|
+
while generation continues. If inputs are still processing, wait and re-run.
|
|
103
122
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
doesn't have, duplicating another, or asserting something vague.
|
|
123
|
+
Review titles and steps against the source. Drop nonexistent flows, duplicates,
|
|
124
|
+
and vague assertions before accepting.
|
|
107
125
|
|
|
108
126
|
```bash
|
|
109
127
|
testsprite test plan accept --project <projectId> # all of them
|
|
@@ -114,12 +132,11 @@ A subset accept **discards the rest**, so name every proposal you want in that o
|
|
|
114
132
|
Then `testsprite test list --project <projectId>` for the ids, and go to step 5
|
|
115
133
|
(**skip step 4** — that's the hand-authoring path).
|
|
116
134
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
yourself; don't ask the user to upgrade or migrate first.
|
|
135
|
+
If generation is unavailable (older CLI, non-V3 account/exit 6, or missing inputs),
|
|
136
|
+
report the reason and author tests using 3b. Local-project creation itself still
|
|
137
|
+
requires V3.
|
|
121
138
|
|
|
122
|
-
#### 3b.
|
|
139
|
+
#### 3b. Author the tests by hand
|
|
123
140
|
|
|
124
141
|
**Frontend** — one JSON plan file per flow, in a directory (e.g. `./testsprite-plans/`).
|
|
125
142
|
Each file is a COMPLETE plan and must include `projectId` (from step 2), `type: "frontend"`,
|
|
@@ -146,14 +163,11 @@ Each file is a COMPLETE plan and must include `projectId` (from step 2), `type:
|
|
|
146
163
|
**Backend** — one `.py` file per endpoint, using `requests` with concrete assertions on
|
|
147
164
|
status code and response body.
|
|
148
165
|
|
|
149
|
-
**Backend auth
|
|
150
|
-
|
|
151
|
-
`
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
the configured type (Bearer → `{"Authorization": "Bearer …"}`; API key → `{"X-API-Key": "…"}`;
|
|
155
|
-
basic → `{"Authorization": "Basic …"}`). Spread it into your request headers — never paste a
|
|
156
|
-
literal `Bearer …` / `sk-…` / key value into the script:
|
|
166
|
+
**Backend auth:** read injected `__AUTH_HEADERS__`; never hardcode Bearer/JWT tokens,
|
|
167
|
+
API keys, basic-auth blobs, or cookies. TestSprite injects `__AUTH_CREDENTIAL__`,
|
|
168
|
+
`__AUTH_TYPE__`, and `__AUTH_HEADERS__` from project Authentication settings.
|
|
169
|
+
The headers already match the configured type (Authorization for Bearer/basic,
|
|
170
|
+
X-API-Key for API keys). Spread them into each request:
|
|
157
171
|
|
|
158
172
|
```python
|
|
159
173
|
r = requests.get(f"{TARGET_URL}/orders", headers={**__AUTH_HEADERS__})
|
|
@@ -167,10 +181,8 @@ runs keep working after the token expires. A hardcoded token expires within hour
|
|
|
167
181
|
key can't be rotated centrally — `test create` emits a `[warn]` on an inlined credential; treat it
|
|
168
182
|
as a must-fix.
|
|
169
183
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
`"verify it works"`, `"check the page loads"`, or other narrative that an AI judge can
|
|
173
|
-
rubber-stamp. Vague assertions are how false-PASS sneaks in.
|
|
184
|
+
Each assertion must name an observable element, text, URL, count, or status.
|
|
185
|
+
Avoid "verify it works" or "check the page loads": vague assertions create false passes.
|
|
174
186
|
|
|
175
187
|
Aim for ~8–15 tests covering the core flows. Don't pad.
|
|
176
188
|
|
|
@@ -198,11 +210,16 @@ Pick the **2–3 highest-value happy-path** tests (prefer ones you're most confi
|
|
|
198
210
|
and run only those:
|
|
199
211
|
|
|
200
212
|
```bash
|
|
201
|
-
testsprite test run <testId> --wait
|
|
213
|
+
testsprite test run <testId> --wait # deployed target
|
|
214
|
+
testsprite test run <testId> --local <port> --local-host <host> # local frontend
|
|
202
215
|
```
|
|
203
216
|
|
|
204
|
-
Do **not** run the whole suite automatically
|
|
205
|
-
|
|
217
|
+
Do **not** run the whole suite automatically. V3 frontend runs, including local runs,
|
|
218
|
+
cost 0.5 credit each; check `testsprite usage` before sizing the suite.
|
|
219
|
+
Local runs imply waiting (1200 seconds by default); one test per invocation, parallel
|
|
220
|
+
invocations allowed, 5 live tunnel bindings per user. Keep the early stderr `Run <runId>`
|
|
221
|
+
receipt. An owned local timeout cancels by default: start a new run with
|
|
222
|
+
`--local <port> --local-host <host> --timeout 1800` (same host), not `test wait`. A run cancelled before it finished is refunded.
|
|
206
223
|
|
|
207
224
|
### 6. Report
|
|
208
225
|
|
|
@@ -211,13 +228,13 @@ Tell the user, plainly:
|
|
|
211
228
|
- "Your project now has **N** tests covering: <list the flows>."
|
|
212
229
|
- "I smoke-ran **M** — here's the result: <pass/fail + the dashboard link from the run output>."
|
|
213
230
|
- "To run the rest (≈X credits — state the cost so they choose knowingly):
|
|
214
|
-
- frontend —
|
|
215
|
-
|
|
231
|
+
- frontend — use `test run <testId> --wait` for deployed targets or
|
|
232
|
+
`test run <testId> --local <port> --local-host <host>` for local targets (`--all --local` is refused);
|
|
216
233
|
- backend — `testsprite test run --all --project <id>` (wave-ordered, runs every BE test)."
|
|
217
234
|
|
|
218
235
|
## Quality checklist (self-check before reporting done)
|
|
219
236
|
|
|
220
|
-
- [ ] FE project has a
|
|
237
|
+
- [ ] FE project has a public `--url` or uses `--local`; login configured if needed.
|
|
221
238
|
- [ ] API project: an API spec uploaded before generating (a PRD is optional, alongside it) — or you used path 3b.
|
|
222
239
|
- [ ] If you generated: you **read the proposals** and dropped the ones that don't fit,
|
|
223
240
|
rather than accepting the batch unseen.
|
|
@@ -231,7 +248,7 @@ Tell the user, plainly:
|
|
|
231
248
|
- Don't auto-run the full suite (credit wall / surprise 402).
|
|
232
249
|
- Don't write narrative assertions an AI judge can't fail.
|
|
233
250
|
- Don't call backend endpoints directly — only the `testsprite` CLI.
|
|
234
|
-
- Don't create a FE project without
|
|
251
|
+
- Don't create a FE project without public `--url` or `--local <port>`.
|
|
235
252
|
- Don't re-seed a project that already has tests — that's not this skill's job.
|
|
236
253
|
- Don't accept a generated batch unread — reviewing it is the point of the staging step.
|
|
237
254
|
- Don't stall when generation isn't available — say so and hand-author instead.
|
|
@@ -240,6 +257,4 @@ Tell the user, plainly:
|
|
|
240
257
|
|
|
241
258
|
## Hand off to verify
|
|
242
259
|
|
|
243
|
-
|
|
244
|
-
the **`testsprite-verify`** skill takes over: after the user changes code, it runs the tests
|
|
245
|
-
covering that change before they report the work done. Onboard once; verify continuously.
|
|
260
|
+
After seeding and a first green run, hand off to `testsprite-verify` for subsequent changes.
|
|
@@ -1,133 +1,118 @@
|
|
|
1
1
|
# TestSprite Verification Loop
|
|
2
2
|
|
|
3
|
-
After
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
docs/config and is about to be reported complete.
|
|
3
|
+
After a feature/fix, run relevant tests and inspect failures before reporting done.
|
|
4
|
+
Skip docs-only/build-config edits. Missing credentials mean unverified.
|
|
5
|
+
Honor the user's explicit choice of CLI or MCP.
|
|
7
6
|
|
|
8
|
-
##
|
|
7
|
+
## 1. Preflight and project
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
machine via `--local <port>` (tunnels `localhost`/`127.0.0.1`/`::1` only; needs
|
|
15
|
-
a key with the `run:tunnel` scope — 403 there means mint a new key; a backend
|
|
16
|
-
test's target is baked into its code, so it can't use `--local`). If the user
|
|
17
|
-
named a tool (the CLI or the MCP), honor that even when both could apply.
|
|
9
|
+
```bash
|
|
10
|
+
testsprite --version
|
|
11
|
+
testsprite auth status
|
|
12
|
+
```
|
|
18
13
|
|
|
19
|
-
|
|
14
|
+
If missing, tell the user to install the CLI or run `testsprite setup` respectively.
|
|
15
|
+
Resolve the project from `$TESTSPRITE_PROJECT_ID`, `.testsprite/config.json`, then
|
|
16
|
+
`testsprite project list --output json`; ask if multiple projects match.
|
|
20
17
|
|
|
21
|
-
|
|
18
|
+
For a local app with no project, start it and bootstrap:
|
|
22
19
|
|
|
23
20
|
```bash
|
|
24
|
-
testsprite --
|
|
25
|
-
testsprite
|
|
21
|
+
testsprite project create --type frontend --name "<repo name>" --local <port> --local-host <host>
|
|
22
|
+
testsprite test create --plan-from plan.json --project <projectId>
|
|
23
|
+
testsprite test run <test-id> --local <port> --local-host <host> --output json
|
|
26
24
|
```
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
Local projects need V3 (V2-only: exit 7, `local-origin-requires-v3`). They skip
|
|
27
|
+
exploration; `test plan generate` is refused before charge (exit 6). Author plans
|
|
28
|
+
with `test create --plan-from` without `--run`, then run each id with `--local`.
|
|
29
|
+
Portal runs are blocked for free until `project update <id> --url https://…` sets
|
|
30
|
+
a public URL. Deployed projects retain `project create --url`; an empty deployed
|
|
31
|
+
suite can use `test plan generate --project <id>` then `test plan accept`.
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
## 2. Run against the change
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
Reuse a test covering the change or create one. Public `--target-url` must contain
|
|
36
|
+
the new deployment. The CLI does not build/host apps. For local-only changes use
|
|
37
|
+
`testsprite test run <test-id> --local <port>` (frontend only).
|
|
36
38
|
|
|
37
39
|
```bash
|
|
38
|
-
#
|
|
40
|
+
# Deployed frontend: create + run, or run an existing test
|
|
39
41
|
testsprite test create --plan-from plan.json --run --wait \
|
|
40
42
|
--target-url https://staging.example.com --timeout 600 --output json
|
|
41
|
-
|
|
42
|
-
# Existing test
|
|
43
43
|
testsprite test run <test-id> --target-url https://staging.example.com \
|
|
44
44
|
--wait --timeout 600 --output json
|
|
45
|
-
|
|
46
|
-
# New backend test from Python assertion file
|
|
45
|
+
# Backend Python assertion
|
|
47
46
|
testsprite test create --type backend --name "Login rejects empty password" \
|
|
48
47
|
--project <id> --code-file /tmp/test.py --run --wait --timeout 600
|
|
49
|
-
|
|
50
|
-
# Replay (cheaper than a fresh run — reuses saved test code)
|
|
48
|
+
# Deployed replay (V3 FE: 0.5 credit)
|
|
51
49
|
testsprite test rerun <test-id> --wait --output json
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
# the wave engine orders runs (producers → consumers → teardown last)
|
|
55
|
-
testsprite test create --type backend --project <id> --code-file /tmp/login.py \
|
|
56
|
-
--name "login issues an auth token" --produces auth_token
|
|
57
|
-
testsprite test create --type backend --project <id> --code-file /tmp/profile.py \
|
|
58
|
-
--name "profile update accepts the token" --needs auth_token
|
|
59
|
-
testsprite test create --type backend --project <id> --code-file /tmp/cleanup.py \
|
|
60
|
-
--name "fixture user is deleted" --category teardown
|
|
61
|
-
|
|
62
|
-
# Wave-ordered batch fresh run (BE tests, all or filtered)
|
|
63
|
-
testsprite test run --all --project <id> [--filter <substr>] \
|
|
64
|
-
--wait --max-concurrency 4 --output json
|
|
50
|
+
# Dependency batch; optional --filter <substring>
|
|
51
|
+
testsprite test run --all --project <id> --wait --max-concurrency 4 --output json
|
|
65
52
|
```
|
|
66
53
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
54
|
+
- Local runs need `run:tunnel`; keys minted before that scope existed must be
|
|
55
|
+
replaced if the CLI names it as missing (exit 3). Free-plan local runs work;
|
|
56
|
+
a V3 frontend run costs 0.5 credit. Backend tests cannot use `--local`.
|
|
57
|
+
- `--local` implies `--wait`; timeout defaults to 1200 seconds, ordinary waits
|
|
58
|
+
to 600. `--local-host` accepts `localhost`, `127.0.0.1` (default), or `::1`.
|
|
59
|
+
A dead port exits 5 before charge; `--skip-preflight` bypasses the probe.
|
|
60
|
+
Public `--target-url` rejects localhost/private addresses and excludes `--local`.
|
|
61
|
+
- One test per local invocation; parallel invocations are fine. `--all --local`
|
|
62
|
+
exits 5. A user has 5 live tunnel bindings; `tunnel_binding_limit` is exit 11,
|
|
63
|
+
not auto-retried. Stop an unused tunnel or reuse one with `--tunnel-client`.
|
|
64
|
+
- Keep the early **stderr** `Run <runId>` receipt, emitted after triggering;
|
|
65
|
+
`Dashboard: <url>` follows when supplied. Stdout remains the JSON result channel.
|
|
66
|
+
- An **owned** local timeout, Ctrl-C, or polling failure cancels the run by
|
|
67
|
+
default and closes the tunnel. Check the reported cancellation outcome.
|
|
68
|
+
A run cancelled before it finished is refunded. `--no-cancel-on-interrupt`
|
|
69
|
+
detaches instead, but the owned tunnel still closes and the run remains billable.
|
|
70
|
+
- Owned local timeout: start a **new**
|
|
71
|
+
`testsprite test run <test-id> --local <port> --timeout 1800`,
|
|
72
|
+
keeping `--local-host <host>` if used. `test wait` cannot reopen the tunnel.
|
|
73
|
+
Ordinary/adopted waits can resume with `testsprite test wait <run-id>`
|
|
74
|
+
while the target is reachable.
|
|
75
|
+
- `tunnel start` (no port) holds a tunnel in a terminal; keep it alive.
|
|
76
|
+
Borrow via `--local <port> --tunnel-client <uuid>`; no automatic cancel or close.
|
|
77
|
+
A second `tunnel start`/process using the same credential takes over; the first exits **10**.
|
|
78
|
+
- A case last run through a tunnel stays local: later Portal Run, schedules, or
|
|
79
|
+
bare CLI runs are free BLOCKED (`tunnel-required`, exit 6). Use `--local` again
|
|
80
|
+
or explicitly retarget with public `--target-url`. V3 local runs use the agent
|
|
81
|
+
path, never saved-code replay, and preserve saved code.
|
|
82
|
+
- `--wait` handles polling/backoff; do not wrap it in a retry loop.
|
|
83
|
+
- Backend Python runs top-to-bottom, not via pytest: call your `test_*` functions.
|
|
84
|
+
The sandbox has stdlib, `requests`, `pytest`, `numpy`, and `scipy`; use HTTP,
|
|
85
|
+
not imports from the project's source or uninstalled packages.
|
|
86
|
+
- Backend `--produces`/`--needs` are repeatable; `--category teardown` marks cleanup.
|
|
87
|
+
Set dependencies with `test create` or edit with `test update`; do not delete
|
|
88
|
+
and recreate. Use `test run --all` for producer → consumer → teardown ordering
|
|
89
|
+
and variable passing. A BE `test rerun` includes that closure and its side effects;
|
|
90
|
+
`--skip-dependencies` selects only the named test. Triage failed producers before
|
|
91
|
+
blaming consumers starved of their token/fixture.
|
|
92
|
+
|
|
93
|
+
## 3. Inspect and report
|
|
91
94
|
|
|
92
95
|
```bash
|
|
93
96
|
testsprite test artifact get <run-id> --out ./.testsprite/runs/<run-id>/
|
|
97
|
+
testsprite test steps <test-id> --run-id <run-id> --output json
|
|
94
98
|
```
|
|
95
99
|
|
|
96
|
-
|
|
97
|
-
|
|
100
|
+
Read the failing step, screenshots and root cause. Bare `test steps <test-id>`
|
|
101
|
+
means the latest run's steps; pin the receipt's
|
|
102
|
+
run id. An empty latest run does not substitute earlier steps; choose an earlier
|
|
103
|
+
id from `test result <test-id> --history`. Report the verdict and dashboard link.
|
|
98
104
|
|
|
99
|
-
|
|
105
|
+
Exits: 0 passed; 1 failed/blocked/cancelled; 3 auth/scope; 4 not found;
|
|
106
|
+
5 validation; 6 conflict/precondition; 7 timeout/unsupported; 10 unavailable;
|
|
107
|
+
11 rate limited; 12 insufficient credits.
|
|
100
108
|
|
|
101
|
-
|
|
109
|
+
## Dry-run and setup
|
|
110
|
+
|
|
111
|
+
`--dry-run` works without credentials:
|
|
102
112
|
|
|
103
113
|
```bash
|
|
104
114
|
testsprite test run <test-id> --dry-run --output json
|
|
105
115
|
testsprite test create --plan-from plan.json --dry-run --output json
|
|
106
116
|
```
|
|
107
117
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
| Code | Meaning |
|
|
111
|
-
| ---- | ------------------------------------------------- |
|
|
112
|
-
| 0 | Success (passed) |
|
|
113
|
-
| 1 | Failed / blocked / cancelled |
|
|
114
|
-
| 3 | Auth error |
|
|
115
|
-
| 4 | Not found |
|
|
116
|
-
| 5 | Validation error |
|
|
117
|
-
| 6 | Conflict (already running) |
|
|
118
|
-
| 7 | Timeout — resume: `testsprite test wait <run-id>` |
|
|
119
|
-
| 11 | Rate limited (retriable) |
|
|
120
|
-
| 12 | Insufficient credits |
|
|
121
|
-
|
|
122
|
-
## Bootstrap (first-time setup)
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
npm install -g @testsprite/testsprite-cli
|
|
126
|
-
testsprite setup # configure + verify + install agent skill in one shot
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
Verify your setup anytime: `testsprite auth status`.
|
|
130
|
-
|
|
131
|
-
Project with **no tests at all**? Seed a suite first — that's setup, not verification.
|
|
132
|
-
`testsprite test plan generate --project <id>` proposes cases and `test plan accept`
|
|
133
|
-
promotes them; or author plans by hand.
|
|
118
|
+
Setup: `npm install -g @testsprite/testsprite-cli`, then `testsprite setup`.
|