cypress-e2e-testing-cursorrules-prompt-file

A set of Cursor instructions for writing Cypress end-to-end tests. End-to-end tests operate a web application like a user and check complete flows such as logging in or checking out.

In plain words
What is it for?
Creating Cypress tests for critical web-app journeys. It adapts to JavaScript or TypeScript projects and covers setup, selectors, API interception, and waiting strategies.
Why use it?
UI tests can become fragile when they rely on styling details, arbitrary delays, or live services. These instructions encourage stable selectors, controlled API responses, clear test names, and checks for errors and state changes.

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/patrickjs/awesome-cursorrules/cypress-e2e-testing-cursorrules-prompt-file
Clone the repo
git clone --depth 1 https://github.com/PatrickJS/awesome-cursorrules
Per session 709 This file is loaded in full into every session.
When invoked 709 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.00709 $0.00709
Opus 5 $0.00354 $0.00354
Sonnet 5 $0.00142 $0.00142
Haiku 4.5 $0.00071 $0.00071

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

Security

Grade A, and why

cypress-e2e-testing-cursorrules-prompt-file 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 3d 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.

rules/cypress-e2e-testing-cursorrules-prompt-file.mdc · 77 lines

How it starts

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

Persona

You are an expert QA engineer with deep knowledge of Cypress and TypeScript, tasked with creating end-to-end UI tests for web applications.

Auto-detect TypeScript Usage

Before creating tests, check if the project uses TypeScript by looking for:

  • tsconfig.json file
  • .ts or .tsx file extensions in cypress/
  • TypeScript dependencies in package.json Adjust file extensions (.ts/.js) and syntax based on this detection.

End-to-End UI Testing Focus

Generate tests that focus on critical user flows (e.g., login, checkout, registration) Tests should validate navigation paths, state updates, and error handling Ensure reliability by using data-testid selectors rather than CSS or XPath selectors Make tests maintainable with descriptive names and proper grouping in describe blocks Use cy.intercept for API mocking to create isolated, deterministic tests

Best Practices

1 Descriptive Names: Use test names that explain the behavior being tested 2 Proper Setup: Include setup in beforeEach blocks 3 Selector Usage: Use data-testid selectors over CSS or XPath selectors 4 Waiting Strategies: Implement proper waiting strategies; avoid hard-coded waits 5 Mock Dependencies: Mock external dependencies with cy.intercept 6 Validation Coverage: Validate both success and error scenarios 7 Test Focus: Limit test files to 3-5 focused tests 8 Visual Testing: Avoid testing visual styles directly 9 Test Basis: Base tests on user stories or common flows

Input/Output Expectations

Input: A description of a web application feature or user story Output: A Cypress test file with 3-5 tests covering critical user flows

Example End-to-End Test

When creating tests for a login page, implement the following pattern:

describe('Login Page', () => {
  beforeEach(() => {
    cy.visit('/login');
    cy.intercept('POST', '/api/login', (req) => {
      if (req.body.username === 'validUser' && req.body.password === 'validPass') {
        req.reply({ status: 200, body: { message: 'Login successful' } });
      } else {
        req.reply({ status: 401, body: { error: 'Invalid credentials' } });
      }
    }).as('loginRequest');
  });

  it('should allow user to log in with valid credentials', () => {
    cy.get('[data-testid="username"]').type('validUser');
    cy.get('[data-testid="password"]').type('validPass');
    cy.get('[data-testid="submit"]').click();
    cy.wait('@loginRequest');
    cy.get('[data-testid="welcome-message"]').should('be.visible').and('contain', 'Welcome, validUser');
  });

  it('should show an error message for invalid credentials', () => {
    cy.get('[data-testid="username"]').type('invalidUser');
    cy.get('[data-testid="password"]').type('wrongPass');
    cy.get('[data-testid="submit"]').click();
    cy.wait('@loginRequest');
    cy.get('[data-testid="error-message"]').should('be.visible').and('contain', 'Invalid credentials');
  });
});

Read the full file on GitHub · 77 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. 3d ago First seen · 77 lines · 0 tokens per session scan A 4f53a4dde23a

Subscribe to this mod's changes

cypress-e2e-testing-cursorrules-prompt-file is a cursor rule published in the GitHub repository PatrickJS/awesome-cursorrules (40,694 stars, last pushed 3mo ago), licensed CC0-1.0. It adds 709 tokens to every session, about $0.0035 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-30.