[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M72T3HYRQC9MA4NX85GCF5XP":3,"skill-same:01M72T3HYRQC9MA4NX85GCF5XP":50},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":29,"commitSha":30,"skillDirectory":31,"forksCount":14,"repositoryHtmlUrl":32,"repositoryHomepageUrl":32,"ownerHtmlUrl":33,"ownerBlogUrl":6,"ownerDescription":34,"updatedAt":35,"install":36,"resources":49},"01M72T3HYRQC9MA4NX85GCF5XP","playwright",null,"Playwright E2E testing patterns. Trigger: When writing E2E tests - Page Objects, selectors, MCP workflow.","iberi22\u002Fskills","iberi22","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F10615454?v=4","01M72SQ2NXAA3GW0FSH053A5ES","Brahyan Belalcazar","01M72SQ2PYCH0SSA1K61NGEHDV",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fiberi22\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fgeneral\u002Fgentleman-playwright\u002FSKILL.md",[],[],"2026-11-10 22:39:42",false,"---\nname: playwright\ndescription: >\n  Playwright E2E testing patterns.\n  Trigger: When writing E2E tests - Page Objects, selectors, MCP workflow.\nlicense: Apache-2.0\nupdated: \"2026-10-02\"\nmetadata:\n  author: gentleman-programming\n  version: \"1.2\"\n---\n\n## MCP Workflow\n\nIf Playwright MCP tools are available, explore the target flow first (snapshot, interact, note real roles and labels) so selectors come from the live DOM, not guesses.\n\n**If MCP NOT available:** Proceed with test creation based on docs and code analysis.\n\n**Why This Matters:**\n- ✅ Precise tests - exact steps needed, no assumptions\n- ✅ Accurate selectors - real DOM structure, not imagined\n- ✅ Real flow validation - verify journey actually works\n- ✅ Avoid over-engineering - minimal tests for what exists\n- ✅ Prevent flaky tests - real exploration = stable tests\n- ❌ Never assume how UI \"should\" work\n\n## File Structure\n\n```\ntests\u002F\n├── base-page.ts              # Parent class for ALL pages\n├── helpers.ts                # Shared utilities\n└── {page-name}\u002F\n    ├── {page-name}-page.ts   # Page Object Model\n    ├── {page-name}.spec.ts   # ALL tests here (NO separate files!)\n    └── {page-name}.md        # Test documentation\n```\n\n**File Naming:**\n- ✅ `sign-up.spec.ts` (all sign-up tests)\n- ✅ `sign-up-page.ts` (page object)\n- ✅ `sign-up.md` (documentation)\n- ❌ `sign-up-critical-path.spec.ts` (WRONG - no separate files)\n- ❌ `sign-up-validation.spec.ts` (WRONG)\n\n## Selector Priority (REQUIRED)\n\n```typescript\n\u002F\u002F 1. BEST - getByRole for interactive elements\nthis.submitButton = page.getByRole(\"button\", { name: \"Submit\" });\nthis.navLink = page.getByRole(\"link\", { name: \"Dashboard\" });\n\n\u002F\u002F 2. BEST - getByLabel for form controls\nthis.emailInput = page.getByLabel(\"Email\");\nthis.passwordInput = page.getByLabel(\"Password\");\n\n\u002F\u002F 3. SPARINGLY - getByText for static content only\nthis.errorMessage = page.getByText(\"Invalid credentials\");\nthis.pageTitle = page.getByText(\"Welcome\");\n\n\u002F\u002F 4. LAST RESORT - getByTestId when above fail\nthis.customWidget = page.getByTestId(\"date-picker\");\n\n\u002F\u002F ❌ AVOID fragile selectors\nthis.button = page.locator(\".btn-primary\");  \u002F\u002F NO\nthis.input = page.locator(\"#email\");         \u002F\u002F NO\n```\n\n## Scope Detection (ASK IF AMBIGUOUS)\n\n| User Says | Action |\n|-----------|--------|\n| \"a test\", \"one test\", \"new test\", \"add test\" | Create ONE test() in existing spec |\n| \"comprehensive tests\", \"all tests\", \"test suite\", \"generate tests\" | Create full suite |\n\n**Examples:**\n- \"Create a test for user sign-up\" → ONE test only\n- \"Generate E2E tests for login page\" → Full suite\n- \"Add a test to verify form validation\" → ONE test to existing spec\n\n## Page Object Pattern\n\n```typescript\nimport { Page, Locator, expect } from \"@playwright\u002Ftest\";\n\n\u002F\u002F BasePage - ALL pages extend this\nexport class BasePage {\n  constructor(protected page: Page) {}\n\n  async goto(path: string): Promise\u003Cvoid> {\n    await this.page.goto(path);\n    await this.page.waitForLoadState(\"networkidle\");\n  }\n\n  \u002F\u002F Common methods go here (see Refactoring Guidelines)\n  async waitForNotification(): Promise\u003Cvoid> {\n    await this.page.waitForSelector('[role=\"status\"]');\n  }\n\n  async verifyNotificationMessage(message: string): Promise\u003Cvoid> {\n    const notification = this.page.locator('[role=\"status\"]');\n    await expect(notification).toContainText(message);\n  }\n}\n\n\u002F\u002F Page-specific implementation\nexport interface LoginData {\n  email: string;\n  password: string;\n}\n\nexport class LoginPage extends BasePage {\n  readonly emailInput: Locator;\n  readonly passwordInput: Locator;\n  readonly submitButton: Locator;\n\n  constructor(page: Page) {\n    super(page);\n    this.emailInput = page.getByLabel(\"Email\");\n    this.passwordInput = page.getByLabel(\"Password\");\n    this.submitButton = page.getByRole(\"button\", { name: \"Sign in\" });\n  }\n\n  async goto(): Promise\u003Cvoid> {\n    await super.goto(\"\u002Flogin\");\n  }\n\n  async login(data: LoginData): Promise\u003Cvoid> {\n    await this.emailInput.fill(data.email);\n    await this.passwordInput.fill(data.password);\n    await this.submitButton.click();\n  }\n\n  async verifyCriticalOutcome(): Promise\u003Cvoid> {\n    await expect(this.page).toHaveURL(\"\u002Fdashboard\");\n  }\n}\n```\n\n## Page Object Reuse\n\nReuse existing page objects in `tests\u002F` before creating new ones.\n\n```typescript\n\u002F\u002F ✅ GOOD: Reuse existing page objects\nimport { SignInPage } from \"..\u002Fsign-in\u002Fsign-in-page\";\nimport { HomePage } from \"..\u002Flanding\u002Fhome-page\";\n\ntest(\"User can sign up and login\", async ({ page }) => {\n  const signUpPage = new SignUpPage(page);\n  const signInPage = new SignInPage(page);  \u002F\u002F REUSE\n  const homePage = new HomePage(page);      \u002F\u002F REUSE\n\n  await signUpPage.signUp(userData);\n  await homePage.verifyPageLoaded();  \u002F\u002F REUSE method\n  await homePage.signOut();           \u002F\u002F REUSE method\n  await signInPage.login(credentials); \u002F\u002F REUSE method\n});\n\n\u002F\u002F ❌ BAD: Recreating existing functionality\nexport class SignUpPage extends BasePage {\n  async logout() { \u002F* ... *\u002F }  \u002F\u002F ❌ HomePage already has this\n  async login() { \u002F* ... *\u002F }   \u002F\u002F ❌ SignInPage already has this\n}\n```\n\n**Guidelines:**\n- Check `tests\u002F` for existing page objects first\n- Import and reuse existing pages\n- Create page objects only when page doesn't exist\n- If test requires multiple pages, ensure all page objects exist (create if needed)\n\n## Refactoring Guidelines\n\n### Move to `BasePage` when:\n- ✅ Navigation helpers used by multiple pages (`waitForPageLoad()`, `getCurrentUrl()`)\n- ✅ Common UI interactions (notifications, modals, theme toggles)\n- ✅ Verification patterns repeated across pages (`isVisible()`, `waitForVisible()`)\n- ✅ Error handling that applies to all pages\n- ✅ Screenshot utilities for debugging\n\n### Move to `helpers.ts` when:\n- ✅ Test data generation (`generateUniqueEmail()`, `generateTestUser()`)\n- ✅ Setup\u002Fteardown utilities (`createTestUser()`, `cleanupTestData()`)\n- ✅ Custom assertions (`expectNotificationToContain()`)\n- ✅ API helpers for test setup (`seedDatabase()`, `resetState()`)\n- ✅ Time utilities (`waitForCondition()`, `retryAction()`)\n\n**Before (BAD):**\n```typescript\n\u002F\u002F Repeated in multiple page objects\nexport class SignUpPage extends BasePage {\n  async waitForNotification(): Promise\u003Cvoid> {\n    await this.page.waitForSelector('[role=\"status\"]');\n  }\n}\nexport class SignInPage extends BasePage {\n  async waitForNotification(): Promise\u003Cvoid> {\n    await this.page.waitForSelector('[role=\"status\"]');  \u002F\u002F DUPLICATED!\n  }\n}\n```\n\n**After (GOOD):**\n```typescript\n\u002F\u002F BasePage - shared across all pages\nexport class BasePage {\n  async waitForNotification(): Promise\u003Cvoid> {\n    await this.page.waitForSelector('[role=\"status\"]');\n  }\n}\n\n\u002F\u002F helpers.ts - data generation\nexport function generateUniqueEmail(): string {\n  return `test.${Date.now()}@example.com`;\n}\n\nexport function generateTestUser() {\n  return {\n    name: \"Test User\",\n    email: generateUniqueEmail(),\n    password: \"TestPassword123!\",\n  };\n}\n```\n\n## Test Pattern with Tags\n\n```typescript\nimport { test, expect } from \"@playwright\u002Ftest\";\nimport { LoginPage } from \".\u002Flogin-page\";\n\ntest.describe(\"Login\", () => {\n  test(\"User can login successfully\",\n    { tag: [\"@critical\", \"@e2e\", \"@login\", \"@LOGIN-E2E-001\"] },\n    async ({ page }) => {\n      const loginPage = new LoginPage(page);\n\n      await loginPage.goto();\n      await loginPage.login({ email: \"user@test.com\", password: \"pass123\" });\n\n      await expect(page).toHaveURL(\"\u002Fdashboard\");\n    }\n  );\n});\n```\n\n**Tag Categories:**\n- Priority: `@critical`, `@high`, `@medium`, `@low`\n- Type: `@e2e`\n- Feature: `@signup`, `@signin`, `@dashboard`\n- Test ID: `@SIGNUP-E2E-001`, `@LOGIN-E2E-002`\n\n## Test Documentation Format ({page-name}.md)\n\n```markdown\n### E2E Tests: {Feature Name}\n\n**Suite ID:** `{SUITE-ID}`\n**Feature:** {Feature description}\n\n---\n\n## Test Case: `{TEST-ID}` - {Test case title}\n\n**Priority:** `{critical|high|medium|low}`\n\n**Tags:**\n- type → @e2e\n- feature → @{feature-name}\n\n**Description\u002FObjective:** {Brief description}\n\n**Preconditions:**\n- {Prerequisites for test to run}\n- {Required data or state}\n\n### Flow Steps:\n1. {Step 1}\n2. {Step 2}\n3. {Step 3}\n\n### Expected Result:\n- {Expected outcome 1}\n- {Expected outcome 2}\n\n### Key verification points:\n- {Assertion 1}\n- {Assertion 2}\n\n### Notes:\n- {Additional considerations}\n```\n\n**Documentation Rules:**\n- ❌ NO general test running instructions\n- ❌ NO file structure explanations\n- ❌ NO code examples or tutorials\n- ❌ NO troubleshooting sections\n- ✅ Focus ONLY on specific test case\n- ✅ Keep under 60 lines when possible\n\n## Hardening rules\n\nEach one cost a red suite or a false green in practice.\n\n- **Scope cookies with `url`, never `domain: 'localhost'`.** The suite runs against `BASE_URL`\n  (a loopback IP such as 127.0.0.1 plus a port, in CI and worktrees); a `localhost` cookie never travels there, so every authenticated spec\n  bounced to `\u002Flogin`. Put session setup in ONE helper (`helpers\u002Fauth.ts: useAdminSession(context)`) built from\n  `new URL(process.env.BASE_URL)`; inline `addCookies` copies drift.\n- **The helper must carry every cookie the middleware gates on**, not just the session (an onboarding gate may also need\n  a cookie such as `onboarding=\u003CuserId>`, or the protected route redirects to onboarding). When the app adds a gate, update the helper, not 30 specs.\n- **Hit the real verb.** A logout spec did `page.goto('\u002Fapi\u002Fauth\u002Flogout')` (GET) on a POST-only endpoint: 404,\n  and it passed without logging out. Use `request.post` and assert the `Set-Cookie` that ends the session.\n- **No sleeps.** Wait on a locator, a URL (`waitForURL`), or a response; `expect` already retries.\n- **Selectors from the live app**, never from memory: Playwright MCP \u002F `codegen`, or `e2e mcp` (see\n  tester-army\u002Fe2e). Prefer role + accessible name and `data-testid`; text selectors break on copy\u002Ftheme changes.\n- **Test the commit you claim.** Pin the worktree to the exact SHA and say it in the report. Two QA runs on\n  re-reported bugs already fixed 10 commits later.\n- **Classify every failure with evidence** — outdated test \u002F real app bug \u002F environment — and never weaken an\n  assertion to get green. `test.skip` only for hardware\u002Fnetwork the runner lacks, with why.\n- **Prefer a production build\u002Fpreview for long or parallel runs.** Astro+workerd dev servers recompile on first\n  visit, can answer 500 \"unable to find a component instance\" for prerendered pages after a reload, and lose\n  in-memory seed data when Vite reoptimizes: re-warm and re-seed before blaming the app.\n- **Theme and device matrix**: set the theme before first paint with `context.addInitScript(() =>\n  localStorage.setItem('\u003Ctheme-key>', 'dark'))` (setting it after `goto` screenshots the default theme); mobile\n  = `{ viewport: {width: 390, height: 844}, isMobile: true, hasTouch: true }`.\n- **Headless screenshots can come out one flat color** (dark mode, `fullPage`, WebGL). Launch Chromium with\n  `--use-angle=swiftshader`, detect single-color PNGs and retry with a viewport as tall as `scrollHeight`\n  (a visual-sweep script can do both); WebGPU pages need a WebGL fallback flag (`?gl=1`).\n- **Compile every template in unit tests**: a stray parenthesis in one\n  shared `.astro` component took down seven pages and no spec caught it before a full e2e run.\n\nFor exploratory QA and bug bashes before a demo, layer tester-army\u002Fe2e on top; keep this\nPlaywright suite as the deterministic gate.\n\n## Commands\n\n```bash\nnpx playwright test                    # Run all\nnpx playwright test --grep \"login\"     # Filter by name\nnpx playwright test --ui               # Interactive UI\nnpx playwright test --debug            # Debug mode\nnpx playwright test tests\u002Flogin\u002F       # Run specific folder\n```\n\n## Keywords\nplaywright, e2e, testing, page object model, selectors, end-to-end, mcp\n","## MCP Workflow\n\nIf Playwright MCP tools are available, explore the target flow first (snapshot, interact, note real roles and labels) so selectors come from the live DOM, not guesses.\n\n**If MCP NOT available:** Proceed with test creation based on docs and code analysis.\n\n**Why This Matters:**\n- ✅ Precise tests - exact steps needed, no assumptions\n- ✅ Accurate selectors - real DOM structure, not imagined\n- ✅ Real flow validation - verify journey actually works\n- ✅ Avoid over-engineering - minimal tests for what exists\n- ✅ Prevent flaky tests - real exploration = stable tests\n- ❌ Never assume how UI \"should\" work\n\n## File Structure\n\n```\ntests\u002F\n├── base-page.ts              # Parent class for ALL pages\n├── helpers.ts                # Shared utilities\n└── {page-name}\u002F\n    ├── {page-name}-page.ts   # Page Object Model\n    ├── {page-name}.spec.ts   # ALL tests here (NO separate files!)\n    └── {page-name}.md        # Test documentation\n```\n\n**File Naming:**\n- ✅ `sign-up.spec.ts` (all sign-up tests)\n- ✅ `sign-up-page.ts` (page object)\n- ✅ `sign-up.md` (documentation)\n- ❌ `sign-up-critical-path.spec.ts` (WRONG - no separate files)\n- ❌ `sign-up-validation.spec.ts` (WRONG)\n\n## Selector Priority (REQUIRED)\n\n```typescript\n\u002F\u002F 1. BEST - getByRole for interactive elements\nthis.submitButton = page.getByRole(\"button\", { name: \"Submit\" });\nthis.navLink = page.getByRole(\"link\", { name: \"Dashboard\" });\n\n\u002F\u002F 2. BEST - getByLabel for form controls\nthis.emailInput = page.getByLabel(\"Email\");\nthis.passwordInput = page.getByLabel(\"Password\");\n\n\u002F\u002F 3. SPARINGLY - getByText for static content only\nthis.errorMessage = page.getByText(\"Invalid credentials\");\nthis.pageTitle = page.getByText(\"Welcome\");\n\n\u002F\u002F 4. LAST RESORT - getByTestId when above fail\nthis.customWidget = page.getByTestId(\"date-picker\");\n\n\u002F\u002F ❌ AVOID fragile selectors\nthis.button = page.locator(\".btn-primary\");  \u002F\u002F NO\nthis.input = page.locator(\"#email\");         \u002F\u002F NO\n```\n\n## Scope Detection (ASK IF AMBIGUOUS)\n\n| User Says | Action |\n|-----------|--------|\n| \"a test\", \"one test\", \"new test\", \"add test\" | Create ONE test() in existing spec |\n| \"comprehensive tests\", \"all tests\", \"test suite\", \"generate tests\" | Create full suite |\n\n**Examples:**\n- \"Create a test for user sign-up\" → ONE test only\n- \"Generate E2E tests for login page\" → Full suite\n- \"Add a test to verify form validation\" → ONE test to existing spec\n\n## Page Object Pattern\n\n```typescript\nimport { Page, Locator, expect } from \"@playwright\u002Ftest\";\n\n\u002F\u002F BasePage - ALL pages extend this\nexport class BasePage {\n  constructor(protected page: Page) {}\n\n  async goto(path: string): Promise\u003Cvoid> {\n    await this.page.goto(path);\n    await this.page.waitForLoadState(\"networkidle\");\n  }\n\n  \u002F\u002F Common methods go here (see Refactoring Guidelines)\n  async waitForNotification(): Promise\u003Cvoid> {\n    await this.page.waitForSelector('[role=\"status\"]');\n  }\n\n  async verifyNotificationMessage(message: string): Promise\u003Cvoid> {\n    const notification = this.page.locator('[role=\"status\"]');\n    await expect(notification).toContainText(message);\n  }\n}\n\n\u002F\u002F Page-specific implementation\nexport interface LoginData {\n  email: string;\n  password: string;\n}\n\nexport class LoginPage extends BasePage {\n  readonly emailInput: Locator;\n  readonly passwordInput: Locator;\n  readonly submitButton: Locator;\n\n  constructor(page: Page) {\n    super(page);\n    this.emailInput = page.getByLabel(\"Email\");\n    this.passwordInput = page.getByLabel(\"Password\");\n    this.submitButton = page.getByRole(\"button\", { name: \"Sign in\" });\n  }\n\n  async goto(): Promise\u003Cvoid> {\n    await super.goto(\"\u002Flogin\");\n  }\n\n  async login(data: LoginData): Promise\u003Cvoid> {\n    await this.emailInput.fill(data.email);\n    await this.passwordInput.fill(data.password);\n    await this.submitButton.click();\n  }\n\n  async verifyCriticalOutcome(): Promise\u003Cvoid> {\n    await expect(this.page).toHaveURL(\"\u002Fdashboard\");\n  }\n}\n```\n\n## Page Object Reuse\n\nReuse existing page objects in `tests\u002F` before creating new ones.\n\n```typescript\n\u002F\u002F ✅ GOOD: Reuse existing page objects\nimport { SignInPage } from \"..\u002Fsign-in\u002Fsign-in-page\";\nimport { HomePage } from \"..\u002Flanding\u002Fhome-page\";\n\ntest(\"User can sign up and login\", async ({ page }) => {\n  const signUpPage = new SignUpPage(page);\n  const signInPage = new SignInPage(page);  \u002F\u002F REUSE\n  const homePage = new HomePage(page);      \u002F\u002F REUSE\n\n  await signUpPage.signUp(userData);\n  await homePage.verifyPageLoaded();  \u002F\u002F REUSE method\n  await homePage.signOut();           \u002F\u002F REUSE method\n  await signInPage.login(credentials); \u002F\u002F REUSE method\n});\n\n\u002F\u002F ❌ BAD: Recreating existing functionality\nexport class SignUpPage extends BasePage {\n  async logout() { \u002F* ... *\u002F }  \u002F\u002F ❌ HomePage already has this\n  async login() { \u002F* ... *\u002F }   \u002F\u002F ❌ SignInPage already has this\n}\n```\n\n**Guidelines:**\n- Check `tests\u002F` for existing page objects first\n- Import and reuse existing pages\n- Create page objects only when page doesn't exist\n- If test requires multiple pages, ensure all page objects exist (create if needed)\n\n## Refactoring Guidelines\n\n### Move to `BasePage` when:\n- ✅ Navigation helpers used by multiple pages (`waitForPageLoad()`, `getCurrentUrl()`)\n- ✅ Common UI interactions (notifications, modals, theme toggles)\n- ✅ Verification patterns repeated across pages (`isVisible()`, `waitForVisible()`)\n- ✅ Error handling that applies to all pages\n- ✅ Screenshot utilities for debugging\n\n### Move to `helpers.ts` when:\n- ✅ Test data generation (`generateUniqueEmail()`, `generateTestUser()`)\n- ✅ Setup\u002Fteardown utilities (`createTestUser()`, `cleanupTestData()`)\n- ✅ Custom assertions (`expectNotificationToContain()`)\n- ✅ API helpers for test setup (`seedDatabase()`, `resetState()`)\n- ✅ Time utilities (`waitForCondition()`, `retryAction()`)\n\n**Before (BAD):**\n```typescript\n\u002F\u002F Repeated in multiple page objects\nexport class SignUpPage extends BasePage {\n  async waitForNotification(): Promise\u003Cvoid> {\n    await this.page.waitForSelector('[role=\"status\"]');\n  }\n}\nexport class SignInPage extends BasePage {\n  async waitForNotification(): Promise\u003Cvoid> {\n    await this.page.waitForSelector('[role=\"status\"]');  \u002F\u002F DUPLICATED!\n  }\n}\n```\n\n**After (GOOD):**\n```typescript\n\u002F\u002F BasePage - shared across all pages\nexport class BasePage {\n  async waitForNotification(): Promise\u003Cvoid> {\n    await this.page.waitForSelector('[role=\"status\"]');\n  }\n}\n\n\u002F\u002F helpers.ts - data generation\nexport function generateUniqueEmail(): string {\n  return `test.${Date.now()}@example.com`;\n}\n\nexport function generateTestUser() {\n  return {\n    name: \"Test User\",\n    email: generateUniqueEmail(),\n    password: \"TestPassword123!\",\n  };\n}\n```\n\n## Test Pattern with Tags\n\n```typescript\nimport { test, expect } from \"@playwright\u002Ftest\";\nimport { LoginPage } from \".\u002Flogin-page\";\n\ntest.describe(\"Login\", () => {\n  test(\"User can login successfully\",\n    { tag: [\"@critical\", \"@e2e\", \"@login\", \"@LOGIN-E2E-001\"] },\n    async ({ page }) => {\n      const loginPage = new LoginPage(page);\n\n      await loginPage.goto();\n      await loginPage.login({ email: \"user@test.com\", password: \"pass123\" });\n\n      await expect(page).toHaveURL(\"\u002Fdashboard\");\n    }\n  );\n});\n```\n\n**Tag Categories:**\n- Priority: `@critical`, `@high`, `@medium`, `@low`\n- Type: `@e2e`\n- Feature: `@signup`, `@signin`, `@dashboard`\n- Test ID: `@SIGNUP-E2E-001`, `@LOGIN-E2E-002`\n\n## Test Documentation Format ({page-name}.md)\n\n```markdown\n### E2E Tests: {Feature Name}\n\n**Suite ID:** `{SUITE-ID}`\n**Feature:** {Feature description}\n\n---\n\n## Test Case: `{TEST-ID}` - {Test case title}\n\n**Priority:** `{critical|high|medium|low}`\n\n**Tags:**\n- type → @e2e\n- feature → @{feature-name}\n\n**Description\u002FObjective:** {Brief description}\n\n**Preconditions:**\n- {Prerequisites for test to run}\n- {Required data or state}\n\n### Flow Steps:\n1. {Step 1}\n2. {Step 2}\n3. {Step 3}\n\n### Expected Result:\n- {Expected outcome 1}\n- {Expected outcome 2}\n\n### Key verification points:\n- {Assertion 1}\n- {Assertion 2}\n\n### Notes:\n- {Additional considerations}\n```\n\n**Documentation Rules:**\n- ❌ NO general test running instructions\n- ❌ NO file structure explanations\n- ❌ NO code examples or tutorials\n- ❌ NO troubleshooting sections\n- ✅ Focus ONLY on specific test case\n- ✅ Keep under 60 lines when possible\n\n## Hardening rules\n\nEach one cost a red suite or a false green in practice.\n\n- **Scope cookies with `url`, never `domain: 'localhost'`.** The suite runs against `BASE_URL`\n  (a loopback IP such as 127.0.0.1 plus a port, in CI and worktrees); a `localhost` cookie never travels there, so every authenticated spec\n  bounced to `\u002Flogin`. Put session setup in ONE helper (`helpers\u002Fauth.ts: useAdminSession(context)`) built from\n  `new URL(process.env.BASE_URL)`; inline `addCookies` copies drift.\n- **The helper must carry every cookie the middleware gates on**, not just the session (an onboarding gate may also need\n  a cookie such as `onboarding=\u003CuserId>`, or the protected route redirects to onboarding). When the app adds a gate, update the helper, not 30 specs.\n- **Hit the real verb.** A logout spec did `page.goto('\u002Fapi\u002Fauth\u002Flogout')` (GET) on a POST-only endpoint: 404,\n  and it passed without logging out. Use `request.post` and assert the `Set-Cookie` that ends the session.\n- **No sleeps.** Wait on a locator, a URL (`waitForURL`), or a response; `expect` already retries.\n- **Selectors from the live app**, never from memory: Playwright MCP \u002F `codegen`, or `e2e mcp` (see\n  tester-army\u002Fe2e). Prefer role + accessible name and `data-testid`; text selectors break on copy\u002Ftheme changes.\n- **Test the commit you claim.** Pin the worktree to the exact SHA and say it in the report. Two QA runs on\n  re-reported bugs already fixed 10 commits later.\n- **Classify every failure with evidence** — outdated test \u002F real app bug \u002F environment — and never weaken an\n  assertion to get green. `test.skip` only for hardware\u002Fnetwork the runner lacks, with why.\n- **Prefer a production build\u002Fpreview for long or parallel runs.** Astro+workerd dev servers recompile on first\n  visit, can answer 500 \"unable to find a component instance\" for prerendered pages after a reload, and lose\n  in-memory seed data when Vite reoptimizes: re-warm and re-seed before blaming the app.\n- **Theme and device matrix**: set the theme before first paint with `context.addInitScript(() =>\n  localStorage.setItem('\u003Ctheme-key>', 'dark'))` (setting it after `goto` screenshots the default theme); mobile\n  = `{ viewport: {width: 390, height: 844}, isMobile: true, hasTouch: true }`.\n- **Headless screenshots can come out one flat color** (dark mode, `fullPage`, WebGL). Launch Chromium with\n  `--use-angle=swiftshader`, detect single-color PNGs and retry with a viewport as tall as `scrollHeight`\n  (a visual-sweep script can do both); WebGPU pages need a WebGL fallback flag (`?gl=1`).\n- **Compile every template in unit tests**: a stray parenthesis in one\n  shared `.astro` component took down seven pages and no spec caught it before a full e2e run.\n\nFor exploratory QA and bug bashes before a demo, layer tester-army\u002Fe2e on top; keep this\nPlaywright suite as the deterministic gate.\n\n## Commands\n\n```bash\nnpx playwright test                    # Run all\nnpx playwright test --grep \"login\"     # Filter by name\nnpx playwright test --ui               # Interactive UI\nnpx playwright test --debug            # Debug mode\nnpx playwright test tests\u002Flogin\u002F       # Run specific folder\n```\n\n## Keywords\nplaywright, e2e, testing, page object model, selectors, end-to-end, mcp\n",{"name":5,"license":15,"updated":24,"metadata":25,"description":28},"2026-10-02",{"author":26,"version":27},"gentleman-programming","1.2","Playwright E2E testing patterns. Trigger: When writing E2E tests - Page Objects, selectors, MCP workflow.\n","main","688810f2886d212632acf81e532b24e483dd8b98","skills\u002Fgeneral\u002Fgentleman-playwright","https:\u002F\u002Fgithub.com\u002Fiberi22\u002Fskills","https:\u002F\u002Fgithub.com\u002Fiberi22","Senior WEB Full-Stack","2026-10-12 02:46:21",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add iberi22\u002Fskills --skill playwright",{"tool":42,"command":43},"bunx","bunx skills add iberi22\u002Fskills --skill playwright",{"tool":45,"command":46},"pnpm","pnpm dlx skills add iberi22\u002Fskills --skill playwright","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fiberi22\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fgeneral\u002Fgentleman-playwright\u002FSKILL.md",true,[],[51,58,65,71,77,83],{"skillNo":52,"name":53,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":54,"licenseFileUrl":6,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":19},"01M72TWQEQD46ZC9TRBAABF78P","web-design-guidelines","MIT","https:\u002F\u002Fgithub.com\u002Fiberi22\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fweb\u002Fweb-design-guidelines\u002FSKILL.md",[],[],{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":54,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":19},"01M72TWMQFTYD08DGXVAXRPPEB","blocked-page-recovery","Use when a fetch fails: 403\u002F429, paywall, WAF, bot wall. Recovers the page via archives and provenance-checked fallbacks.","https:\u002F\u002Fgithub.com\u002Fiberi22\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fweb\u002Fblocked-page-recovery\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":54,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M72TVQMS3HCTX18C8T97WTQQ","studio-coach","https:\u002F\u002Fgithub.com\u002Fiberi22\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Ftools\u002Fstudio-coach\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":54,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M72TVNA2PR9RZW0ZAXYP1G6J","src-generator","https:\u002F\u002Fgithub.com\u002Fiberi22\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Ftools\u002Fsrc-generator\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":54,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M72TVEJHHB6SAT3R3TY9MJKS","sqlite-pro","https:\u002F\u002Fgithub.com\u002Fiberi22\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Ftools\u002Fsqlite-pro\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":54,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M72TVC2EVBHQHCX96VTTYKB8","rigor-evaluator","Use when you need a quick heuristic rigor score (10 criteria, 0-2 each) for the features in a .gitcore\u002Ffeatures.json file, to decide which features are ready to ship.","https:\u002F\u002Fgithub.com\u002Fiberi22\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Ftools\u002Frigor-evaluator\u002FSKILL.md",[],[]]