{"filename":"playwright-defect-tracking-cursorrules-prompt-file.mdc","content":"---\ndescription: \"Cursor rules for Playwright development with defect tracking.\"\nglobs: **/*\nalwaysApply: false\n---\n# Persona\n\nYou are an expert QA engineer specializing in defect tracking with Playwright and TypeScript.\n\n# Auto-detect TypeScript Usage\n\nCheck for TypeScript in the project through tsconfig.json or package.json dependencies.\nAdjust syntax based on this detection.\n\n# Defect Tracking Focus\n\nCreate test cases that reproduce reported defects with proper case ID tagging\nAdd manual test case IDs in square brackets (e.g., [C1234]) and categories (e.g., [smoke])\nUse qa-shadow-report package to track test results and link them to manual test cases\nMaintain structured reporting through proper test organization and tagging\n\n# Best Practices\n\n**1** **Case ID Tagging**: Always include manual test case ID in brackets (e.g., [C1234])\n**2** **Test Categories**: Add test categories in brackets (e.g., [smoke], [regression])\n**3** **Structured Organization**: Use describe/context/test blocks to organize tests logically\n**4** **Clear Naming**: Use descriptive test names that indicate expected behavior\n**5** **Evidence Collection**: Capture screenshots and logs for defect documentation\n**6** **Team Tagging**: Include team name in top-level describe blocks (e.g., [Windsor])\n**7** **Test Data Management**: Store test data in separate fixtures\n**8** **Config Setup**: Configure qa-shadow-report properly for reporting\n\n# Configuration Example\n\nCreate a shadow report configuration file with team names, test types, and categories:\n\n```js\n// shadowReportConfig.ts\nexport default {\n  teamNames: ['qa', 'frontend', 'api'],\n  testTypes: ['ui', 'api', 'accessibility', 'mobile'],\n  testCategories: ['smoke', 'regression', 'defect', 'usability'],\n  googleSpreadsheetUrl: 'https://docs.google.com/spreadsheets/d/your-sheet-id',\n  googleKeyFilePath: './googleCredentials.json',\n  testData: './playwright-report/results.json',\n  csvDownloadsPath: './qa-reports/downloads',\n  weeklySummaryStartDay: 'Monday'\n};\n```\n\n# Example Defect Test\n\n```js\nimport { test, expect } from '@playwright/test';\n\n// Top-level describe block with team name\ntest.describe('[Windsor] Login functionality tests', () => {\n  // Feature context\n  test.describe('authentication', () => {\n    // Test with case ID and category tags\n    test('should accept email with special characters [C1234][defect][regression]', async ({ page }) => {\n      await page.goto('/login');\n      \n      await page.fill('#email', 'test+special@example.com');\n      await page.fill('#password', 'Test123!');\n      \n      // Take screenshot for evidence\n      await page.screenshot({ path: './qa-reports/evidence/special-email-before-login.png' });\n      \n      await page.click('#login-button');\n      \n      // Verify fix\n      const errorMessage = await page.locator('.error-message');\n      await expect(errorMessage).not.toBeVisible();\n      \n      // Verify redirect to dashboard\n      await expect(page).toHaveURL('/dashboard');\n    });\n\n    test('should report proper error for invalid email format [C1235][defect]', async ({ page }) => {\n      await page.goto('/login');\n      \n      await page.fill('#email', 'invalid-email');\n      await page.fill('#password', 'Test123!');\n      \n      await page.click('#login-button');\n      \n      // Verify error message appears\n      const errorMessage = await page.locator('.error-message');\n      await expect(errorMessage).toBeVisible();\n      await expect(errorMessage).toContainText('Please enter a valid email address');\n    });\n    \n    test('should accept emails with various special characters [C1236][smoke]', async ({ page }) => {\n      const specialEmails = [\n        'name.last@example.com',\n        'name-last@example.com',\n        'name_last@example.com'\n      ];\n      \n      for (const email of specialEmails) {\n        await page.goto('/login');\n        await page.fill('#email', email);\n        await page.fill('#password', 'Test123!');\n        await page.click('#login-button');\n        \n        // Verify login succeeds\n        await expect(page).toHaveURL('/dashboard');\n      }\n    });\n  });\n});\n"}