mirror of
https://github.com/tester-army/e2e.git
synced 2026-11-24 01:50:04 +08:00
`e2e run --repeat-each <n>` (`RunOptions.repeatEach`) runs every selected test that many times. The repeat is a dimension of a pair's identity beside the test, the target, and the agent: `TestTargetPair.repeat`, the wire pair, the pair-start and progress messages, the scheduler's keys, and the report result and serial group all carry it, 0 for the run every test has. The first run's result id is unchanged; later runs get their own, the list reporter, JUnit, and the failure pages title them `(repeat #n)`, and their artifacts go under `repeat-<n>`. Setup tests run once; a filtered or skipped pair is reported once. Run events `test-started` and `step` carry `repeat`. `--last-failed` now keys the previous run's results by test, target, and agent, so a test is named once whichever of its repeats did not pass.
479 lines
27 KiB
Plaintext
479 lines
27 KiB
Plaintext
---
|
||
title: CLI
|
||
description: Commands, flags, output formats, and exit codes.
|
||
---
|
||
|
||
```bash
|
||
npx e2e init [directory]
|
||
npx e2e login [provider]
|
||
npx e2e logout [provider]
|
||
npx e2e guide [topic]
|
||
npx e2e mcp [options]
|
||
npx e2e run [files...] [options]
|
||
npx e2e explore [goal] [options]
|
||
npx e2e list [files...] [options]
|
||
npx e2e cache ls|clear|stats [--config <path>]
|
||
npx e2e telemetry [status|enable|disable]
|
||
npx e2e --help
|
||
npx e2e --version
|
||
```
|
||
|
||
The CLI needs Node.js 22.12 or newer.
|
||
|
||
## Help and version
|
||
|
||
| Flag | Behavior |
|
||
| --- | --- |
|
||
| `-h`, `--help` | Prints the help of the command it follows and exits 0. `e2e help run` is the same as `e2e run --help`. |
|
||
| `-v`, `--version` | Prints the installed `e2e` version and exits 0. |
|
||
|
||
```console
|
||
$ npx e2e --version
|
||
0.11.0
|
||
```
|
||
|
||
Output is colored on a terminal or in CI, plain when piped or when `NO_COLOR`
|
||
is set. `FORCE_COLOR` keeps the colors. `e2e` without a command prints the
|
||
help on stderr and exits 2.
|
||
|
||
## e2e init
|
||
|
||
Scaffolds a project and adds `e2e` to `devDependencies`. Existing
|
||
config and test files are skipped. With a `directory` argument the project is
|
||
scaffolded there.
|
||
|
||
For a new project, the wizard asks you to choose:
|
||
|
||
- The engine. **Web** (Playwright, the default) adds `@e2edev/web`.
|
||
**Mobile (iOS/Android)** adds `@e2edev/mobile`, defaults to iOS on
|
||
macOS and Android elsewhere, and opens Settings. **None** adds nothing.
|
||
- A model provider or subscription for agent steps. Choose Vercel AI Gateway,
|
||
OpenRouter, an OpenAI-compatible endpoint, ChatGPT, GitHub Copilot, or
|
||
SuperGrok. Choose None for tests that only use locators. The wizard adds
|
||
the required packages and model config. Subscription users then sign in
|
||
with `e2e login`. See [Models](/models) and [Subscriptions](/subscriptions).
|
||
- Where to install the agent skill (see [e2e guide](#e2e-guide)):
|
||
`.agents/skills/` for Codex, Cursor, Copilot, Gemini CLI, OpenCode, and
|
||
Zed, and `.claude/skills/` for Claude Code. Both are preselected.
|
||
- Where to register the [MCP server](/reference/mcp): `.mcp.json` for
|
||
Claude Code and `.cursor/mcp.json` for Cursor. Both are preselected.
|
||
|
||
After confirming the file changes, choose whether to install the selected
|
||
dependencies. The installer follows the project's `packageManager` field or
|
||
lockfile, then the invoking package manager, then npm.
|
||
|
||
| Argument or flag | Type | Default | Behavior |
|
||
| --- | --- | --- | --- |
|
||
| `[directory]` | path | the working directory | Where to scaffold; created when missing |
|
||
| `-y`, `--yes` | boolean | `false` | Uses the Web engine and Vercel AI Gateway, installs the skill and MCP config in both locations, and skips dependency installation |
|
||
|
||
| Creates | Content |
|
||
| --- | --- |
|
||
| `package.json` | Created as a private ESM package when missing; otherwise only missing dependencies and scripts are added. Sibling packages (`@e2edev/web`, `@e2edev/mobile`) get the caret range of the version released with the CLI, or that exact version when the CLI is a prerelease. A `test:e2e` script runs `e2e run` unless one exists |
|
||
| `e2e.config.ts` | One target for the selected engine. Playwright reads `APP_URL` (default `http://localhost:3000`) and shows the `command` option in a comment. With a gateway, `agents.default` is `createAgent({ model, system })` |
|
||
| `tests/example.e2e.ts` | An app-open test that passes against any page, plus a commented agent test. Device setup gets a Settings check instead |
|
||
| `.gitignore` | Appends `node_modules/`, `.e2e/artifacts/`, `.e2e/cache/`, `.e2e/sessions/`, `.e2e/report.json`, `.e2e/ai-trace.json`, `.e2e/junit.xml`, `.e2e/summary.md`, `.e2e/failures/`, and `.e2e/logs/`. Committing the cache is opt-in; see [commit your traces](/cache#commit-your-traces) |
|
||
| `.agents/skills/e2e/`, `.claude/skills/e2e/` | `SKILL.md` and one `references/<topic>.md` per `e2e guide` topic |
|
||
| `.mcp.json`, `.cursor/mcp.json` | Registers `e2e mcp` without changing other servers |
|
||
|
||
```bash
|
||
npx e2e init --yes
|
||
```
|
||
|
||
Re-running `init` keeps an existing config and adds no packages for it. Once
|
||
a skill directory exists, later runs refresh copies that differ from the
|
||
installed version and never add a directory the project did not choose.
|
||
|
||
Cancellation leaves files untouched and exits 0. An invalid `package.json`
|
||
exits 2 before any write. Without a terminal on stdin and stdout, `init`
|
||
without `--yes` exits 2 and names the flag.
|
||
|
||
## e2e login
|
||
|
||
```bash
|
||
npx e2e login openai # ChatGPT, browser sign-in
|
||
npx e2e login openai --device # sign in with a device code
|
||
npx e2e login github-copilot --from-gh # use your GitHub CLI login
|
||
npx e2e login github-copilot --client-id <id> [--enterprise-url <host>]
|
||
npx e2e login spacexai # SuperGrok, device code
|
||
npx e2e login # choose a provider
|
||
```
|
||
|
||
Signs in to a subscription and stores credentials in
|
||
`~/.config/e2e/oauth.json`. A failed or cancelled sign-in exits 1; an unknown
|
||
provider exits 2. See [Subscriptions](/subscriptions) for model configuration.
|
||
|
||
## e2e logout
|
||
|
||
```bash
|
||
npx e2e logout # pick one of the stored logins
|
||
npx e2e logout openai # forget one
|
||
```
|
||
|
||
## e2e models
|
||
|
||
```bash
|
||
npx e2e models # every stored login
|
||
npx e2e models openai # one provider
|
||
```
|
||
|
||
Asks the vendor which models the stored login serves and prints one line per
|
||
model: the id `chatgpt()`, `copilot()`, or `grok()` takes, the vendor's name
|
||
for it, and its notes (reasoning levels, vision, preview, hidden). Without a
|
||
stored login, or when the named provider has none, exits 1 with the sign-in
|
||
command; when one of several logins fails to list, the others still print and
|
||
the command exits 1. An unknown provider exits 2. See
|
||
[Pick a model](/subscriptions#pick-a-model).
|
||
|
||
## e2e guide
|
||
|
||
```bash
|
||
npx e2e guide # the overview
|
||
npx e2e guide setup # one topic
|
||
```
|
||
|
||
Prints the skill that `init` installs. `guide` alone prints the overview;
|
||
`guide <topic>` prints one of `setup`, `writing-tests`, `agent`, `running`,
|
||
`explore`, `debugging`, or `mcp`. An unknown topic exits 2 and names the
|
||
valid ones. The same skill installs with `npx skills add tester-army/e2e`.
|
||
See [Coding agents](/coding-agents).
|
||
|
||
## e2e mcp
|
||
|
||
```bash
|
||
npx e2e mcp [--config <path>] [--target <name>] [--headless]
|
||
```
|
||
|
||
An MCP server on stdio that gives a coding agent a live session on the app.
|
||
Flags, tools, and session rules are on the [MCP server](/reference/mcp) page.
|
||
|
||
## e2e run
|
||
|
||
### Positional arguments
|
||
|
||
```bash
|
||
e2e run [files...]
|
||
```
|
||
|
||
Test files, directories, or globs relative to the project root:
|
||
|
||
- a file path (`tests/signup.e2e.ts`) selects that file;
|
||
- a directory (`tests/agent`, `.`) selects every discovered test file beneath
|
||
it;
|
||
- a bare name selects every discovered file whose path ends with it at a
|
||
segment boundary. `signup.e2e.ts` and `agent/signup.e2e.ts` both select
|
||
`tests/agent/signup.e2e.ts`. Without a `/` or `.` it matches the file name
|
||
with extensions dropped, so `signup` selects it too;
|
||
- any of these with `:line` appended (`tests/signup.e2e.ts:12`, `signup:12`)
|
||
selects only the test declared at that line of each file it names: the line
|
||
the `test(` call opens on, as an editor or a report's `source` shows it. A
|
||
serial group runs whole when a line names one member. Several lines of one
|
||
file add up; naming the file without a line selects it whole. When no test
|
||
is declared at a named line, `NO_TESTS` names the positional and the lines
|
||
the file declares tests at. A positional that exists on disk as written is
|
||
a path, even when its name ends in `:12`;
|
||
- a glob (`'tests/**/*.smoke.e2e.ts'`, quoted) uses the grammar of the config
|
||
`tests` globs: `*`, `?`, and a whole `**` segment. Braces, character
|
||
classes, and extglobs are `INVALID_GLOB` with a hint rather than a pattern
|
||
that matches nothing: there is no expansion, so name one glob per
|
||
alternative. `./`, `..`, a trailing `/`, and an absolute path inside the
|
||
project resolve as they do for any positional path, and an existing file or
|
||
directory is selected by its path whatever its name is spelled with.
|
||
|
||
Positionals narrow the config globs and the tag, platform, and capability
|
||
filters; they never bypass them. Names and globs are case-sensitive on every
|
||
OS. A path outside the project root is `COLLECTION_ERROR`.
|
||
|
||
The runner imports every discovered test file, even when you select only a
|
||
few. This lets a selected test find its session setup in another file.
|
||
Other ordinary tests remain unselected, but a collection error in any file
|
||
still fails the run.
|
||
|
||
A positional starting with `-` that names no file is a usage error, exit 2.
|
||
This is what `pnpm test:e2e -- --headed` produces: the `--` reaches e2e and
|
||
`--headed` would otherwise be taken for a file. The message names the direct
|
||
form, `pnpm exec e2e run --headed`.
|
||
|
||
When nothing is left to run, `NO_TESTS` names the cause: no file matched the
|
||
globs (with look-alike files such as `tests/login.test.ts`), a positional
|
||
matched nothing (with the nearest path), a matched file registered no tests,
|
||
or every test was filtered out.
|
||
|
||
### Flags
|
||
|
||
| Flag | Type | Default | Behavior |
|
||
| --- | --- | --- | --- |
|
||
| `--config <path>` | string | discovered | Explicit config path. A missing file is `CONFIG_NOT_FOUND`. |
|
||
| `--target <ids>` | comma-separated or repeated | every configured target | Selects targets by name. Only selected targets start app commands and services. An unknown ID is `UNKNOWN_TARGET`. |
|
||
| `--tag <tags>` | comma-separated or repeated | none | Only tests carrying the tags: any of them, or every one with `--tag-mode all`. When the filter leaves nothing to run, `NO_TESTS` counts the tests it filtered, marks each tag no test declares, and names the nearest declared one. |
|
||
| `--tag-mode <mode>` | `any` or `all` | `any` | How several tags combine: any of them, or every one. |
|
||
| `--exclude-tag <tags>` | comma-separated or repeated | none | Leaves out every test carrying any of the tags, whatever `--tag` or a positional selected. A serial group still runs whole when any member is selected; tag the serial `describe` to exclude the flow. |
|
||
| `--grep <pattern>` | regular expression, repeatable | none | Only tests whose title matches one of the patterns. The text matched is the describe titles and the test title joined by one space (`checkout pays`); the file and the tags are not part of it. A bare pattern is case-sensitive; `'/pattern/i'` adds flags. A pattern that does not compile is a usage error, exit 2. |
|
||
| `--grep-invert <pattern>` | regular expression, repeatable | none | Leaves out every test whose title matches one of the patterns. Same text and pattern forms as `--grep`; both together keep the tests `--grep` matches minus the ones `--grep-invert` matches. |
|
||
| `--last-failed` | boolean | `false` | Only the tests the previous run did not pass, read from the `report.json` this run overwrites (under `--artifacts`, from the same parent): failed, timed out, interrupted, or skipped because a setup, a serial predecessor, a hook, or the worker failed. A test is named per target and agent. No report is `NO_LAST_RUN`; a previous run with nothing failed selects nothing, `NO_TESTS` unless `--pass-with-no-tests`. |
|
||
| `--shard <index/total>` | `2/3` | none | Runs one contiguous slice of the selected tests, cut once every other filter applied. Slices differ in size by at most one test, a serial group counts as one and is never split, and each shard brings only the setup tests its own tests need. Every shard runs the same command with a different index; the order is the report order, so the same suite shards the same way on every machine. A shard that gets no test is `NO_TESTS` unless `--pass-with-no-tests`. See [Sharding](/ci#sharding). |
|
||
| `--headed` | boolean | `false` | Visible UI when the engine supports it. |
|
||
| `--agent <names>` | comma-separated or repeated | `default` | Runs unpinned tests once per selected agent. For a test with `{ agent }`, selects the shared names when there is overlap; otherwise keeps the test's selection. An unknown name is `INVALID_CONFIG`. |
|
||
| `--retries <n>` | integer 0-10 | config | Replaces `config.retries`. |
|
||
| `--workers <n>` | integer 1-1024 | config | Replaces `config.workers`. |
|
||
| `--repeat-each <n>` | integer, at least 1 | `1` | Runs every selected test this many times. Each run is a result of its own, with `repeat` 0 through `n - 1` and its own `id`; the list reporter titles the later runs `(repeat #1)`, `(repeat #2)`, and their artifacts go under a `repeat-<n>` directory. Setup tests run once. With the trace cache on, the first run records and the later ones replay, so pair it with `--no-cache` to exercise the model each time. |
|
||
| `--max-failures <n>` | integer, at least 1 | none | Stops the run once this many tests have failed or timed out. Nothing more is dispatched, the tests running end as `interrupted`, and the tests not started are skipped with cause `failure-limit` and the reason `run stopped after 3 failures (--max-failures 3)`. The exit code is the failures' own, 1, not 130. |
|
||
| `--reporter <ids>` | comma-separated list | config | Replaces the built-in IDs in `config.reporters`: `list`, `json`, `junit`, `markdown`. `json` with `list` is `INVALID_CONFIG`. [Reporter objects](/reference/reporters) in the config keep running. |
|
||
| `--artifacts <dir>` | string | `.e2e/artifacts` | Relocates the report and artifact tree. |
|
||
| `--no-cache` | boolean | `false` | Trace cache off for this run, whatever `config.cache` says. |
|
||
| `--pass-with-no-tests` | boolean | `false` | Exit 0 instead of `NO_TESTS` when nothing is selected. |
|
||
| `--debug` | boolean | `false` | Phase timings and an agent step table on stderr after the run. |
|
||
| `--ai-trace` | boolean | `false` | Records every model call to `.e2e/ai-trace.json`, an AI SDK devtools database. Open it with [unbox-ai](https://github.com/tester-army/unbox-ai). |
|
||
| `--video` | boolean | `false` | Records every attempt (WebM on a browser engine, MP4 on a device engine). Adds the `video` kind to `config.artifacts` for this run; an engine that cannot record fails with `UNSUPPORTED_ARTIFACT`. See [video](/reference/config#video). |
|
||
|
||
Out-of-range `--retries` and `--workers` fail with `INVALID_CONFIG` before
|
||
anything starts, the same as the config value would. `--target`, `--tag`,
|
||
`--exclude-tag`, and `--agent` take each name once; an empty value (`--tag ''`,
|
||
or `--tag "$TAGS"` with the variable unset) is a usage error, exit 2, never a
|
||
wider selection.
|
||
|
||
Filters only narrow, and each applies after the one before: positionals, then
|
||
`.only`, `--tag`, `--exclude-tag`, `--grep`, `--grep-invert`, `--last-failed`,
|
||
then the platform and capability rules, then `--shard`. When they leave
|
||
nothing to run, `NO_TESTS` counts the tests each filter removed, names the tags
|
||
and patterns, and marks a tag no test declares.
|
||
|
||
`--debug` appends two tables to stderr. Phase timings are summed across the
|
||
runner and every worker. The agent step table lists every agent step in
|
||
execution order with its per-phase split, model calls, tokens, and cost when
|
||
the provider reported one.
|
||
|
||
```console
|
||
$ npx e2e run --debug
|
||
...
|
||
[e2e debug] phase timings (wall 14.2s)
|
||
phase count total avg max
|
||
scheduler 1 11.8s 11.8s 11.8s
|
||
test.body 6 10.1s 1.7s 3.9s
|
||
session.launch 6 1.1s 183ms 410ms
|
||
engine.prepare 1 612ms 612ms 612ms
|
||
collect 1 420ms 420ms 420ms
|
||
config.load 1 118ms 118ms 118ms
|
||
realm.import 1 96ms 96ms 96ms
|
||
session.close 6 88ms 15ms 31ms
|
||
engine.init 1 74ms 74ms 74ms
|
||
|
||
[e2e debug] agent steps (execution order, model anthropic/claude-sonnet-4.5, total $0.0312)
|
||
step total model observe action calls tokens in/out cached cost
|
||
act "add a todo named groceries" 3.9s 2.8s 410ms 620ms 3 9412/388 61% (5740) $0.0198
|
||
assert "the list shows groceries" 1.2s 1.1s 88ms 0ms 1 3120/41 0% (0) $0.0114
|
||
```
|
||
|
||
`cached` is the share of input tokens the provider served from its prompt
|
||
cache, `-` when it reports no split. The report records the same per step
|
||
(`model.cacheReadTokens`, `model.cacheWriteTokens`) and per run
|
||
(`usage.modelCachedTokens`).
|
||
|
||
```bash
|
||
npx e2e run
|
||
npx e2e run tests/signup.e2e.ts --tag smoke
|
||
npx e2e run tests/signup.e2e.ts:12
|
||
npx e2e run tests/agent
|
||
npx e2e run 'tests/**/*.smoke.e2e.ts'
|
||
npx e2e run --target web,webkit --tag smoke,billing --tag-mode all
|
||
npx e2e run --tag smoke --exclude-tag slow
|
||
npx e2e run --grep checkout --grep-invert '/refund/i'
|
||
npx e2e run --last-failed
|
||
npx e2e run --shard 2/3
|
||
npx e2e run --reporter json --workers 4 --retries 2
|
||
npx e2e run --max-failures 3
|
||
npx e2e run --repeat-each 5 --no-cache tests/checkout.e2e.ts
|
||
npx e2e run --reporter list,junit
|
||
```
|
||
|
||
### Output
|
||
|
||
| Reporter | Writes |
|
||
| --- | --- |
|
||
| `list` | Terminal progress, failures with code frames, and a run summary. On a TTY, live progress includes the current agent step, model turns, tool calls, and reasoning excerpts. Untrusted fields are capped at 8 KiB and stripped of control characters. |
|
||
| `json` | The report document to stdout and nothing else there, so `e2e run --reporter json \| jq` works. Same document as `.e2e/report.json`, described by `schema/report-v1.schema.json` in the package. The shape changes only with the `schemaVersion` field (`report-1` today). Cannot be combined with `list`. |
|
||
| `junit` | `.e2e/junit.xml` beside the report. One `<testsuite>` per file, one `<testcase>` per test-target pair named `title > path [target]`. A test-class error is a `<failure>`, any other an `<error>`, a skip a `<skipped>` with its reason. Run-level errors form a `run` suite. |
|
||
| `markdown` | `.e2e/summary.md` with counts, cost, errors, and failure details. Failed and flaky tests also get a page under `.e2e/failures/` with steps, model turns, and the screen at failure. Exploration runs show findings. [`@e2edev/github`](/github) uses this summary for pull request comments. |
|
||
|
||
Every run writes `.e2e/report.json` under the artifact parent whatever the
|
||
reporters are. A `junit.xml` or `summary.md` that could not be written is a
|
||
line on stderr, never a run error.
|
||
|
||
With `--ai-trace`, the run also writes `.e2e/ai-trace.json`: one entry per
|
||
model round trip with the exact prompt, tool definitions, response, usage,
|
||
and provider metadata. Observations in it are already redacted. Inline image
|
||
and file bytes are replaced with byte counts. Open it with
|
||
`npx unbox-ai .e2e/ai-trace.json`; see [Debugging a run](/debugging#agent-steps).
|
||
|
||
### Signals
|
||
|
||
Signals escalate.
|
||
|
||
1. The first `SIGINT` or `SIGTERM` interrupts. The running test ends with
|
||
status `interrupted`, its `afterEach` hooks and session close run within
|
||
the cleanup budget, every worker disposes its engine, and the runner writes
|
||
a partial report and exits 130.
|
||
2. A second signal forces. Workers dispose their engines at once and are
|
||
killed when the cleanup budget is spent. The report is still written.
|
||
3. A third signal exits on the spot, after killing the process groups of every
|
||
app command and service the run started. A process attached through
|
||
`reuseExisting` is left alone.
|
||
|
||
A worker whose runner disappears disposes its engine and exits within the
|
||
cleanup budget.
|
||
|
||
## e2e explore
|
||
|
||
```bash
|
||
e2e explore [goal]
|
||
```
|
||
|
||
A run with no test file. The agent gets a goal, plans one exploration step
|
||
at a time, reports defects through its `report_finding` tool, and ends with an
|
||
assessment. The default goal is `Explore the app and find bugs`. See
|
||
[Exploring without a test](/explore).
|
||
|
||
| Flag | Type | Default | Behavior |
|
||
| --- | --- | --- | --- |
|
||
| `--config <path>` | string | discovered | Explicit config path, with the same errors as `run`. |
|
||
| `--target <id>` | string | the first configured target | The one target to explore. Several targets and no flag explores the first and says so on stderr. An unknown name is `UNKNOWN_TARGET`. |
|
||
| `--agent <name>` | string | `default` | The configured agent the exploration runs as. Its model, tools, and context are reused; a hand-rolled `StepExecutor` is replaced by the built-in agent, with a notice. An unknown name is `INVALID_CONFIG`. |
|
||
| `--max-steps <n>` | integer 1-12 | `8` | Exploration steps at most. Out of range exits 2. |
|
||
| `--timeout <ms>` | integer 180000-900000 | `600000` | The run's wall clock. The last minute is kept for the closing assessment. Out of range exits 2. |
|
||
| `--headed` | boolean | `false` | Requests visible UI when the engine supports it. |
|
||
| `--reporter <ids>` | comma-separated list | resolved config value | As for `run`. The exploration summary rows print under the `list` summary; `json` carries the record in the report. |
|
||
| `--artifacts <dir>` | string | `.e2e/artifacts` | Relocates the report and the artifact tree; a finding's evidence screenshot is one of the attempt's artifacts there. |
|
||
| `--debug` | boolean | `false` | As for `run`: phase timings and the agent step table. |
|
||
| `--ai-trace` | boolean | `false` | As for `run`. |
|
||
| `--video` | boolean | `false` | As for `run`: one video of the whole exploration (WebM on a browser engine, MP4 on a device engine) when the engine can record; otherwise the run fails with `UNSUPPORTED_ARTIFACT` before exploration starts. |
|
||
|
||
The run has one result, under the virtual file `explore`, titled by the goal.
|
||
The trace cache is off and retries are zero whatever the config says.
|
||
`.e2e/report.json` gains `run.explore`: the goal, the budgets, why the run
|
||
ended (`finished`, `step-limit`, `time`, `stuck`, or `aborted`), the
|
||
assessment, the steps, and the findings.
|
||
|
||
Exit codes: `0` when steps ran and no finding of kind `issue` was reported,
|
||
`1` when one was or when no step ran at all, `2` and `3` as for `run`, `130`
|
||
on Ctrl-C.
|
||
|
||
```bash
|
||
npx e2e explore
|
||
npx e2e explore 'Explore the checkout flow like a first-time buyer and report anything off'
|
||
npx e2e explore --target web --max-steps 4 --headed
|
||
npx e2e explore 'Hunt for broken forms and dead links' --agent thorough --video
|
||
```
|
||
|
||
## e2e list
|
||
|
||
```bash
|
||
e2e list [files...]
|
||
```
|
||
|
||
A dry run. `list` selects tests exactly as `run` does, prints one line per
|
||
test-target pair, and exits. No app process, engine, or worker starts, and
|
||
nothing is written under `.e2e/`.
|
||
|
||
Positionals and the selection flags (`--config`, `--target`, `--tag`,
|
||
`--tag-mode`, `--exclude-tag`, `--grep`, `--grep-invert`, `--last-failed`,
|
||
`--shard`, `--pass-with-no-tests`) are those of `run`; `--last-failed` reads
|
||
`.e2e/report.json`. `--reporter` accepts `list` (the default) or `json`.
|
||
|
||
| Reporter | Writes |
|
||
| --- | --- |
|
||
| `list` | One line per pair, `file › title [target]`, in selection order, with the describe path joined by ` › ` (`tests/billing.e2e.ts › checkout › pays [web]`), then each tag the test declares as `#tag` (`tests/billing.e2e.ts › checkout › pays [web] #smoke #billing`). A skipped test keeps its line with `(skipped: <reason>)` appended. Setup tests are listed like any other. |
|
||
| `json` | `{ "pairs": [...] }` to stdout. Each pair carries `file`, `title`, `titlePath`, `kind` (`test` or `setup`), `tags` (the tags the test declares, `[]` when none), `target`, `disposition` (`run` or `skip`), and `skipReason` when skipped. |
|
||
|
||
Pairs a filter removed are not listed.
|
||
|
||
```bash
|
||
npx e2e list
|
||
npx e2e list tests/signup.e2e.ts
|
||
npx e2e list --tag smoke --target web
|
||
npx e2e list --grep checkout --exclude-tag slow
|
||
npx e2e list --reporter json
|
||
```
|
||
|
||
## e2e cache
|
||
|
||
Inspect or clear the trace cache. These commands load the discovered config
|
||
or `--config <path>`, honor `cache.dir`, and exit 0 on an empty store. The
|
||
default directory is `.e2e/cache/`.
|
||
|
||
| Command | Prints |
|
||
| --- | --- |
|
||
| `e2e cache ls` | One row per entry: the test and target it was recorded for, the first 12 characters of its instruction digest, its age, and how many actions a replay would run (`(truncated)` when recording hit the action cap). Rows are grouped by test, then target, oldest first. |
|
||
| `e2e cache stats` | The store directory, the number of readable entries, their total size, and the number of unreadable files when there are any. |
|
||
| `e2e cache clear` | Deletes every cache file, then the directory when nothing else is left in it, and reports how many files went. |
|
||
|
||
```bash
|
||
npx e2e cache ls
|
||
npx e2e cache stats
|
||
npx e2e cache clear
|
||
npx e2e cache ls --config packages/web/e2e.config.ts
|
||
```
|
||
|
||
```text
|
||
TEST TARGET INSTRUCTION AGE ACTIONS
|
||
tests/billing.e2e.ts::upgrades web 4f1c0a9d3b62 2h 4
|
||
tests/signup.e2e.ts::signs%20up web 9ab7715ce004 3d 7 (truncated)
|
||
```
|
||
|
||
An entry recorded before entries carried provenance prints `-` in those
|
||
columns and still replays. A file the store cannot read (truncated, over the
|
||
1 MiB ceiling, or from a newer schema) is counted separately on stderr, treated
|
||
as a miss by a run, and removed by `clear`. Files the runner never wrote are
|
||
left alone.
|
||
|
||
<Note>
|
||
These commands read the file store only. With a custom `cache.store` they
|
||
exit 2 and say so.
|
||
</Note>
|
||
|
||
## e2e telemetry
|
||
|
||
Shows whether anonymous usage telemetry is on, and switches it.
|
||
[Telemetry](/telemetry) lists every property sent.
|
||
|
||
| Command | Effect |
|
||
| --- | --- |
|
||
| `e2e telemetry`, `e2e telemetry status` | Prints `Status: enabled`, or `Status: disabled` with the reason: the variable that is set, the saved choice, or a preferences directory that cannot be written. |
|
||
| `e2e telemetry disable` | Saves the opt-out to `~/.config/e2e/telemetry.json` (`$XDG_CONFIG_HOME/e2e/` when set, `%APPDATA%\e2e\` on Windows) and prints the status. |
|
||
| `e2e telemetry enable` | Saves the opt-in and prints the status. A variable set in the environment still wins, and the status says so. |
|
||
|
||
```bash
|
||
npx e2e telemetry
|
||
npx e2e telemetry disable
|
||
E2E_TELEMETRY_DEBUG=1 npx e2e run
|
||
```
|
||
|
||
`E2E_TELEMETRY_DISABLED=1` and `DO_NOT_TRACK=1` turn telemetry off without
|
||
touching the file. `E2E_TELEMETRY_DEBUG=1` prints every event to stderr and
|
||
sends nothing. The first command on a machine prints a notice once; in CI
|
||
nothing is printed and no file is written.
|
||
|
||
## Exit codes
|
||
|
||
| Code | Meaning |
|
||
| ---: | --- |
|
||
| 0 | All selected tests passed, were flaky, or were explicitly skipped |
|
||
| 1 | Final test or setup failure, or test timeout |
|
||
| 2 | CLI, config, collection, dependency, credential, model-config, or policy error |
|
||
| 3 | Engine, app process, model provider, artifact, or cleanup infrastructure failure |
|
||
| 4 | Internal runner invariant or unhandled runner error |
|
||
| 130 | Interrupted by a user or CI signal |
|
||
|
||
Precedence for a mixed run is `130 > 4 > 3 > 2 > 1 > 0`. The report keeps every
|
||
individual result; precedence affects only the process exit code.
|
||
|
||
Argument parsing failures exit 2 with a one-line error on stderr.
|
||
|
||
## Diagnostics
|
||
|
||
A message that rejects a name suggests the nearest valid one. Keys from other
|
||
runners' configs (`testDir`, `baseURL`, `webServer`, `projects`) say where
|
||
that fact lives here. A failing `import` in the config or a test file ends
|
||
with the install or add command for the project's package manager, or the
|
||
subpaths the package exports. A model credential the provider rejects names
|
||
the variable the provider reads.
|