| name | e2e-via-commands |
| description | Use when creating/extending e2e tests with step interpreter and shared commands, where test engine + interpreter path/contract must be confirmed before execution.
|
Build e2e via interpreter.
Goal
Turn behavior spec into step map + interpreter execution.
Preflight (Mandatory)
Before any test:
- Resolve test engine:
- infer from user prompt/repo context if clear
- if not clear, ask user before writing tests
- Ask user for interpreter path (or propose found candidate).
- Resolve verification command type:
- infer from prompt/context if clear (
test, e2e, nx, pnpm, etc.)
- if not clear, ask user which command to run for verification
- Confirm contract in 2-4 lines: command map shape, execute-call shape, async/error behavior.
- If engine, verification command, or contract unclear: stop, ask, no test writing.
Test Shape
- Import interpreter entry + test API from resolved engine.
- Put static mocks/fixtures first.
- Add
commands object:
- key = readable step text
- value = fn
(page) => ... or async (page) => ...
- Each
test(...) runs steps through interpreter.
- Inline actions only for tiny one-off checks.
Command Rules
- One command = one visible user/system behavior.
- Use role/placeholder/text selectors only. No internals.
- Await engine actions; no sleeps/timeouts.
- Reuse command keys across tests; add new keys only for new behavior.
- Test titles describe behavior, not implementation.
- Assertions verify visible outcome.
Build Flow
- Read spec/requirements.
- Convert requirements into scenarios.
- Split into reusable commands.
- Add missing commands.
- Compose scenario by ordered step tuples.
- Assert visible outcomes.
- Add edge cases (bounds, back nav, invalid state).
Done Criteria
- Tests deterministic on repeat runs.
- Engine explicitly resolved (inferred or user-confirmed).
- Verification command type resolved (inferred or user-confirmed).
- Interpreter path + contract documented before execution.
- Shared setup via interpreter, no copy-paste flow blocks.
- Assertions cover user-visible text/state.
- File stays compact: commands block + script-like tests.