playwright-e2e-testing

playwright-e2e-testing is a cursor rule for Cursor from vinhnx/vtchat. It costs 6 tokens per session (788 once invoked), scanned A, a copy of playwright-e2e-testing-cursorrules-prompt-file, MIT.

A set of instructions for creating Playwright end-to-end tests for web interfaces. End-to-end tests simulate complete user journeys, such as signing in, registering, or checking out, and verify navigation, state changes, and errors.

In plain words
What is it for?
Use it to test browser-based workflows, mocked API interactions, page navigation, form behavior, and important interface states.
Why use it?
It helps create reliable tests that check real user flows while avoiding fragile selectors and dependence on a live server's changing data.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it to test browser-based workflows, mocked API interactions, page navigation, form behavior, and important interface states.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/vinhnx/vtchat/playwright-e2e-testing
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.

Clone the repo
git clone --depth 1 https://github.com/vinhnx/vtchat

Made for: Cursor.

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-e2e-testing

README.md
[![agentmods](https://agentmods.dev/badge/rules/vinhnx/vtchat/playwright-e2e-testing/github.svg)](https://agentmods.dev/rules/vinhnx/vtchat/playwright-e2e-testing)
Your own site
<a href="https://agentmods.dev/rules/vinhnx/vtchat/playwright-e2e-testing"><img src="https://agentmods.dev/badge/rules/vinhnx/vtchat/playwright-e2e-testing/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for playwright-e2e-testing

Your own site · 80×15
<a href="https://agentmods.dev/rules/vinhnx/vtchat/playwright-e2e-testing"><img src="https://agentmods.dev/badge/rules/vinhnx/vtchat/playwright-e2e-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 6 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 788 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 89% 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.1 $0.00006 $0.00788
Opus 5.5 $0.00002 $0.00315
Sonnet 5.5 $0.00001 $0.00158
Haiku 4.5 $0.00001 $0.00079

Measured today against content hash cd8694f6a981, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

playwright-e2e-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 today.

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

89% identical to playwright-e2e-testing-cursorrules-prompt-file — 4 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.

.cursor/rules/frontend/.cursor/rules/playwright-e2e-testing.mdc · 93 lines

What it actually says

Persona

You are an expert QA engineer with deep knowledge of Playwright 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 file extensions in test directories
  • 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 test IDs or semantic selectors rather than CSS or XPath selectors Make tests maintainable with descriptive names and proper grouping in test.describe blocks Use Playwright's page.route 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 test.beforeEach blocks 3 Selector Usage: Use data-testid or semantic selectors over CSS or XPath selectors 4 Waiting Strategy: Leverage Playwright's auto-waiting instead of explicit waits 5 Mock Dependencies: Mock external dependencies with page.route 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 Playwright test file with 3-5 tests covering critical user flows

Example End-to-End Test

When testing a login page, implement the following pattern:

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

test.describe('Login Page', () => {
  test.beforeEach(async ({ page }) => {
    await page.route('/api/login', (route) => {
      const body = route.request().postDataJSON();
      if (body.username === 'validUser' && body.password === 'validPass') {
        route.fulfill({
          status: 200,
          body: JSON.stringify({ message: 'Login successful' }),
        });
      } else {
        route.fulfill({
          status: 401,
          body: JSON.stringify({ error: 'Invalid credentials' }),
        });
      }
    });
    await page.goto('/login');
  });

  test('should allow user to log in with valid credentials', async ({
    page,
  }) => {
    await page.locator('[data-testid="username"]').fill('validUser');
    await page.locator('[data-testid="password"]').fill('validPass');
    await page.locator('[data-testid="submit"]').click();
    await expect(page.locator('[data-testid="welcome-message"]')).toBeVisible();
    await expect(page.locator('[data-testid="welcome-message"]')).toHaveText(
      /Welcome, validUser/
    );
  });

  test('should show an error message for invalid credentials', async ({
    page,
  }) => {
    await page.locator('[data-testid="username"]').fill('invalidUser');
    await page.locator('[data-testid="password"]').fill('wrongPass');
    await page.locator('[data-testid="submit"]').click();
    await expect(page.locator('[data-testid="error-message"]')).toBeVisible();
    await expect(page.locator('[data-testid="error-message"]')).toHaveText(
      'Invalid credentials'
    );
  });
});
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. today First seen · 93 lines · 6 tokens per session scan A cd8694f6a981

Subscribe to this mod's changes

playwright-e2e-testing is a cursor rule published in the GitHub repository vinhnx/vtchat (59 stars, last pushed 1mo ago), licensed MIT. It adds 6 tokens to every session and 788 once invoked, about $0.0000 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 89% identical to playwright-e2e-testing-cursorrules-prompt-file, differing in 4 lines, and is treated as a copy.