playwright-integration-testing-cursorrules-prompt-file

playwright-integration-testing-cursorrules-prompt-file is a cursor rule for coding agents from PatrickJS/awesome-cursorrules. It costs 1,658 tokens per session, scanned A, original, CC0-1.0.

A set of Cursor instructions for Playwright integration tests, which check that different parts of a web application work together. It covers interactions between the user interface and the API, including controlled fake API responses.

In plain words
What is it for?
Use it to test key user flows, API-to-interface interactions, state changes, and error scenarios across multiple components.
Why use it?
It helps find problems where one part of an application updates incorrectly when another part changes or returns an error. Mocking API responses makes these tests repeatable.

Cursor rule

About the project

PatrickJS/awesome-cursorrules is a collection of Markdown rule files that give Cursor AI editor project-specific instructions about code, frameworks, workflows, and standards. Developers use it to find reusable guidance for shaping Cursor’s behavior in different kinds of software projects.

PatrickJS/awesome-cursorrules · 40,725 stars · on GitHub

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/playwright-integration-testing-cursorrules-prompt-file
Clone the repo
git clone --depth 1 https://github.com/PatrickJS/awesome-cursorrules

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for playwright-integration-testing-cursorrules-prompt-file

README.md
[![agentmods](https://agentmods.dev/badge/rules/patrickjs/awesome-cursorrules/playwright-integration-testing-cursorrules-prompt-file.svg)](https://agentmods.dev/rules/patrickjs/awesome-cursorrules/playwright-integration-testing-cursorrules-prompt-file)
Your own site
<a href="https://agentmods.dev/rules/patrickjs/awesome-cursorrules/playwright-integration-testing-cursorrules-prompt-file"><img src="https://agentmods.dev/badge/rules/patrickjs/awesome-cursorrules/playwright-integration-testing-cursorrules-prompt-file.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,658 This file is loaded in full into every session.
When invoked 1,658 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.01658 $0.01658
Opus 5 $0.00829 $0.00829
Sonnet 5 $0.00332 $0.00332
Haiku 4.5 $0.00166 $0.00166

Measured yesterday against content hash 39146dd7671d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

playwright-integration-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 yesterday.

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/playwright-integration-testing-cursorrules-prompt-file.mdc · 206 lines

How it starts

The opening of the file, as written. The whole thing — 206 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 Playwright and TypeScript, tasked with creating integration tests for web applications.

Auto-detect TypeScript Usage

Check for TypeScript in the project through tsconfig.json or package.json dependencies. Adjust syntax based on this detection.

Integration Testing Focus

Create tests that verify interactions between UI and API components Focus on critical user flows and state transitions across multiple components Mock API responses using page.route to control test scenarios Validate state updates and error handling across the integration points

Best Practices

1 Critical Flows: Prioritize testing end-to-end user journeys and key workflows 2 Semantic Selectors: Use data-testid or aria attributes for reliable element selection 3 API Mocking: Use page.route to mock API responses and validate requests 4 State Validation: Verify UI state updates correctly based on API responses 5 Error Handling: Test both success paths and error scenarios 6 Test Organization: Group related tests in test.describe blocks 7 No Visual Testing: Avoid testing visual styles or pixel-perfect layouts 8 Limited Tests: Create 3-5 focused tests per feature for maintainability

Example Integration Test

import { test, expect } from '@playwright/test';

test.describe('Registration Form Integration', () => {
  test.beforeEach(async ({ page }) => {
    // Mock the API response
    await page.route('**/api/register', async route => {
      const request = route.request();
      const body = await request.postDataJSON();
      
      if (body.email && body.email.includes('@')) {
        await route.fulfill({
          status: 200,
          body: JSON.stringify({ message: 'Registration successful' })
        });
      } else {
        await route.fulfill({
          status: 400,
          body: JSON.stringify({ error: 'Invalid email format' })
        });
      }
    });
    
    // Navigate to the registration page
    await page.goto('/register');
  });

  test('should submit form and display success message', async ({ page }) => {
    // Arrange: Fill out form with valid data
    await page.fill('[data-testid="name-input"]', 'John Doe');
    await page.fill('[data-testid="email-input"]', '[email protected]');
    await page.fill('[data-testid="password-input"]', 'Password123');
    
    // Act: Submit the form
    await page.click('[data-testid="register-button"]');
    
    // Assert: Verify success message is displayed
    await expect(page.locator('[data-testid="success-message"]')).toBeVisible();
    await expect(page.locator('[data-testid="success-message"]')).toContainText('Registration successful');
    
    // Assert: Verify redirect to dashboard
    await expect(page).toHaveURL(/.*\/dashboard/);
  });

  test('should show error message for invalid email', async ({ page }) => {
    // Arrange: Fill out form with invalid email
    await page.fill('[data-testid="name-input"]', 'John Doe');
    await page.fill('[data-testid="email-input"]', 'invalid-email');
    await page.fill('[data-testid="password-input"]', 'Password123');
    
    // Act: Submit the form
    await page.click('[data-testid="register-button"]');
    
    // Assert: Verify error message is displayed
    await expect(page.locator('[data-testid="error-message"]')).toBeVisible();
    await expect(page.locator('[data-testid="error-message"]')).toContainText('Invalid email format');
    
    // Assert: Verify we stay on the registration page
    await expect(page).toHaveURL(/.*\/register/);
  });

  test('should validate input fields before submission', async ({ page }) => {
    // Act: Submit the form without filling any fields
    await page.click('[data-testid="register-button"]');
    
    // Assert: Form validation errors should be displayed
    await expect(page.locator('[data-testid="name-error"]')).toBeVisible();
    await expect(page.locator('[data-testid="email-error"]')).toBeVisible();
    await expect(page.locator('[data-testid="password-error"]')).toBeVisible();
    
    // Assert: No network request should be made
    // This can be verified by checking that we're still on the registration page
    await expect(page).toHaveURL(/.*\/register/);
  });
});

Read the full file on GitHub · 206 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. yesterday First seen · 206 lines · 1,658 tokens per session scan A 39146dd7671d

Subscribe to this mod's changes

playwright-integration-testing-cursorrules-prompt-file is a cursor rule published in the GitHub repository PatrickJS/awesome-cursorrules (40,725 stars, last pushed 3mo ago), licensed CC0-1.0. It adds 1,658 tokens to every session, about $0.0083 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-09-03.