cypress

A set of Cypress rules for browser end-to-end tests, including stable selectors, command chains, assertions, API interception, aliases, and fixtures.

In plain words
What is it for?
Use it when writing tests for user flows, selecting elements, checking results, stubbing or waiting for API calls, and supplying test responses.
Why use it?
It helps tests remain reliable when the page design changes and prevents mistakes caused by Cypress's asynchronous command behavior.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/nedcodes-ok/cursor-doctor/cypress
Clone the repo
git clone --depth 1 https://github.com/nedcodes-ok/cursor-doctor
Per session 510 This file is loaded in full into every session.
When invoked 510 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00510 $0.00510
Opus 5 $0.00255 $0.00255
Sonnet 5 $0.00102 $0.00102
Haiku 4.5 $0.00051 $0.00051

Measured 2d ago against content hash 52f9aa93d4d3, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cypress scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

pro-kit/templates/tools/cypress.mdc · 46 lines

How it starts

The opening of the file, as written. The whole thing — 46 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Cypress Cursor Rules

You are an expert in Cypress E2E testing. Follow these rules:

Selectors

  • Use data-cy or data-testid attributes — never select by class, tag, or text content
  • cy.get("[data-cy=submit-btn]") over cy.get(".btn-primary") or cy.contains("Submit")
  • Use cy.findByRole/cy.findByLabelText when using @testing-library/cypress
  • Keep selectors stable — decouple tests from styling and DOM structure

Commands & Chains

  • Cypress commands are async and chained — never assign return values to variables
  • Use .then() to work with yielded values, not const x = cy.get()
  • Use .should() for assertions — they auto-retry until timeout
  • Combine assertions: .should("be.visible").and("contain.text", "Success")
  • Use cy.wrap() to bring non-Cypress values into the command chain

Network

  • Use cy.intercept() for all API stubbing and waiting — never cy.route() (deprecated)
  • Alias intercepts: cy.intercept("GET", "/api/users").as("getUsers")
  • Wait on aliases before asserting: cy.wait("@getUsers").its("response.statusCode").should("eq", 200)
  • Use fixture files for response bodies: cy.intercept("GET", "/api/users", { fixture: "users.json" })

Best Practices

  • Never use cy.wait(ms) for timing — use cy.intercept aliases or .should() retries
  • Use beforeEach for test isolation — seed state via API calls, not UI navigation
  • Use cy.session() for login caching across tests
  • Keep tests independent — never depend on execution order
  • Use Cypress.env() for environment-specific values, not hardcoded URLs

Custom Commands

  • Add reusable flows as custom commands in cypress/support/commands.ts
  • Type custom commands in cypress/support/index.d.ts for TypeScript
  • Keep commands focused — one action per command (cy.login, cy.seedDatabase)

Configuration

  • Set baseUrl in cypress.config.ts — use cy.visit("/path") with relative URLs
  • Set defaultCommandTimeout appropriately (4s default, increase for slow UIs)
  • Use cypress.config.ts for all config — never cypress.json (deprecated)

Read the full file on GitHub · 46 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 46 lines · 510 tokens per session scan A 52f9aa93d4d3

Subscribe to this mod's changes

cypress is a cursor rule published in the GitHub repository nedcodes-ok/cursor-doctor (9 stars, last pushed 5mo ago), licensed MIT. It adds 510 tokens to every session, about $0.0026 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.