Cypress E2E and component tests: cy.intercept(), cy.session(), custom commands and CI artifacts. Use when writing or debugging Cypress specs, or running Cypress in CI.
80 stars
0 votes
0 copies
1 view
Added May 28, 2026
ai-agentsgobashtestingdebugging
Security analysis
A92/100
mediumInstalls packages at runtime which could introduce malicious dependencies
Installs into .claude/skills of the current project.
Are you the author of Cypress?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/monkilabs-cypress)
---
name: cypress-testing
description: "Cypress E2E and component tests: cy.intercept(), cy.session(), custom commands and CI artifacts. Use when writing or debugging Cypress specs, or running Cypress in CI."
---
# Cypress Testing
Project test config and breakpoints: `.opencastle/stack/testing-config.md`. Docs: https://docs.cypress.io
## Layout
Specs `cypress/e2e/` • fixtures `cypress/fixtures/` • custom commands `cypress/support/commands.ts` • failure artifacts `cypress/screenshots/` and `cypress/videos/`.
## Gotchas
- `cy.session(key, setupFn)` caches and restores auth state across specs — the cache key must include every credential that changes the session, or you will silently reuse the wrong user.
- Give each spec **unique** `@alias` names for `cy.intercept()` routes. Shared alias names cause cross-test `cy.wait()` collisions when specs run in parallel.
- Prefer `cy.intercept()` with fixed fixture payloads over seeding real data — it is the only reliable fix for network flake.
- Selector priority: `data-testid` → `aria-*` / `role`. Never auto-generated classes or deep CSS paths.
- After `npm install --save-dev cypress`, run `npx cypress verify` — a corrupted binary cache fails later with confusing errors.
## Commands
```bash
npx cypress open # interactive
npx cypress run # headless / CI, assert exit 0
npx cypress run --spec "cypress/e2e/auth/login.cy.ts" --headed # single-spec smoke check
```
On failure, re-run the failing spec alone and inspect the screenshot/video artifacts. In CI, upload those artifacts only on failure.