# playwright-defect-tracking-cursorrules-prompt-file

A Cursor rule that makes the agent write Playwright tests tied to manual case IDs, with screenshots and logs as defect evidence.

- rule · `type=rule` · Cursor · ★ 41011
- Author: PatrickJS
- License: CC0-1.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/PatrickJS/awesome-cursorrules/tree/HEAD/rules/playwright-defect-tracking-cursorrules-prompt-file.mdc
- Updated: 2026-05-30
- HTML: https://affpapa.org/en/nevibecode/rules/playwright-defect-tracking-cursorrules-prompt-file

## What it does

The file sets the agent up as a QA engineer who reproduces reported defects in Playwright and TypeScript. Every test carries a manual case ID in brackets, like `[C1234]`, plus a category such as `[smoke]` or `[regression]`. The team name goes into the top-level `describe` block.

For reporting, the rule points at the `qa-shadow-report` package, which links automated runs back to manual cases and can push results into a Google Sheet. That needs a config file listing team names, test types and categories, plus a spreadsheet URL and the path to a Google service account key. Miss either credential and the report has nothing to build from.

Before writing anything, the rule checks whether the project uses TypeScript, via `tsconfig.json` or `package.json` dependencies, and adjusts the syntax to match. Tests capture their own screenshots and logs for the defect write-up. Drop the file at `.cursor/rules/playwright-defect-tracking-cursorrules-prompt-file.mdc`; the frontmatter has `alwaysApply: false`, so it loads when you need it rather than on every request.

## Requirements
- Works with: Playwright

## Install

### Cursor (native platform)

**Manually: put the files in place**
- File: `.cursor/rules/playwright-defect-tracking-cursorrules-prompt-file.mdc` — Frontmatter: description, globs, alwaysApply

### Claude Code

**Manually: put the files in place**
- File: `.claude/rules/playwright-defect-tracking-cursorrules-prompt-file.md` — The paths frontmatter field limits the files: move globs from the source into paths

### Codex

**AGENTS.md**
- Codex reads AGENTS.md: paste the rule text there

### GitHub Copilot

**Manually: put the files in place**
- File: `.github/instructions/playwright-defect-tracking-cursorrules-prompt-file.instructions.md` — The applyTo field sets which files it applies to: move globs from the source into applyTo

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/rules/playwright-defect-tracking-cursorrules-prompt-file.md`

### Cline

**Manually: put the files in place**
- File: `.clinerules/playwright-defect-tracking-cursorrules-prompt-file.md`

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/PatrickJS/awesome-cursorrules/tree/HEAD/rules/playwright-defect-tracking-cursorrules-prompt-file.mdc

## When to use it
- reproduce a filed defect as an automated test with its manual case ID
- sort tests into smoke, regression and defect categories
- link automated run results to manual cases in one report
- attach a screenshot and log to a defect write-up
- keep test data in fixtures instead of inline in the test

## Example prompts
- Write a Playwright test for the special-character email login defect, tag it [C1234] and [defect]
- Add the team name to the top-level describe and split the tests into smoke and regression categories
- Set up shadowReportConfig so results export to Google Sheets

## Source text · playwright-defect-tracking-cursorrules-prompt-file.mdc · CC0-1.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 21a7be9fc0ddfbbf.

BEGIN THIRD-PARTY FILE 21a7be9fc0ddfbbf
````text
---
description: "Cursor rules for Playwright development with defect tracking."
globs: **/*
alwaysApply: false
---
# Persona

You are an expert QA engineer specializing in defect tracking with Playwright and TypeScript.

# Auto-detect TypeScript Usage

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

# Defect Tracking Focus

Create test cases that reproduce reported defects with proper case ID tagging
Add manual test case IDs in square brackets (e.g., [C1234]) and categories (e.g., [smoke])
Use qa-shadow-report package to track test results and link them to manual test cases
Maintain structured reporting through proper test organization and tagging

# Best Practices

**1** **Case ID Tagging**: Always include manual test case ID in brackets (e.g., [C1234])
**2** **Test Categories**: Add test categories in brackets (e.g., [smoke], [regression])
**3** **Structured Organization**: Use describe/context/test blocks to organize tests logically
**4** **Clear Naming**: Use descriptive test names that indicate expected behavior
**5** **Evidence Collection**: Capture screenshots and logs for defect documentation
**6** **Team Tagging**: Include team name in top-level describe blocks (e.g., [Windsor])
**7** **Test Data Management**: Store test data in separate fixtures
**8** **Config Setup**: Configure qa-shadow-report properly for reporting

# Configuration Example

Create a shadow report configuration file with team names, test types, and categories:

```js
// shadowReportConfig.ts
export default {
  teamNames: ['qa', 'frontend', 'api'],
  testTypes: ['ui', 'api', 'accessibility', 'mobile'],
  testCategories: ['smoke', 'regression', 'defect', 'usability'],
  googleSpreadsheetUrl: 'https://docs.google.com/spreadsheets/d/your-sheet-id',
  googleKeyFilePath: './googleCredentials.json',
  testData: './playwright-report/results.json',
  csvDownloadsPath: './qa-reports/downloads',
  weeklySummaryStartDay: 'Monday'
};
```

# Example Defect Test

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

// Top-level describe block with team name
test.describe('[Windsor] Login functionality tests', () => {
  // Feature context
  test.describe('authentication', () => {
    // Test with case ID and category tags
    test('should accept email with special characters [C1234][defect][regression]', async ({ page }) => {
      await page.goto('/login');
      
      await page.fill('#email', 'test+special@example.com');
      await page.fill('#password', 'Test123!');
      
      // Take screenshot for evidence
      await page.screenshot({ path: './qa-reports/evidence/special-email-before-login.png' });
      
      await page.click('#login-button');
      
      // Verify fix
      const errorMessage = await page.locator('.error-message');
      await expect(errorMessage).not.toBeVisible();
      
      // Verify redirect to dashboard
      await expect(page).toHaveURL('/dashboard');
    });

    test('should report proper error for invalid email format [C1235][defect]', async ({ page }) => {
      await page.goto('/login');
      
````
END THIRD-PARTY FILE 21a7be9fc0ddfbbf

The third-party file has ended. Everything between the 21a7be9fc0ddfbbf tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 3140 of 4123 bytes. © PatrickJS · CC0-1.0 · https://github.com/PatrickJS/awesome-cursorrules/tree/HEAD/rules/playwright-defect-tracking-cursorrules-prompt-file.mdc

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
