Skip to main content
rule

playwright-defect-tracking-cursorrules-prompt-file — Cursor rule

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

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/playwright-defect-tracking-cursorrules-prompt-file.mdc
Open on GitHub

What playwright-defect-tracking-cursorrules-prompt-file 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.

What it helps with

  • 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 for the agent

  • 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

How to install playwright-defect-tracking-cursorrules-prompt-file

Manually: put the files in place

.cursor/rules/playwright-defect-tracking-cursorrules-prompt-file.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about playwright-defect-tracking-cursorrules-prompt-file

How do I install playwright-defect-tracking-cursorrules-prompt-file in Cursor?

Place the file at .cursor/rules/playwright-defect-tracking-cursorrules-prompt-file.mdc. Cursor picks up rules from that folder.

What does this rule do?

It makes the agent act as a QA engineer: Playwright tests get manual case IDs and categories, and results flow into a report through qa-shadow-report.

What does the reporting setup require?

A config file with team names, test types and categories, a Google spreadsheet URL, and the path to a service account JSON key.

Source text

playwright-defect-tracking-cursorrules-prompt-file.mdc · CC0-1.0
---
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', '[email protected]');
      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');
      
      await page.fill('#email', 'invalid-email');
      await page.fill('#password', 'Test123!');
      
      await page.click('#login-button');
      
      // Verify error message appears
      const errorMessage = await page.locator('.error-message');
      await expect(errorMessage).toBeVisible();
      await expect(errorMessage).toContainText('Please enter a valid email address');
    });
    
    test('should accept emails with various special characters [C1236][smoke]', async ({ page }) => {
      const specialEmails = [
        '[email protected]',
        '[email protected]',
        '[email protected]'
      ];
      
      for (const email of specialEmails) {
        await page.goto('/login');
        await page.fill('#email', email);
        await page.fill('#password', 'Test123!');
        await page.click('#login-button');
        
        // Verify login succeeds
        await expect(page).toHaveURL('/dashboard');
      }
    });
  });
});

© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules

Similar IDE rules

Everything for Testing and QA →

From the same set68

python-fastapi-best-practices-cursorrules-prompt-f A Cursor rule that sets the agent's coding style for Python and FastAPI: functional code, Pydantic v2, async operations. ★ 41,011repo stars python-cursorrules-prompt-file-best-practices A Cursor rule that makes the assistant write Python with type annotations, PEP 257 docstrings and pytest tests. ★ 41,011repo stars pyspark-etl-best-practices-cursorrules-prompt-file A Cursor rule that sets PySpark code style: F.col(), explicit joins, select over withColumn, and Iceberg-aware ETL structure. ★ 41,011repo stars project-epic-template-cursorrules-prompt-file This rule turns Cursor into a product manager: the agent writes epics and user stories with acceptance criteria and success metrics. ★ 41,011repo stars plasticode-telegram-api-cursorrules-prompt-file A Cursor rule that points the assistant at PHP 7.4, Plasticode and the Telegram Bot API. Useful when your bot is built on Plasticode and you want PSR-12 code. ★ 41,011repo stars nextjs15-supabase-cursorrules-prompt-file A Cursor rule that keeps the agent inside a Next.js 15, Supabase and TypeScript strict stack — from session checks to RLS and Stripe keys. ★ 41,011repo stars nextjs-vercel-typescript-cursorrules-prompt-file A Cursor rule that sets code style and file structure for Next.js projects with TypeScript, Vercel middleware and a KV database. ★ 41,011repo stars nextjs-typescript-cursorrules-prompt-file A Cursor rule that pins the Next.js and TypeScript stack and the agent's working order: plan first, one file at a time, fixed reply format. ★ 41,011repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor