network-api-testing

A set of Cypress rules for testing web applications that communicate with APIs, the services that send and receive application data.

In plain words
What is it for?
It is for mocking API responses, verifying requests and responses, simulating failures, and measuring request timing during Cypress tests.
Why use it?
It lets tests control or observe network requests, so external services do not make results unpredictable and error cases can be checked.

Cursor rule for Cursor

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/tugkanboz/awesome-cursorrules/network-api-testing
Clone the repo
git clone --depth 1 https://github.com/tugkanboz/awesome-cursorrules

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 3,164 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 88% copy Near-identical to another mod 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.00000 $0.03164
Opus 5 $0.00000 $0.01582
Sonnet 5 $0.00000 $0.00633
Haiku 4.5 $0.00000 $0.00316

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

Security

Grade A, and why

network-api-testing 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.

Origin

This is a copy

88% identical to api-testing — 67 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

frameworks/cypress/.cursor/rules/patterns/network-api-testing.mdc · 401 lines

How it starts

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

Cypress Network & API Testing Excellence

Network Interception Mastery

  • Request/Response Mocking: Control external API responses for reliable testing
  • Network Monitoring: Track and validate API calls during user interactions
  • Error Simulation: Test error handling and edge cases
  • Performance Testing: Monitor response times and optimize user experience

Advanced API Interception

// ✅ Comprehensive API interception setup
describe('API Integration Tests', () => {
  beforeEach(() => {
    // Set up common API routes
    cy.intercept('GET', '/api/users*', { fixture: 'users.json' }).as('getUsers')
    cy.intercept('POST', '/api/users', { fixture: 'user-created.json' }).as('createUser')
    cy.intercept('PUT', '/api/users/*', { fixture: 'user-updated.json' }).as('updateUser')
    cy.intercept('DELETE', '/api/users/*', { statusCode: 204 }).as('deleteUser')
  })

  it('should handle complete user CRUD operations', () => {
    // Visit page and wait for initial data load
    cy.visit('/users')
    cy.wait('@getUsers').then((interception) => {
      expect(interception.response.statusCode).to.equal(200)
      expect(interception.response.body).to.have.property('users')
    })

    // Create new user
    cy.get('[data-cy=add-user-button]').click()
    cy.get('[data-cy=user-form]').within(() => {
      cy.get('[data-cy=first-name]').type('John')
      cy.get('[data-cy=last-name]').type('Doe')
      cy.get('[data-cy=email]').type('[email protected]')
      cy.get('[data-cy=submit-button]').click()
    })

    cy.wait('@createUser').then((interception) => {
      expect(interception.request.body).to.deep.include({
        firstName: 'John',
        lastName: 'Doe',
        email: '[email protected]'
      })
      expect(interception.response.statusCode).to.equal(201)
    })

    // Verify user appears in list
    cy.get('[data-cy=user-list]')
      .should('contain.text', 'John Doe')
      .and('contain.text', '[email protected]')
  })
})

Read the full file on GitHub · 401 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 · 401 lines · 3,164 tokens per session scan A 4e86c5c29f82

Subscribe to this mod's changes

network-api-testing is a cursor rule published in the GitHub repository tugkanboz/awesome-cursorrules (20 stars, last pushed 3d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,164 tokens. A static security scan graded it A with 0 findings. It is 88% identical to api-testing, differing in 67 lines, and is treated as a copy.