cypress-tap
cypress-io/ai-toolkit
Control a running Cypress open-mode session programmatically to run specs, inspect results, and query the app under test.
What is cypress-tap?
cypress tap drives an already-running `cypress open` session to iterate on specs, inspect reporter and command logs, and read the app DOM without GUI interaction. Use it when authoring or debugging Cypress e2e or component specs; not for one-shot headless runs.
- Run and rerun specs from a live Cypress session and poll for fresh results
- Inspect reporter output, test IDs, and command-log rows with network data and snapshots
- Query the app under test via DOM, accessibility tree, and styles without GUI clicks
- Rewind the app frame to any command snapshot for state inspection
- Discover selectors and diagnose test failures by reading settled or pinned app state
How to install cypress-tap
npx skills add https://github.com/cypress-io/ai-toolkit --skill cypress-tap- Cypress 15.21.0 or later (must contain the `tap` command)
- A Chromium-family browser (Electron, Chrome, Chromium, or Edge; Firefox and WebKit unsupported)
- A running `cypress open` session in the target project
- Any configured `baseUrl` dev server must be running
How to use cypress-tap
- 1.Start or select a Cypress session using `cypress tap sessions` to list reachable sessions
- 2.Run a spec with `cypress tap run <spec>` and note the `startedAt` timestamp
- 3.Poll `cypress tap status --json` until the spec shows `passed` or `failed` with a changed `startedAt`
- 4.Read results with `cypress tap reporter --test-id` or inspect individual commands with `cypress tap command`
- 5.Query the app state with `cypress tap dom`, `cypress tap aria`, or `cypress tap inspect` to read selectors and accessibility
- 6.Pin a snapshot with `cypress tap pin <command-index>` to inspect past app state, then clear it with `cypress tap pin --clear`
Use cases
- Iterate on spec authoring by running specs and inspecting failures without restarting Cypress
- Diagnose flaky tests by pinning snapshots and reading app state at specific command points
- Discover CSS or accessibility selectors by querying the live or pinned DOM
- Verify test behavior and app state changes by reading reporter and command logs programmatically
- Automate spec validation in CI by controlling a Cypress session and polling results
- Test engineers authoring or debugging Cypress e2e and component specs
- QA automation developers diagnosing test failures and flakiness
- CI/CD pipelines automating Cypress test execution and result inspection
- Developers discovering selectors and verifying app behavior without manual GUI interaction
cypress-tap FAQ
`cypress tap` is for iterating on specs in a live session—authoring, debugging, and inspecting state interactively. Use `cypress run` for one-shot headless batch runs in CI.
Run `cypress tap sessions --json` to list all reachable sessions, then pass `--session <pid>` to every command to target the intended one.
Poll `cypress tap status --json` and check for a `passed` or `failed` verdict with a non-empty, changed `startedAt` timestamp that differs from your baseline.
Yes, but be aware that app reads may return the previous run's state during the gap between dispatch and execution. Always confirm a fresh verdict first.
The output was capped at the size limit. Narrow your selector or raise the limit with the appropriate flag to see the full result.
Full instructions (SKILL.md)
Source of truth, from cypress-io/ai-toolkit.
name: cypress-tap
description: >-
Drives a running Cypress open-mode session through cypress tap to run and
rerun specs, wait for fresh results, inspect reporter and command logs, and
query or rewind the app under test through DOM, accessibility, styles, and
snapshots. Use when authoring or debugging Cypress e2e or component specs,
discovering selectors, diagnosing failures, or verifying test behavior
without GUI interaction. Not for one-shot headless runs. Requires Cypress
15.21+, a Chromium-family browser, and a running cypress open session.
metadata:
version: 1.0.0
Driving Cypress with cypress tap
cypress tap controls an already-running cypress open session. Use it to iterate on specs,
inspect the reporter and command log, and read the app under test without GUI interaction.
Use cypress run instead for a one-shot headless batch.
Prerequisites
- Confirm from package metadata or the lockfile that the resolved Cypress is 15.21.0+ and
contains
tap. Do not usetap --helpto probe an unknown older build; prereleases below the version floor may attempt session discovery instead of printing help. - The session must use Electron, Chrome, Chromium, or Edge. Firefox and WebKit are unsupported.
cypress openand any configuredbaseUrldev server must already be running.- The cwd chooses both the Cypress binary and the automatically selected session. When the
target project pins an older Cypress, run
tapfrom a compatible checkout and pass--session <pid>on every call.
Route by task
- Start, select, or poll a session: read session-lifecycle.md.
- Run a spec or read its results: read session-lifecycle.md and reading-results.md.
- Author or inspect a spec: read recipes.md and reading-the-app.md.
- Diagnose a failure: read recipes.md, reading-results.md, and reading-the-app.md.
- Command failure, hang, wrong project, or surprising output: read troubleshooting.md.
- One noninteractive batch: use
cypress run, nottap.
Read only the references required for the current task.
Core commands
sessions: reachable sessions, project roots, testing types, and browsers; JSON adds support and renderer health.status: lifecycle stage, selected spec, run identity, counts, build error, and active pin.specs: runnable project-relative spec paths for the session's testing type.run <spec>: dispatches a spec and returns immediately.reporter: spec overview and test ids; with--test-id, the complete test attempt.command: one command-log row with network data, snapshots, and console properties.pin: rewinds the app frame to a command snapshot.dom,aria,inspect: read the settled app or currently pinned snapshot.
All commands accept --session <pid>, --json, and --timeout <ms>. On a confirmed supported
build, use npx cypress tap <command> --help for command-specific flags.
The non-negotiable verdict rule
run confirms dispatch, not execution, and returns before the new run starts. During that gap,
status and app reads can still return the previous run's plausible verdict and page.
For every explicit run:
- Read the current
startedAt. - Dispatch exactly one spec.
- Poll one
status --jsonresponse at a time. - Accept only
passedorfailedfor the expectedspecwith a non-empty, changedstartedAt.startedAtis null only when no run has ever started for that spec in the session — a build failure on first selection. A build that fails on rerun or on a watcher rebuild still advancesstartedAt, so it takes the normal path. Keep the null fallback (a changed observable baseline, or a precedingloading/runningobservation) for the first-selection case only. - Bound the loop and fail if no matching fresh verdict arrives.
Saving the active spec triggers an automatic watcher run. After editing, either use that run or let it settle before taking a baseline and dispatching another. Never intentionally put two runs in flight.
Blank and partial payloads from a successful status call occur transiently. Treat missing
fields as "keep waiting," not as a state change. A nonzero status exit is a command failure,
not a partial read: stop polling and report it.
Only passed and failed are verdicts. A build failure is failed with the diagnostic in
status.error, possibly before any tests exist. status is the only surface that carries that
diagnostic — reporter renders a failed build as an empty spec.
Critical correctness rules
- Target the intended session. If several sessions exist, or auto-selection behaves oddly,
inspect
sessionsand pass--session <pid>. Auto-selection can choose another project or an unresponsive session. - Preserve the binary location. Cwd controls
npxresolution on every call. When the project pins an older Cypress, run commands from a compatible checkout and pass--session <pid>. - Do not parse failed commands. Check the exit code before parsing JSON. Supported-build
failures generally use stderr, but older compatibility failures may use stdout. An ambiguous
selector is the intentional exception: it exits
1and lists matches on stdout. - Do not discard dispatch stdout while checking compatibility. An older Cypress may print
Unknown command "tap"and usage text to stdout; redirecting it hides the cause. - Redirect potentially large JSON.
reporter --test-id --jsonandcommand --jsoncan be hundreds of kilobytes. Save them to a file and parse the file. - Check truncation before concluding absence.
domandariacap output. Narrow the selector or raise the limit when(output truncated)appears. - Sanity-check the live frame before concluding absence. A trailing pending/skipped test
can leave the settled runner on a blank placeholder while app reads still exit
0. Confirm a known app anchor. If the frame is blank, pin a snapshot from the last real command and read that state instead. - Read results before editing or deleting the spec. Results and snapshots live in the Cypress app's memory and can disappear on rerun, restart, rename, or deletion.
- Clear pins. After inspecting a command snapshot, run
pin --clear; otherwise later app reads continue to describe the pinned past. An exit-0cleared:falseresult is a benign no-op even if human output saysFAILED TO CLEAR PIN. - Use the right reader for live state. Use
ariafor current form-control values:domandinspectcan show the initial HTMLvalueattribute, andinspectmay omit the accessibility value. Usedomfor exact live-region, toast, status, and label text becauseariamay omit descendant text.
Output contract
- Human output is for reading;
--jsonis for parsing and may contain much more data. statusexits0for known lifecycle stages, includingnot connected. Discovery, compatibility, unsupported-browser, and renderer failures exit1, sometimes with no stdout; a poller must fail fast on that nonzero exit.dom,aria, andinspectrequire exactly one selected element. Ambiguity exits1with candidate selectors. A miss is not a CLI failure:domandinspectreportfound:false;ariareturns an empty tree both for a miss and for an element with no accessibility node.- Failures are prose without stable error codes. Branch on exit status, not message text.
Performance defaults
- Prefer one
reporter --test-idread over onecommandcall per row. - After a fresh verdict and live-frame sanity check, independent app reads may run concurrently.
- If bounded status polling fails, inspect
sessionsforrendererResponsive: false; restart a wedged renderer instead of increasing--timeout.
Related skills
More from cypress-io/ai-toolkit and the wider catalog.

cypress-author
Creates, updates, and fixes Cypress tests for E2E and component testing.

cypress-docs
Search and extract accurate Cypress information from official documentation with LLM-optimized sources.

cypress-explain
Explains Cypress tests and answers questions about Cypress behavior without writing code.

uncodixfy
Prevents generic AI-generated UI patterns; enforces clean, human-designed aesthetics inspired by Linear, Raycast, Stripe, and GitHub.

n8n-agents
Design n8n AI agents, chains, and classifiers with LangChain nodes—tool naming, memory, structured output, and RAG patterns.

n8n-binary-and-data
Handle files, images, PDFs, and binary data correctly in n8n workflows.