cypress-api-testing-cursorrules-prompt-file

A set of instructions for using Cypress, a tool that tests web applications, to test APIs. API tests send requests directly to an application and check its responses.

In plain words
What is it for?
Use it to create organized, repeatable Cypress tests for API endpoints, including successful requests, failures, and response-schema checks.
Why use it?
It helps catch incorrect status codes, response data, errors, and response formats without depending on leftover data from earlier tests.

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-api-testing-cursorrules-prompt-file
Clone the repo
git clone --depth 1 https://github.com/PatrickJS/awesome-cursorrules
Per session 753 This file is loaded in full into every session.
When invoked 753 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.00753 $0.00753
Opus 5 $0.00377 $0.00377
Sonnet 5 $0.00151 $0.00151
Haiku 4.5 $0.00075 $0.00075

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

Security

Grade A, and why

cypress-api-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 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.

rules/cypress-api-testing-cursorrules-prompt-file.mdc · 93 lines

How it starts

The opening of the file, as written. The whole thing — 93 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 API 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.

API Testing Focus

Use the cypress-ajv-schema-validator package to validate API response schemas Focus on testing critical API endpoints, ensuring correct status codes, response data, and schema compliance Tests should verify both successful operations and error handling scenarios Create isolated, deterministic tests that don't rely on existing server state Document schema definitions clearly to improve test maintainability

Best Practices

1 Descriptive Names: Use test names that clearly describe the API functionality being tested 2 Request Organization: Group API tests by endpoint or resource type using describe blocks 3 Schema Validation: Define and validate response schemas for all tested endpoints 4 Status Code Validation: Check appropriate status codes for success and error scenarios 5 Authentication Testing: Test authenticated and unauthenticated requests where applicable 6 Error Handling: Validate error messages and response formats for invalid requests 7 Test Data Management: Use fixtures or factories to generate test data 8 Test Independence: Ensure each test is independent and doesn't rely on other tests 9 Testing Scope: Limit test files to 3-5 focused tests for each API resource

Input/Output Expectations

Input: A description of an API endpoint, including method, URL, and expected response Output: A Cypress test file with 3-5 tests for the described API endpoint

Example API Test

When testing a user API endpoint, implement the following pattern:

import { validateSchema } from 'cypress-ajv-schema-validator';

describe('Users API', () => {
  const userSchema = {
    type: 'array',
    items: {
      type: 'object',
      properties: {
        id: { type: 'number' },
        name: { type: 'string' },
      },
      required: ['id', 'name'],
    },
  };

  it('should return user list with valid schema', () => {
    cy.request('GET', '/api/users').then((response) => {
      expect(response.status).to.eq(200);
      expect(response.body).to.have.length.greaterThan(0);
      validateSchema(response.body, userSchema);
    });
  });

  it('should return 401 for unauthorized access', () => {
    cy.request({
      method: 'GET',
      url: '/api/users',
      failOnStatusCode: false,
      headers: { Authorization: 'invalid-token' },
    }).then((response) => {
      expect(response.status).to.eq(401);
      expect(response.body).to.have.property('error', 'Unauthorized');
    });
  });

  it('should return a specific user by ID', () => {
    cy.request('GET', '/api/users/1').then((response) => {
      expect(response.status).to.eq(200);
      expect(response.body).to.have.property('id', 1);
      expect(response.body).to.have.property('name');
      validateSchema(response.body, userSchema.items);
    });
  });
});

Read the full file on GitHub · 93 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 · 93 lines · 0 tokens per session scan A 3c3e85bf916b

Subscribe to this mod's changes

cypress-api-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 753 tokens to every session, about $0.0038 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.