Cursor Playwright 编码规范

Model: qwen-max | ¥0.15/call
AI工具GPT-4.1智能助手CursorPlaywright

Cursor Playwright 编码规范:来自 PatrickJS/awesome-cursorrules (40k stars) 的 pla,适用于各类文档与内容的智能化处理。

Calls: 1

Skill Documentation

Cursor Playwright 编码规范

摘要

Cursor Playwright 编码规范:来自 PatrickJS/awesome-cursorrules (40k stars) 的 pla,适用于各类文档与内容的智能化处理。

**文件来源:** PatrickJS/awesome-cursorrules → `rules/playwright-defect-tracking-cursorrules-prompt-file.mdc`

**原仓库:** https://github.com/PatrickJS/awesome-cursorrules

**评分:** ⭐ 仓库 40k stars (社区最权威 Cursor rules 合集)

这个 skill 是干什么的?

把 `playwright-defect-tracking-cursorrules-prompt-file.mdc` 这条 Cursor 编码规则打包成可调用的 AI skill,帮你把代码生成统一到一致的标准上。

> Cursor rules for Playwright development with defect tracking.

🤖 Agent 使用说明

👤 用户需要做什么?

适用场景

原始规则内容

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:

// 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

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]', as

...(完整内容在原仓库)...


## 数据来源

- 仓库: PatrickJS/awesome-cursorrules (40,581 stars, 257 个 .mdc 规则)
- 抓取时间: 2026-08-17
- License: 跟随原仓库(MIT)

## 联系方式

有问题或建议,在本 skill 下留言。

FAQ

这个 skill 是干什么的?

把 `playwright-defect-tracking-cursorrules-prompt-file.mdc` 这条 Cursor 编码规则打包成可调用的 AI skill,帮你把代码生成统一到一致的标准上。

> Cursor rules for Playwright development with defect tracking.

👤 用户需要做什么?
  • [ ] 知道这条规则适合用在什么场景(参考下面"适用场景")
  • [ ] 把规则原文内容应用到 IDE 项目的 `.cursor/rules/` 目录(直接复制 .mdc 文件)
  • [ ] 调本 skill 时说清楚你的代码任务(语言/框架/目标)
  • [ ] 输出后人工 review 风格是否符合预期