@testsprite/testsprite-cli 0.9.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 +64 -41
- 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 +30 -0
- package/dist/commands/project.js +193 -27
- 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/dry-run/samples.js +16 -9
- 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 +80 -59
- package/skills/testsprite-verify.codex.md +82 -97
- package/skills/testsprite-verify.skill.md +67 -16
|
@@ -28,7 +28,8 @@ machine's own loopback address (`localhost` / `127.0.0.1` / `::1` — not a LAN
|
|
|
28
28
|
or RFC1918 address, and not a general local-network escape hatch) to the test
|
|
29
29
|
runner. Two constraints: frontend tests only (a backend test's target is baked
|
|
30
30
|
into its generated code, so run it normally), and it needs an API key with the
|
|
31
|
-
`run:tunnel` scope
|
|
31
|
+
`run:tunnel` scope. Keys minted before that scope existed must be replaced;
|
|
32
|
+
the CLI names the missing scope (exit 3).
|
|
32
33
|
|
|
33
34
|
If the user explicitly named a tool (the CLI or the MCP), honor that choice
|
|
34
35
|
regardless of which one the change's reachability would otherwise suggest.
|
|
@@ -40,8 +41,9 @@ The skip list is narrow:
|
|
|
40
41
|
- Docs-only edits (`docs/**`, `*.md`, comments).
|
|
41
42
|
- Pure build/config edits (`tsconfig*`, lint/prettier config, lockfile bumps with
|
|
42
43
|
no behavior change).
|
|
43
|
-
-
|
|
44
|
-
|
|
44
|
+
- Credentials are unavailable. Explain the missing setup; do not claim a
|
|
45
|
+
verified result. If credentials exist but a local project is missing, use
|
|
46
|
+
the bootstrap below.
|
|
45
47
|
|
|
46
48
|
Otherwise, run it.
|
|
47
49
|
|
|
@@ -62,8 +64,8 @@ What does **not** count: unit tests / typecheck / lint; drafting a plan without
|
|
|
62
64
|
|
|
63
65
|
If the project has **no tests at all**, that's the `testsprite-onboard` skill's
|
|
64
66
|
job, not this one — seed a suite first (it can generate the proposals for you
|
|
65
|
-
with `testsprite test plan generate` / `test plan accept
|
|
66
|
-
|
|
67
|
+
with `testsprite test plan generate` / `test plan accept` for a deployed target;
|
|
68
|
+
local projects require authored plans and `test create --plan-from`). Seeding is a deliberate setup pass, not part of the verify loop.
|
|
67
69
|
|
|
68
70
|
If you can't satisfy this — no creds, no valid target URL, repo not linked —
|
|
69
71
|
**say so explicitly**: "Feature shipped but I could not run any TestSprite test
|
|
@@ -92,6 +94,25 @@ In priority order:
|
|
|
92
94
|
4. Still ambiguous → list the candidates and ask the user which to use (one short
|
|
93
95
|
question; picking the wrong project wastes a run).
|
|
94
96
|
|
|
97
|
+
If no project exists for an app running only locally, bootstrap a frontend project
|
|
98
|
+
(V3 required), author a plan, and run the returned test id:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
testsprite project create --type frontend --name "<repo name>" --local <port> --local-host <host>
|
|
102
|
+
testsprite test create --plan-from plan.json --project <projectId>
|
|
103
|
+
testsprite test run <test-id> --local <port> --local-host <host> --output json
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Keep the app listening and use the same `--local-host` for creation and follow-up
|
|
107
|
+
runs. It selects both the probe and stored URL host: `localhost`, `127.0.0.1`
|
|
108
|
+
(default), or `::1`; omit it in both commands to use the default.
|
|
109
|
+
The port probe fails with exit 5 if nothing listens (`--skip-preflight`
|
|
110
|
+
bypasses it). Local projects skip exploration: `test plan generate` is refused
|
|
111
|
+
before charge (exit 6), so use `test create --plan-from` without `--run`, then
|
|
112
|
+
`test run --local`. V2-only local-project creation is unsupported (exit 7).
|
|
113
|
+
Portal runs are blocked for free until `project update <id> --url https://…`
|
|
114
|
+
sets a public URL. Keep the existing `--url` / `--target-url` flow for deployed apps.
|
|
115
|
+
|
|
95
116
|
## 3. Decide what to test
|
|
96
117
|
|
|
97
118
|
Look at the diff (`git diff --stat`, then the changed files) to understand what
|
|
@@ -261,7 +282,11 @@ confidently-wrong `passed` (bare visibility assertions) or a thrashing
|
|
|
261
282
|
- **Describe outcomes, not selectors.** The testing agent locates targets
|
|
262
283
|
semantically — describe the intent and the match stays robust across copy
|
|
263
284
|
changes; a guessed literal label defeats that. E.g. write `"Submit the form"`,
|
|
264
|
-
not `"Click the blue 'Submit' button"`.
|
|
285
|
+
not `"Click the blue 'Submit' button"`. If the app tags elements with its own
|
|
286
|
+
attribute (`data-element`, `data-cy`, …), make sure the project knows —
|
|
287
|
+
`testsprite project get <projectId>` shows `testIdAttrs:`; set it once with
|
|
288
|
+
`project update <projectId> --test-id-attributes <attr>,data-testid` — and the
|
|
289
|
+
exported code will locate tagged elements by that attribute instead of text.
|
|
265
290
|
- **`Navigate to` only on step 1** (or a login page). Use clicks for every later
|
|
266
291
|
transition — direct URLs break SPA routing.
|
|
267
292
|
- **FE plans narrate a user journey through their actions.** Each action is
|
|
@@ -341,14 +366,17 @@ Batch is **FE-only.** For 3 backend tests, run `test create --type backend
|
|
|
341
366
|
|
|
342
367
|
## 4. Run
|
|
343
368
|
|
|
344
|
-
|
|
345
|
-
|
|
369
|
+
For a deployed target, use `--target-url <env-url> --wait --timeout 600` after
|
|
370
|
+
that deployment contains the change. For a change running only on this machine,
|
|
371
|
+
use `testsprite test run <test-id> --local <port>` (frontend only); it implies
|
|
372
|
+
waiting and defaults to 1200 seconds. Create a missing test from a plan first,
|
|
373
|
+
without `--run`, then run its id with `--local`.
|
|
346
374
|
|
|
347
375
|
```bash
|
|
348
376
|
# (a) existing test
|
|
349
377
|
testsprite test run <test-id> --target-url <env-url> --wait --timeout 600 --output json
|
|
350
378
|
|
|
351
|
-
# (a-rerun)
|
|
379
|
+
# (a-rerun) replay of a deployed test (V3 FE: 0.5 credit). Replays saved code (auto-heal on — more
|
|
352
380
|
# lenient than a fresh run; for strict verification of a new change prefer `test run`).
|
|
353
381
|
# BE: dispatches the WHOLE dependency closure — producers and teardowns run too, not just <test-id>,
|
|
354
382
|
# so expect their side effects (fixtures re-created, teardown deletes) and extra runs in history.
|
|
@@ -391,11 +419,31 @@ Key behaviors:
|
|
|
391
419
|
only, see "When to run" above) — don't skip the run over this.
|
|
392
420
|
- `--wait` long-polls until terminal and handles its own backoff — don't wrap it
|
|
393
421
|
in a retry loop.
|
|
394
|
-
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
422
|
+
- `--local` implies `--wait`, with a default timeout of 1200 seconds (ordinary
|
|
423
|
+
waits default to 600). Run one frontend test per invocation; parallel
|
|
424
|
+
invocations are fine, but `--all --local` is refused (exit 5). There are
|
|
425
|
+
5 live tunnel bindings per user; `tunnel_binding_limit` is exit 11 and is not
|
|
426
|
+
auto-retried. Reuse a live tunnel with `--tunnel-client` or stop an unused one.
|
|
427
|
+
- Keep the early `Run <runId>` line on **stderr**, emitted as soon as the trigger
|
|
428
|
+
returns; `Dashboard: <url>` follows when supplied. Preserve the id even if
|
|
429
|
+
the wait later stops; stdout remains the normal JSON result channel.
|
|
430
|
+
- An **owned** local run is cancelled by default when waiting stops (timeout,
|
|
431
|
+
Ctrl-C, or a polling failure), then its tunnel closes. Read the reported
|
|
432
|
+
cancellation outcome. A run cancelled before it finished is refunded.
|
|
433
|
+
`--no-cancel-on-interrupt` detaches instead, but the owned tunnel still closes.
|
|
434
|
+
A borrower using `--tunnel-client` never automatically cancels its run or
|
|
435
|
+
closes the adopted tunnel; its owner must remain running.
|
|
436
|
+
A second `tunnel start` or process using the same credential takes over, and the first exits **10**.
|
|
437
|
+
- Exit codes: `0` = passed; `1` = failed / blocked / cancelled; `7` = timeout
|
|
438
|
+
or unsupported. An owned local timeout is inconclusive: start a **new**
|
|
439
|
+
`testsprite test run <test-id> --local <port> --timeout 1800`, keeping the same
|
|
440
|
+
`--local-host <host>` if used; do not suggest `test wait` for that closed tunnel. Resume **ordinary or adopted-tunnel**
|
|
441
|
+
waits with `testsprite test wait <run-id>` only while the target is reachable
|
|
442
|
+
(and the adopted tunnel's owner remains alive).
|
|
443
|
+
- A case last run through a tunnel stays local: a later Portal Run, schedule,
|
|
444
|
+
or bare CLI run is a free BLOCKED (`tunnel-required`, exit 6). Use `--local`
|
|
445
|
+
again or explicitly retarget with a public `--target-url`. V3 local runs use
|
|
446
|
+
the agent path, never saved-code replay, and preserve the test's saved code.
|
|
399
447
|
- Batch: `create-batch --run --wait` creates the tests (FE-only) and fans
|
|
400
448
|
out triggers in one call (bounded by `--max-concurrency`), emitting
|
|
401
449
|
`{ results: [...] }` that mirrors the single-test `test run --wait`
|
|
@@ -445,8 +493,11 @@ The product/environment is the problem (believe these) when:
|
|
|
445
493
|
read-only", "page 404s");
|
|
446
494
|
- the trace blames infra (deploy lag, auth gate, missing fixture).
|
|
447
495
|
|
|
448
|
-
|
|
449
|
-
|
|
496
|
+
`test steps <test-id>` shows the **latest run's steps**. For the run you are
|
|
497
|
+
verifying, use `testsprite test steps <test-id> --run-id <run-id> --output json`
|
|
498
|
+
with the id from the early stderr receipt. An empty latest run is not evidence
|
|
499
|
+
from an earlier run; use `test result <test-id> --history` to choose one explicitly.
|
|
500
|
+
Older backends may return cumulative bare steps; pin `--run-id` before counting.
|
|
450
501
|
|
|
451
502
|
**Read the testing agent's failure summary skeptically — it can conflate two
|
|
452
503
|
failure phases.** When a flow produces an artifact that then runs against an external
|