[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6AEQD4G7X0YQV723NZ4JMS3":3,"skill-same:01M6AEQD4G7X0YQV723NZ4JMS3":85},{"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":26,"publishedAt":54,"linkOnly":55,"markdownContent":56,"markdownBody":57,"frontMatter":58,"refName":61,"commitSha":62,"skillDirectory":63,"forksCount":64,"repositoryHtmlUrl":65,"repositoryHomepageUrl":66,"ownerHtmlUrl":67,"ownerBlogUrl":68,"ownerDescription":69,"updatedAt":70,"install":71,"resources":84},"01M6AEQD4G7X0YQV723NZ4JMS3","playwright-e2e-builder",null,"Plan and build comprehensive Playwright E2E test suites with Page Object Model, authentication state persistence, custom fixtures, visual regression, and CI integration. Uses interview-driven planning to clarify critical user flows, auth strategy, test data approach, and parallelization before writing any tests.","davila7\u002Fclaude-code-templates","davila7","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6216945?v=4","01M6ADEWWFPS191NFM0Y1EX1JH","Daniel Avila","01M6ADJHGM78PHQRD3XZTFDVKK",33602,"MIT","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fdevelopment\u002Fplaywright-e2e-builder\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53],"playwright e2e","playwright","builder","e2e","playwright e2e builder","data","visual-regression","flows","critical","visual regression","e2e test","clarify","regression","model","plan","testing","ci","persistence","integration","state","authentication","planning","auth","test","automation","typescript","writing","2026-11-10 10:12:30",false,"---\nname: playwright-e2e-builder\ndescription: Plan and build comprehensive Playwright E2E test suites with Page Object Model, authentication state persistence, custom fixtures, visual regression, and CI integration. Uses interview-driven planning to clarify critical user flows, auth strategy, test data approach, and parallelization before writing any tests.\nmetadata:\n  tags: [playwright, e2e, testing, automation, typescript, ci, visual-regression]\n---\n\n# Playwright E2E Test Suite Builder\n\n## When to use\n\nUse this skill when you need to:\n\n- Set up Playwright from scratch in an existing project\n- Build E2E tests for critical user flows (signup, checkout, dashboards)\n- Implement Page Object Model for maintainable test architecture\n- Configure authentication state persistence across tests\n- Set up visual regression testing with screenshots\n- Integrate Playwright into CI\u002FCD with sharding and retries\n\n## Phase 1: Explore (Plan Mode)\n\nEnter plan mode. Before writing any tests, explore the existing project:\n\n### Project structure\n- Find the tech stack: is this React, Next.js, Vue, SvelteKit, or another framework?\n- Check if Playwright is already installed (`playwright.config.ts`, `@playwright\u002Ftest` in package.json)\n- Look for existing test directories (`e2e\u002F`, `tests\u002F`, `__tests__\u002F`)\n- Check for existing E2E tests in Cypress, Selenium, or other frameworks (migration context)\n- Find the dev server command and port (`npm run dev`, `next dev`, etc.)\n\n### Application structure\n- Identify the main routes\u002Fpages (look at router config, pages directory, or route files)\n- Find authentication flow (login page URL, auth API endpoints, token storage)\n- Check for test IDs in components (`data-testid`, `data-test`, `data-cy` attributes)\n- Look for API routes that tests might need to seed data through\n- Check `.env` files for test-specific environment variables\n\n### CI\u002FCD\n- Check for existing CI config (`.github\u002Fworkflows\u002F`, `.gitlab-ci.yml`, `Jenkinsfile`)\n- Look for Docker or docker-compose setup (useful for consistent test environments)\n- Check if there's a staging\u002Fpreview environment URL pattern\n\n## Phase 2: Interview (AskUserQuestion)\n\nUse AskUserQuestion to clarify requirements. Ask in rounds.\n\n### Round 1: Scope and critical flows\n\n```\nQuestion: \"What are the critical user flows to test?\"\nHeader: \"Flows\"\nmultiSelect: true\nOptions:\n  - \"Authentication (signup, login, logout, password reset)\" — Core auth flows\n  - \"Core CRUD (create, read, update, delete main resources)\" — Primary data operations\n  - \"Checkout\u002Fpayments (cart, billing, confirmation)\" — E-commerce or payment flows\n  - \"Dashboard\u002Fadmin (data views, filters, exports)\" — Admin panel interactions\n```\n\n```\nQuestion: \"How many pages\u002Froutes does the application have approximately?\"\nHeader: \"App size\"\nOptions:\n  - \"Small (\u003C 10 routes)\" — Landing page, auth, a few feature pages\n  - \"Medium (10-30 routes)\" — Multiple feature areas, settings, profiles\n  - \"Large (30+ routes)\" — Complex app with many sections and user roles\n```\n\n### Round 2: Authentication strategy for tests\n\n```\nQuestion: \"How does your app handle authentication?\"\nHeader: \"Auth type\"\nOptions:\n  - \"Cookie\u002Fsession based (Recommended)\" — Server sets httpOnly cookies after login\n  - \"JWT in localStorage\" — Token stored in browser localStorage\n  - \"OAuth\u002FSSO (Google, GitHub, etc.)\" — Third-party auth provider redirect flow\n  - \"No auth (public app)\" — No login required\n\nQuestion: \"How should tests authenticate?\"\nHeader: \"Test auth\"\nOptions:\n  - \"Login via UI once, reuse state (Recommended)\" — storageState pattern: login in setup, share cookies across tests\n  - \"API login in beforeEach\" — Call auth API directly before each test, skip UI login\n  - \"Seed auth token in fixtures\" — Inject pre-generated tokens, no login flow needed\n  - \"Test login UI every time\" — Actually test the login form in each test suite\n```\n\n### Round 3: Test data and environment\n\n```\nQuestion: \"How should test data be managed?\"\nHeader: \"Test data\"\nOptions:\n  - \"API seeding in fixtures (Recommended)\" — Call API endpoints to create\u002Fclean test data before each test\n  - \"Database seeding (direct SQL)\" — Run SQL scripts or ORM commands to populate test database\n  - \"Shared test environment (pre-populated)\" — Tests run against a persistent staging environment with existing data\n  - \"Mock API responses\" — Intercept network requests and return mock data\n\nQuestion: \"What environment do E2E tests run against?\"\nHeader: \"Environment\"\nOptions:\n  - \"Local dev server (Recommended)\" — Start dev server before tests, run against localhost\n  - \"Preview\u002Fstaging URL\" — Run against a deployed preview or staging environment\n  - \"Docker Compose stack\" — Full stack in containers, tests run outside or inside\n```\n\n### Round 4: CI and parallelization\n\n```\nQuestion: \"How should tests run in CI?\"\nHeader: \"CI\"\nOptions:\n  - \"GitHub Actions (Recommended)\" — Native Playwright support with sharding\n  - \"GitLab CI\" — Docker-based runners with Playwright image\n  - \"Local only (no CI yet)\" — Just local test runs for now\n  - \"Other CI (Jenkins, CircleCI)\" — Custom CI configuration\n\nQuestion: \"Do you need visual regression testing?\"\nHeader: \"Visual\"\nOptions:\n  - \"No — functional tests only (Recommended)\" — Assert behavior, not pixels\n  - \"Yes — screenshot comparisons\" — Capture and compare page screenshots\n  - \"Yes — component screenshots\" — Capture specific components, not full pages\n```\n\n## Phase 3: Plan (ExitPlanMode)\n\nWrite a concrete implementation plan covering:\n\n1. **Directory structure** — test files, page objects, fixtures, config\n2. **Playwright config** — projects (browsers), base URL, retries, workers\n3. **Auth setup** — global setup for storageState or API-based auth\n4. **Page objects** — classes for each page with locators and actions\n5. **Test fixtures** — custom fixtures for data seeding, auth, API client\n6. **Test suites** — test files for each critical flow from the interview\n7. **CI config** — workflow file with sharding, artifact upload, reporting\n\nPresent via ExitPlanMode for user approval.\n\n## Phase 4: Execute\n\nAfter approval, implement following this order:\n\n### Step 1: Playwright config\n\n```typescript\nimport { defineConfig, devices } from '@playwright\u002Ftest';\n\nexport default defineConfig({\n  testDir: '.\u002Fe2e',\n  fullyParallel: true,\n  forbidOnly: !!process.env.CI,\n  retries: process.env.CI ? 2 : 0,\n  workers: process.env.CI ? 1 : undefined,\n  reporter: process.env.CI\n    ? [['html', { open: 'never' }], ['github']]\n    : [['html', { open: 'on-failure' }]],\n\n  use: {\n    baseURL: process.env.BASE_URL || 'http:\u002F\u002Flocalhost:3000',\n    trace: 'on-first-retry',\n    screenshot: 'only-on-failure',\n    video: 'on-first-retry',\n  },\n\n  projects: [\n    \u002F\u002F Auth setup — runs before all tests\n    {\n      name: 'setup',\n      testMatch: \u002F.*\\.setup\\.ts\u002F,\n    },\n    {\n      name: 'chromium',\n      use: {\n        ...devices['Desktop Chrome'],\n        storageState: 'e2e\u002F.auth\u002Fuser.json',\n      },\n      dependencies: ['setup'],\n    },\n    {\n      name: 'firefox',\n      use: {\n        ...devices['Desktop Firefox'],\n        storageState: 'e2e\u002F.auth\u002Fuser.json',\n      },\n      dependencies: ['setup'],\n    },\n    {\n      name: 'mobile',\n      use: {\n        ...devices['iPhone 14'],\n        storageState: 'e2e\u002F.auth\u002Fuser.json',\n      },\n      dependencies: ['setup'],\n    },\n  ],\n\n  webServer: {\n    command: 'npm run dev',\n    url: 'http:\u002F\u002Flocalhost:3000',\n    reuseExistingServer: !process.env.CI,\n    timeout: 120_000,\n  },\n});\n```\n\n### Step 2: Auth setup (global)\n\n```typescript\n\u002F\u002F e2e\u002Fauth.setup.ts\nimport { test as setup, expect } from '@playwright\u002Ftest';\n\nconst authFile = 'e2e\u002F.auth\u002Fuser.json';\n\nsetup('authenticate', async ({ page }) => {\n  \u002F\u002F Navigate to login page\n  await page.goto('\u002Flogin');\n\n  \u002F\u002F Fill login form\n  await page.getByLabel('Email').fill(process.env.TEST_USER_EMAIL || 'test@example.com');\n  await page.getByLabel('Password').fill(process.env.TEST_USER_PASSWORD || 'testpassword');\n  await page.getByRole('button', { name: 'Sign in' }).click();\n\n  \u002F\u002F Wait for auth to complete — adjust selector to your app\n  await page.waitForURL('\u002Fdashboard');\n  await expect(page.getByRole('navigation')).toBeVisible();\n\n  \u002F\u002F Save signed-in state\n  await page.context().storageState({ path: authFile });\n});\n```\n\n### Step 3: Custom fixtures\n\n```typescript\n\u002F\u002F e2e\u002Ffixtures.ts\nimport { test as base, expect } from '@playwright\u002Ftest';\nimport { LoginPage } from '.\u002Fpages\u002Flogin-page';\nimport { DashboardPage } from '.\u002Fpages\u002Fdashboard-page';\n\n\u002F\u002F API client for test data seeding\nclass ApiClient {\n  constructor(private baseURL: string, private token?: string) {}\n\n  async createResource(data: Record\u003Cstring, unknown>) {\n    const response = await fetch(`${this.baseURL}\u002Fapi\u002Fresources`, {\n      method: 'POST',\n      headers: {\n        'Content-Type': 'application\u002Fjson',\n        ...(this.token ? { Authorization: `Bearer ${this.token}` } : {}),\n      },\n      body: JSON.stringify(data),\n    });\n    if (!response.ok) throw new Error(`Seed failed: ${response.status}`);\n    return response.json();\n  }\n\n  async deleteResource(id: string) {\n    await fetch(`${this.baseURL}\u002Fapi\u002Fresources\u002F${id}`, {\n      method: 'DELETE',\n      headers: this.token ? { Authorization: `Bearer ${this.token}` } : {},\n    });\n  }\n}\n\ntype Fixtures = {\n  loginPage: LoginPage;\n  dashboardPage: DashboardPage;\n  api: ApiClient;\n};\n\nexport const test = base.extend\u003CFixtures>({\n  loginPage: async ({ page }, use) => {\n    await use(new LoginPage(page));\n  },\n\n  dashboardPage: async ({ page }, use) => {\n    await use(new DashboardPage(page));\n  },\n\n  api: async ({ baseURL }, use) => {\n    const client = new ApiClient(baseURL!);\n    await use(client);\n  },\n});\n\nexport { expect };\n```\n\n### Step 4: Page Object Model\n\n```typescript\n\u002F\u002F e2e\u002Fpages\u002Flogin-page.ts\nimport { type Page, type Locator, expect } from '@playwright\u002Ftest';\n\nexport class LoginPage {\n  readonly emailInput: Locator;\n  readonly passwordInput: Locator;\n  readonly submitButton: Locator;\n  readonly errorMessage: Locator;\n\n  constructor(private page: Page) {\n    this.emailInput = page.getByLabel('Email');\n    this.passwordInput = page.getByLabel('Password');\n    this.submitButton = page.getByRole('button', { name: 'Sign in' });\n    this.errorMessage = page.getByRole('alert');\n  }\n\n  async goto() {\n    await this.page.goto('\u002Flogin');\n  }\n\n  async login(email: string, password: string) {\n    await this.emailInput.fill(email);\n    await this.passwordInput.fill(password);\n    await this.submitButton.click();\n  }\n\n  async expectError(message: string) {\n    await expect(this.errorMessage).toContainText(message);\n  }\n}\n\n\u002F\u002F e2e\u002Fpages\u002Fdashboard-page.ts\nimport { type Page, type Locator, expect } from '@playwright\u002Ftest';\n\nexport class DashboardPage {\n  readonly heading: Locator;\n  readonly createButton: Locator;\n  readonly searchInput: Locator;\n  readonly resourceList: Locator;\n\n  constructor(private page: Page) {\n    this.heading = page.getByRole('heading', { level: 1 });\n    this.createButton = page.getByRole('button', { name: 'Create' });\n    this.searchInput = page.getByPlaceholder('Search');\n    this.resourceList = page.getByTestId('resource-list');\n  }\n\n  async goto() {\n    await this.page.goto('\u002Fdashboard');\n  }\n\n  async createResource(name: string) {\n    await this.createButton.click();\n    await this.page.getByLabel('Name').fill(name);\n    await this.page.getByRole('button', { name: 'Save' }).click();\n  }\n\n  async search(query: string) {\n    await this.searchInput.fill(query);\n    \u002F\u002F Wait for debounced search to trigger\n    await this.page.waitForResponse(resp =>\n      resp.url().includes('\u002Fapi\u002Fresources') && resp.status() === 200\n    );\n  }\n\n  async expectResourceVisible(name: string) {\n    await expect(this.resourceList.getByText(name)).toBeVisible();\n  }\n\n  async expectResourceCount(count: number) {\n    await expect(this.resourceList.getByRole('listitem')).toHaveCount(count);\n  }\n}\n```\n\n### Step 5: Test suites\n\n```typescript\n\u002F\u002F e2e\u002Fauth.spec.ts\nimport { test, expect } from '.\u002Ffixtures';\n\ntest.describe('Authentication', () => {\n  \u002F\u002F These tests run WITHOUT storageState (unauthenticated)\n  test.use({ storageState: { cookies: [], origins: [] } });\n\n  test('successful login redirects to dashboard', async ({ loginPage, page }) => {\n    await loginPage.goto();\n    await loginPage.login('test@example.com', 'testpassword');\n    await expect(page).toHaveURL('\u002Fdashboard');\n  });\n\n  test('invalid credentials shows error', async ({ loginPage }) => {\n    await loginPage.goto();\n    await loginPage.login('test@example.com', 'wrongpassword');\n    await loginPage.expectError('Invalid credentials');\n  });\n\n  test('logout clears session', async ({ page }) => {\n    \u002F\u002F Login first\n    await page.goto('\u002Flogin');\n    \u002F\u002F ... login steps ...\n\n    \u002F\u002F Logout\n    await page.getByRole('button', { name: 'Logout' }).click();\n    await expect(page).toHaveURL('\u002Flogin');\n\n    \u002F\u002F Verify can't access protected route\n    await page.goto('\u002Fdashboard');\n    await expect(page).toHaveURL('\u002Flogin');\n  });\n});\n\n\u002F\u002F e2e\u002Fdashboard.spec.ts\nimport { test, expect } from '.\u002Ffixtures';\n\ntest.describe('Dashboard', () => {\n  test('displays resource list', async ({ dashboardPage }) => {\n    await dashboardPage.goto();\n    await expect(dashboardPage.heading).toHaveText('Dashboard');\n    await expect(dashboardPage.resourceList).toBeVisible();\n  });\n\n  test('create new resource', async ({ dashboardPage, page }) => {\n    await dashboardPage.goto();\n    await dashboardPage.createResource('New E2E Resource');\n\n    \u002F\u002F Verify resource appears in list\n    await dashboardPage.expectResourceVisible('New E2E Resource');\n  });\n\n  test('search filters results', async ({ dashboardPage, api }) => {\n    \u002F\u002F Seed test data via API\n    await api.createResource({ name: 'Alpha Item' });\n    await api.createResource({ name: 'Beta Item' });\n\n    await dashboardPage.goto();\n    await dashboardPage.search('Alpha');\n    await dashboardPage.expectResourceVisible('Alpha Item');\n  });\n\n  test('empty state shown when no resources', async ({ dashboardPage, page }) => {\n    await dashboardPage.goto();\n    await dashboardPage.search('nonexistent-query-xyz');\n    await expect(page.getByText('No results found')).toBeVisible();\n  });\n});\n\n\u002F\u002F e2e\u002Fcrud.spec.ts\nimport { test, expect } from '.\u002Ffixtures';\n\ntest.describe('Resource CRUD', () => {\n  let resourceId: string;\n\n  test.beforeEach(async ({ api }) => {\n    \u002F\u002F Seed a resource for tests that need one\n    const resource = await api.createResource({ name: 'Test Resource' });\n    resourceId = resource.id;\n  });\n\n  test.afterEach(async ({ api }) => {\n    \u002F\u002F Clean up seeded data\n    if (resourceId) {\n      await api.deleteResource(resourceId).catch(() => {});\n    }\n  });\n\n  test('edit resource name', async ({ page }) => {\n    await page.goto(`\u002Fresources\u002F${resourceId}`);\n    await page.getByRole('button', { name: 'Edit' }).click();\n    await page.getByLabel('Name').clear();\n    await page.getByLabel('Name').fill('Updated Resource');\n    await page.getByRole('button', { name: 'Save' }).click();\n\n    await expect(page.getByRole('heading')).toHaveText('Updated Resource');\n  });\n\n  test('delete resource with confirmation', async ({ page }) => {\n    await page.goto(`\u002Fresources\u002F${resourceId}`);\n    await page.getByRole('button', { name: 'Delete' }).click();\n\n    \u002F\u002F Confirm deletion dialog\n    await expect(page.getByRole('dialog')).toBeVisible();\n    await page.getByRole('button', { name: 'Confirm' }).click();\n\n    \u002F\u002F Should redirect to list\n    await expect(page).toHaveURL('\u002Fdashboard');\n  });\n});\n```\n\n### Step 6: Visual regression (if selected)\n\n```typescript\n\u002F\u002F e2e\u002Fvisual.spec.ts\nimport { test, expect } from '.\u002Ffixtures';\n\ntest.describe('Visual regression', () => {\n  test('dashboard matches snapshot', async ({ dashboardPage, page }) => {\n    await dashboardPage.goto();\n    \u002F\u002F Wait for dynamic content to stabilize\n    await page.waitForLoadState('networkidle');\n    await expect(page).toHaveScreenshot('dashboard.png', {\n      maxDiffPixelRatio: 0.01,\n    });\n  });\n\n  test('login page matches snapshot', async ({ loginPage, page }) => {\n    test.use({ storageState: { cookies: [], origins: [] } });\n    await loginPage.goto();\n    await expect(page).toHaveScreenshot('login.png', {\n      maxDiffPixelRatio: 0.01,\n    });\n  });\n\n  \u002F\u002F Component-level screenshots\n  test('navigation component matches snapshot', async ({ page }) => {\n    await page.goto('\u002Fdashboard');\n    const nav = page.getByRole('navigation');\n    await expect(nav).toHaveScreenshot('navigation.png');\n  });\n});\n```\n\n### Step 7: GitHub Actions CI\n\n```yaml\n# .github\u002Fworkflows\u002Fe2e.yml\nname: E2E Tests\n\non:\n  push:\n    branches: [main]\n  pull_request:\n    branches: [main]\n\njobs:\n  e2e:\n    timeout-minutes: 30\n    runs-on: ubuntu-latest\n    strategy:\n      fail-fast: false\n      matrix:\n        shard: [1\u002F4, 2\u002F4, 3\u002F4, 4\u002F4]\n\n    steps:\n      - uses: actions\u002Fcheckout@v4\n\n      - uses: actions\u002Fsetup-node@v4\n        with:\n          node-version: 20\n          cache: 'npm'\n\n      - run: npm ci\n\n      - name: Install Playwright browsers\n        run: npx playwright install --with-deps chromium\n\n      - name: Run E2E tests\n        run: npx playwright test --shard=${{ matrix.shard }}\n        env:\n          BASE_URL: http:\u002F\u002Flocalhost:3000\n          TEST_USER_EMAIL: ${{ secrets.TEST_USER_EMAIL }}\n          TEST_USER_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }}\n\n      - name: Upload test report\n        uses: actions\u002Fupload-artifact@v4\n        if: ${{ !cancelled() }}\n        with:\n          name: playwright-report-${{ strategy.job-index }}\n          path: playwright-report\u002F\n          retention-days: 14\n\n      - name: Upload test results\n        uses: actions\u002Fupload-artifact@v4\n        if: ${{ !cancelled() }}\n        with:\n          name: test-results-${{ strategy.job-index }}\n          path: test-results\u002F\n          retention-days: 7\n```\n\n## Directory structure reference\n\n```\ne2e\u002F\n├── .auth\u002F\n│   └── user.json            # Saved auth state (gitignored)\n├── fixtures.ts              # Custom test fixtures and API client\n├── pages\u002F\n│   ├── login-page.ts        # Login page object\n│   ├── dashboard-page.ts    # Dashboard page object\n│   └── resource-page.ts     # Resource detail page object\n├── auth.setup.ts            # Global auth setup (runs once)\n├── auth.spec.ts             # Authentication tests\n├── dashboard.spec.ts        # Dashboard tests\n├── crud.spec.ts             # CRUD operation tests\n└── visual.spec.ts           # Visual regression tests (optional)\nplaywright.config.ts         # Playwright configuration\n```\n\n## Best practices\n\n### Use role-based locators first\nPrefer `getByRole()`, `getByLabel()`, `getByText()` over CSS selectors or test IDs. These locators mirror how users interact with the page and catch accessibility issues:\n\n```typescript\n\u002F\u002F Preferred — accessible and resilient\nawait page.getByRole('button', { name: 'Submit' }).click();\nawait page.getByLabel('Email').fill('user@test.com');\n\n\u002F\u002F Fallback — when role-based doesn't work\nawait page.getByTestId('custom-widget').click();\n\n\u002F\u002F Avoid — fragile, breaks on refactors\nawait page.locator('.btn-primary').click();\nawait page.locator('#email-input').fill('user@test.com');\n```\n\n### Wait for network, not timers\nNever use `page.waitForTimeout()`. Wait for specific conditions:\n\n```typescript\n\u002F\u002F Wait for API response\nawait page.waitForResponse(resp => resp.url().includes('\u002Fapi\u002Fdata'));\n\n\u002F\u002F Wait for element state\nawait expect(page.getByText('Saved')).toBeVisible();\n\n\u002F\u002F Wait for navigation\nawait expect(page).toHaveURL('\u002Fdashboard');\n\n\u002F\u002F Wait for loading to finish\nawait expect(page.getByTestId('spinner')).toBeHidden();\n```\n\n### Isolate test data\nEach test should create its own data and clean up after:\n\n```typescript\ntest('edit resource', async ({ api, page }) => {\n  \u002F\u002F Arrange — seed via API\n  const resource = await api.createResource({ name: 'Test' });\n\n  \u002F\u002F Act\n  await page.goto(`\u002Fresources\u002F${resource.id}`);\n  \u002F\u002F ... test logic ...\n\n  \u002F\u002F Cleanup (also runs on failure via afterEach)\n});\n```\n\n### Tag tests for selective runs\n\n```typescript\ntest('checkout flow @slow @checkout', async ({ page }) => {\n  \u002F\u002F Long test tagged for selective execution\n});\n\n\u002F\u002F Run only: npx playwright test --grep @checkout\n\u002F\u002F Skip slow: npx playwright test --grep-invert @slow\n```\n\n### .gitignore additions\n\n```\n# Playwright\ne2e\u002F.auth\u002F\ntest-results\u002F\nplaywright-report\u002F\nblob-report\u002F\n```\n\n## Checklist before finishing\n\n- [ ] `playwright.config.ts` has webServer configured to start the dev server\n- [ ] Auth setup saves storageState and all test projects depend on it\n- [ ] Page objects use role-based locators (`getByRole`, `getByLabel`, `getByText`)\n- [ ] No `waitForTimeout()` calls — only wait for elements, URLs, or responses\n- [ ] Tests create and clean up their own data (no shared mutable state)\n- [ ] CI config has sharding for parallel execution\n- [ ] Trace, screenshot, and video are captured on failure for debugging\n- [ ] `.auth\u002F` directory is in `.gitignore`\n- [ ] `npx playwright test` passes locally before pushing\n","# Playwright E2E Test Suite Builder\n\n## When to use\n\nUse this skill when you need to:\n\n- Set up Playwright from scratch in an existing project\n- Build E2E tests for critical user flows (signup, checkout, dashboards)\n- Implement Page Object Model for maintainable test architecture\n- Configure authentication state persistence across tests\n- Set up visual regression testing with screenshots\n- Integrate Playwright into CI\u002FCD with sharding and retries\n\n## Phase 1: Explore (Plan Mode)\n\nEnter plan mode. Before writing any tests, explore the existing project:\n\n### Project structure\n- Find the tech stack: is this React, Next.js, Vue, SvelteKit, or another framework?\n- Check if Playwright is already installed (`playwright.config.ts`, `@playwright\u002Ftest` in package.json)\n- Look for existing test directories (`e2e\u002F`, `tests\u002F`, `__tests__\u002F`)\n- Check for existing E2E tests in Cypress, Selenium, or other frameworks (migration context)\n- Find the dev server command and port (`npm run dev`, `next dev`, etc.)\n\n### Application structure\n- Identify the main routes\u002Fpages (look at router config, pages directory, or route files)\n- Find authentication flow (login page URL, auth API endpoints, token storage)\n- Check for test IDs in components (`data-testid`, `data-test`, `data-cy` attributes)\n- Look for API routes that tests might need to seed data through\n- Check `.env` files for test-specific environment variables\n\n### CI\u002FCD\n- Check for existing CI config (`.github\u002Fworkflows\u002F`, `.gitlab-ci.yml`, `Jenkinsfile`)\n- Look for Docker or docker-compose setup (useful for consistent test environments)\n- Check if there's a staging\u002Fpreview environment URL pattern\n\n## Phase 2: Interview (AskUserQuestion)\n\nUse AskUserQuestion to clarify requirements. Ask in rounds.\n\n### Round 1: Scope and critical flows\n\n```\nQuestion: \"What are the critical user flows to test?\"\nHeader: \"Flows\"\nmultiSelect: true\nOptions:\n  - \"Authentication (signup, login, logout, password reset)\" — Core auth flows\n  - \"Core CRUD (create, read, update, delete main resources)\" — Primary data operations\n  - \"Checkout\u002Fpayments (cart, billing, confirmation)\" — E-commerce or payment flows\n  - \"Dashboard\u002Fadmin (data views, filters, exports)\" — Admin panel interactions\n```\n\n```\nQuestion: \"How many pages\u002Froutes does the application have approximately?\"\nHeader: \"App size\"\nOptions:\n  - \"Small (\u003C 10 routes)\" — Landing page, auth, a few feature pages\n  - \"Medium (10-30 routes)\" — Multiple feature areas, settings, profiles\n  - \"Large (30+ routes)\" — Complex app with many sections and user roles\n```\n\n### Round 2: Authentication strategy for tests\n\n```\nQuestion: \"How does your app handle authentication?\"\nHeader: \"Auth type\"\nOptions:\n  - \"Cookie\u002Fsession based (Recommended)\" — Server sets httpOnly cookies after login\n  - \"JWT in localStorage\" — Token stored in browser localStorage\n  - \"OAuth\u002FSSO (Google, GitHub, etc.)\" — Third-party auth provider redirect flow\n  - \"No auth (public app)\" — No login required\n\nQuestion: \"How should tests authenticate?\"\nHeader: \"Test auth\"\nOptions:\n  - \"Login via UI once, reuse state (Recommended)\" — storageState pattern: login in setup, share cookies across tests\n  - \"API login in beforeEach\" — Call auth API directly before each test, skip UI login\n  - \"Seed auth token in fixtures\" — Inject pre-generated tokens, no login flow needed\n  - \"Test login UI every time\" — Actually test the login form in each test suite\n```\n\n### Round 3: Test data and environment\n\n```\nQuestion: \"How should test data be managed?\"\nHeader: \"Test data\"\nOptions:\n  - \"API seeding in fixtures (Recommended)\" — Call API endpoints to create\u002Fclean test data before each test\n  - \"Database seeding (direct SQL)\" — Run SQL scripts or ORM commands to populate test database\n  - \"Shared test environment (pre-populated)\" — Tests run against a persistent staging environment with existing data\n  - \"Mock API responses\" — Intercept network requests and return mock data\n\nQuestion: \"What environment do E2E tests run against?\"\nHeader: \"Environment\"\nOptions:\n  - \"Local dev server (Recommended)\" — Start dev server before tests, run against localhost\n  - \"Preview\u002Fstaging URL\" — Run against a deployed preview or staging environment\n  - \"Docker Compose stack\" — Full stack in containers, tests run outside or inside\n```\n\n### Round 4: CI and parallelization\n\n```\nQuestion: \"How should tests run in CI?\"\nHeader: \"CI\"\nOptions:\n  - \"GitHub Actions (Recommended)\" — Native Playwright support with sharding\n  - \"GitLab CI\" — Docker-based runners with Playwright image\n  - \"Local only (no CI yet)\" — Just local test runs for now\n  - \"Other CI (Jenkins, CircleCI)\" — Custom CI configuration\n\nQuestion: \"Do you need visual regression testing?\"\nHeader: \"Visual\"\nOptions:\n  - \"No — functional tests only (Recommended)\" — Assert behavior, not pixels\n  - \"Yes — screenshot comparisons\" — Capture and compare page screenshots\n  - \"Yes — component screenshots\" — Capture specific components, not full pages\n```\n\n## Phase 3: Plan (ExitPlanMode)\n\nWrite a concrete implementation plan covering:\n\n1. **Directory structure** — test files, page objects, fixtures, config\n2. **Playwright config** — projects (browsers), base URL, retries, workers\n3. **Auth setup** — global setup for storageState or API-based auth\n4. **Page objects** — classes for each page with locators and actions\n5. **Test fixtures** — custom fixtures for data seeding, auth, API client\n6. **Test suites** — test files for each critical flow from the interview\n7. **CI config** — workflow file with sharding, artifact upload, reporting\n\nPresent via ExitPlanMode for user approval.\n\n## Phase 4: Execute\n\nAfter approval, implement following this order:\n\n### Step 1: Playwright config\n\n```typescript\nimport { defineConfig, devices } from '@playwright\u002Ftest';\n\nexport default defineConfig({\n  testDir: '.\u002Fe2e',\n  fullyParallel: true,\n  forbidOnly: !!process.env.CI,\n  retries: process.env.CI ? 2 : 0,\n  workers: process.env.CI ? 1 : undefined,\n  reporter: process.env.CI\n    ? [['html', { open: 'never' }], ['github']]\n    : [['html', { open: 'on-failure' }]],\n\n  use: {\n    baseURL: process.env.BASE_URL || 'http:\u002F\u002Flocalhost:3000',\n    trace: 'on-first-retry',\n    screenshot: 'only-on-failure',\n    video: 'on-first-retry',\n  },\n\n  projects: [\n    \u002F\u002F Auth setup — runs before all tests\n    {\n      name: 'setup',\n      testMatch: \u002F.*\\.setup\\.ts\u002F,\n    },\n    {\n      name: 'chromium',\n      use: {\n        ...devices['Desktop Chrome'],\n        storageState: 'e2e\u002F.auth\u002Fuser.json',\n      },\n      dependencies: ['setup'],\n    },\n    {\n      name: 'firefox',\n      use: {\n        ...devices['Desktop Firefox'],\n        storageState: 'e2e\u002F.auth\u002Fuser.json',\n      },\n      dependencies: ['setup'],\n    },\n    {\n      name: 'mobile',\n      use: {\n        ...devices['iPhone 14'],\n        storageState: 'e2e\u002F.auth\u002Fuser.json',\n      },\n      dependencies: ['setup'],\n    },\n  ],\n\n  webServer: {\n    command: 'npm run dev',\n    url: 'http:\u002F\u002Flocalhost:3000',\n    reuseExistingServer: !process.env.CI,\n    timeout: 120_000,\n  },\n});\n```\n\n### Step 2: Auth setup (global)\n\n```typescript\n\u002F\u002F e2e\u002Fauth.setup.ts\nimport { test as setup, expect } from '@playwright\u002Ftest';\n\nconst authFile = 'e2e\u002F.auth\u002Fuser.json';\n\nsetup('authenticate', async ({ page }) => {\n  \u002F\u002F Navigate to login page\n  await page.goto('\u002Flogin');\n\n  \u002F\u002F Fill login form\n  await page.getByLabel('Email').fill(process.env.TEST_USER_EMAIL || 'test@example.com');\n  await page.getByLabel('Password').fill(process.env.TEST_USER_PASSWORD || 'testpassword');\n  await page.getByRole('button', { name: 'Sign in' }).click();\n\n  \u002F\u002F Wait for auth to complete — adjust selector to your app\n  await page.waitForURL('\u002Fdashboard');\n  await expect(page.getByRole('navigation')).toBeVisible();\n\n  \u002F\u002F Save signed-in state\n  await page.context().storageState({ path: authFile });\n});\n```\n\n### Step 3: Custom fixtures\n\n```typescript\n\u002F\u002F e2e\u002Ffixtures.ts\nimport { test as base, expect } from '@playwright\u002Ftest';\nimport { LoginPage } from '.\u002Fpages\u002Flogin-page';\nimport { DashboardPage } from '.\u002Fpages\u002Fdashboard-page';\n\n\u002F\u002F API client for test data seeding\nclass ApiClient {\n  constructor(private baseURL: string, private token?: string) {}\n\n  async createResource(data: Record\u003Cstring, unknown>) {\n    const response = await fetch(`${this.baseURL}\u002Fapi\u002Fresources`, {\n      method: 'POST',\n      headers: {\n        'Content-Type': 'application\u002Fjson',\n        ...(this.token ? { Authorization: `Bearer ${this.token}` } : {}),\n      },\n      body: JSON.stringify(data),\n    });\n    if (!response.ok) throw new Error(`Seed failed: ${response.status}`);\n    return response.json();\n  }\n\n  async deleteResource(id: string) {\n    await fetch(`${this.baseURL}\u002Fapi\u002Fresources\u002F${id}`, {\n      method: 'DELETE',\n      headers: this.token ? { Authorization: `Bearer ${this.token}` } : {},\n    });\n  }\n}\n\ntype Fixtures = {\n  loginPage: LoginPage;\n  dashboardPage: DashboardPage;\n  api: ApiClient;\n};\n\nexport const test = base.extend\u003CFixtures>({\n  loginPage: async ({ page }, use) => {\n    await use(new LoginPage(page));\n  },\n\n  dashboardPage: async ({ page }, use) => {\n    await use(new DashboardPage(page));\n  },\n\n  api: async ({ baseURL }, use) => {\n    const client = new ApiClient(baseURL!);\n    await use(client);\n  },\n});\n\nexport { expect };\n```\n\n### Step 4: Page Object Model\n\n```typescript\n\u002F\u002F e2e\u002Fpages\u002Flogin-page.ts\nimport { type Page, type Locator, expect } from '@playwright\u002Ftest';\n\nexport class LoginPage {\n  readonly emailInput: Locator;\n  readonly passwordInput: Locator;\n  readonly submitButton: Locator;\n  readonly errorMessage: Locator;\n\n  constructor(private page: Page) {\n    this.emailInput = page.getByLabel('Email');\n    this.passwordInput = page.getByLabel('Password');\n    this.submitButton = page.getByRole('button', { name: 'Sign in' });\n    this.errorMessage = page.getByRole('alert');\n  }\n\n  async goto() {\n    await this.page.goto('\u002Flogin');\n  }\n\n  async login(email: string, password: string) {\n    await this.emailInput.fill(email);\n    await this.passwordInput.fill(password);\n    await this.submitButton.click();\n  }\n\n  async expectError(message: string) {\n    await expect(this.errorMessage).toContainText(message);\n  }\n}\n\n\u002F\u002F e2e\u002Fpages\u002Fdashboard-page.ts\nimport { type Page, type Locator, expect } from '@playwright\u002Ftest';\n\nexport class DashboardPage {\n  readonly heading: Locator;\n  readonly createButton: Locator;\n  readonly searchInput: Locator;\n  readonly resourceList: Locator;\n\n  constructor(private page: Page) {\n    this.heading = page.getByRole('heading', { level: 1 });\n    this.createButton = page.getByRole('button', { name: 'Create' });\n    this.searchInput = page.getByPlaceholder('Search');\n    this.resourceList = page.getByTestId('resource-list');\n  }\n\n  async goto() {\n    await this.page.goto('\u002Fdashboard');\n  }\n\n  async createResource(name: string) {\n    await this.createButton.click();\n    await this.page.getByLabel('Name').fill(name);\n    await this.page.getByRole('button', { name: 'Save' }).click();\n  }\n\n  async search(query: string) {\n    await this.searchInput.fill(query);\n    \u002F\u002F Wait for debounced search to trigger\n    await this.page.waitForResponse(resp =>\n      resp.url().includes('\u002Fapi\u002Fresources') && resp.status() === 200\n    );\n  }\n\n  async expectResourceVisible(name: string) {\n    await expect(this.resourceList.getByText(name)).toBeVisible();\n  }\n\n  async expectResourceCount(count: number) {\n    await expect(this.resourceList.getByRole('listitem')).toHaveCount(count);\n  }\n}\n```\n\n### Step 5: Test suites\n\n```typescript\n\u002F\u002F e2e\u002Fauth.spec.ts\nimport { test, expect } from '.\u002Ffixtures';\n\ntest.describe('Authentication', () => {\n  \u002F\u002F These tests run WITHOUT storageState (unauthenticated)\n  test.use({ storageState: { cookies: [], origins: [] } });\n\n  test('successful login redirects to dashboard', async ({ loginPage, page }) => {\n    await loginPage.goto();\n    await loginPage.login('test@example.com', 'testpassword');\n    await expect(page).toHaveURL('\u002Fdashboard');\n  });\n\n  test('invalid credentials shows error', async ({ loginPage }) => {\n    await loginPage.goto();\n    await loginPage.login('test@example.com', 'wrongpassword');\n    await loginPage.expectError('Invalid credentials');\n  });\n\n  test('logout clears session', async ({ page }) => {\n    \u002F\u002F Login first\n    await page.goto('\u002Flogin');\n    \u002F\u002F ... login steps ...\n\n    \u002F\u002F Logout\n    await page.getByRole('button', { name: 'Logout' }).click();\n    await expect(page).toHaveURL('\u002Flogin');\n\n    \u002F\u002F Verify can't access protected route\n    await page.goto('\u002Fdashboard');\n    await expect(page).toHaveURL('\u002Flogin');\n  });\n});\n\n\u002F\u002F e2e\u002Fdashboard.spec.ts\nimport { test, expect } from '.\u002Ffixtures';\n\ntest.describe('Dashboard', () => {\n  test('displays resource list', async ({ dashboardPage }) => {\n    await dashboardPage.goto();\n    await expect(dashboardPage.heading).toHaveText('Dashboard');\n    await expect(dashboardPage.resourceList).toBeVisible();\n  });\n\n  test('create new resource', async ({ dashboardPage, page }) => {\n    await dashboardPage.goto();\n    await dashboardPage.createResource('New E2E Resource');\n\n    \u002F\u002F Verify resource appears in list\n    await dashboardPage.expectResourceVisible('New E2E Resource');\n  });\n\n  test('search filters results', async ({ dashboardPage, api }) => {\n    \u002F\u002F Seed test data via API\n    await api.createResource({ name: 'Alpha Item' });\n    await api.createResource({ name: 'Beta Item' });\n\n    await dashboardPage.goto();\n    await dashboardPage.search('Alpha');\n    await dashboardPage.expectResourceVisible('Alpha Item');\n  });\n\n  test('empty state shown when no resources', async ({ dashboardPage, page }) => {\n    await dashboardPage.goto();\n    await dashboardPage.search('nonexistent-query-xyz');\n    await expect(page.getByText('No results found')).toBeVisible();\n  });\n});\n\n\u002F\u002F e2e\u002Fcrud.spec.ts\nimport { test, expect } from '.\u002Ffixtures';\n\ntest.describe('Resource CRUD', () => {\n  let resourceId: string;\n\n  test.beforeEach(async ({ api }) => {\n    \u002F\u002F Seed a resource for tests that need one\n    const resource = await api.createResource({ name: 'Test Resource' });\n    resourceId = resource.id;\n  });\n\n  test.afterEach(async ({ api }) => {\n    \u002F\u002F Clean up seeded data\n    if (resourceId) {\n      await api.deleteResource(resourceId).catch(() => {});\n    }\n  });\n\n  test('edit resource name', async ({ page }) => {\n    await page.goto(`\u002Fresources\u002F${resourceId}`);\n    await page.getByRole('button', { name: 'Edit' }).click();\n    await page.getByLabel('Name').clear();\n    await page.getByLabel('Name').fill('Updated Resource');\n    await page.getByRole('button', { name: 'Save' }).click();\n\n    await expect(page.getByRole('heading')).toHaveText('Updated Resource');\n  });\n\n  test('delete resource with confirmation', async ({ page }) => {\n    await page.goto(`\u002Fresources\u002F${resourceId}`);\n    await page.getByRole('button', { name: 'Delete' }).click();\n\n    \u002F\u002F Confirm deletion dialog\n    await expect(page.getByRole('dialog')).toBeVisible();\n    await page.getByRole('button', { name: 'Confirm' }).click();\n\n    \u002F\u002F Should redirect to list\n    await expect(page).toHaveURL('\u002Fdashboard');\n  });\n});\n```\n\n### Step 6: Visual regression (if selected)\n\n```typescript\n\u002F\u002F e2e\u002Fvisual.spec.ts\nimport { test, expect } from '.\u002Ffixtures';\n\ntest.describe('Visual regression', () => {\n  test('dashboard matches snapshot', async ({ dashboardPage, page }) => {\n    await dashboardPage.goto();\n    \u002F\u002F Wait for dynamic content to stabilize\n    await page.waitForLoadState('networkidle');\n    await expect(page).toHaveScreenshot('dashboard.png', {\n      maxDiffPixelRatio: 0.01,\n    });\n  });\n\n  test('login page matches snapshot', async ({ loginPage, page }) => {\n    test.use({ storageState: { cookies: [], origins: [] } });\n    await loginPage.goto();\n    await expect(page).toHaveScreenshot('login.png', {\n      maxDiffPixelRatio: 0.01,\n    });\n  });\n\n  \u002F\u002F Component-level screenshots\n  test('navigation component matches snapshot', async ({ page }) => {\n    await page.goto('\u002Fdashboard');\n    const nav = page.getByRole('navigation');\n    await expect(nav).toHaveScreenshot('navigation.png');\n  });\n});\n```\n\n### Step 7: GitHub Actions CI\n\n```yaml\n# .github\u002Fworkflows\u002Fe2e.yml\nname: E2E Tests\n\non:\n  push:\n    branches: [main]\n  pull_request:\n    branches: [main]\n\njobs:\n  e2e:\n    timeout-minutes: 30\n    runs-on: ubuntu-latest\n    strategy:\n      fail-fast: false\n      matrix:\n        shard: [1\u002F4, 2\u002F4, 3\u002F4, 4\u002F4]\n\n    steps:\n      - uses: actions\u002Fcheckout@v4\n\n      - uses: actions\u002Fsetup-node@v4\n        with:\n          node-version: 20\n          cache: 'npm'\n\n      - run: npm ci\n\n      - name: Install Playwright browsers\n        run: npx playwright install --with-deps chromium\n\n      - name: Run E2E tests\n        run: npx playwright test --shard=${{ matrix.shard }}\n        env:\n          BASE_URL: http:\u002F\u002Flocalhost:3000\n          TEST_USER_EMAIL: ${{ secrets.TEST_USER_EMAIL }}\n          TEST_USER_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }}\n\n      - name: Upload test report\n        uses: actions\u002Fupload-artifact@v4\n        if: ${{ !cancelled() }}\n        with:\n          name: playwright-report-${{ strategy.job-index }}\n          path: playwright-report\u002F\n          retention-days: 14\n\n      - name: Upload test results\n        uses: actions\u002Fupload-artifact@v4\n        if: ${{ !cancelled() }}\n        with:\n          name: test-results-${{ strategy.job-index }}\n          path: test-results\u002F\n          retention-days: 7\n```\n\n## Directory structure reference\n\n```\ne2e\u002F\n├── .auth\u002F\n│   └── user.json            # Saved auth state (gitignored)\n├── fixtures.ts              # Custom test fixtures and API client\n├── pages\u002F\n│   ├── login-page.ts        # Login page object\n│   ├── dashboard-page.ts    # Dashboard page object\n│   └── resource-page.ts     # Resource detail page object\n├── auth.setup.ts            # Global auth setup (runs once)\n├── auth.spec.ts             # Authentication tests\n├── dashboard.spec.ts        # Dashboard tests\n├── crud.spec.ts             # CRUD operation tests\n└── visual.spec.ts           # Visual regression tests (optional)\nplaywright.config.ts         # Playwright configuration\n```\n\n## Best practices\n\n### Use role-based locators first\nPrefer `getByRole()`, `getByLabel()`, `getByText()` over CSS selectors or test IDs. These locators mirror how users interact with the page and catch accessibility issues:\n\n```typescript\n\u002F\u002F Preferred — accessible and resilient\nawait page.getByRole('button', { name: 'Submit' }).click();\nawait page.getByLabel('Email').fill('user@test.com');\n\n\u002F\u002F Fallback — when role-based doesn't work\nawait page.getByTestId('custom-widget').click();\n\n\u002F\u002F Avoid — fragile, breaks on refactors\nawait page.locator('.btn-primary').click();\nawait page.locator('#email-input').fill('user@test.com');\n```\n\n### Wait for network, not timers\nNever use `page.waitForTimeout()`. Wait for specific conditions:\n\n```typescript\n\u002F\u002F Wait for API response\nawait page.waitForResponse(resp => resp.url().includes('\u002Fapi\u002Fdata'));\n\n\u002F\u002F Wait for element state\nawait expect(page.getByText('Saved')).toBeVisible();\n\n\u002F\u002F Wait for navigation\nawait expect(page).toHaveURL('\u002Fdashboard');\n\n\u002F\u002F Wait for loading to finish\nawait expect(page.getByTestId('spinner')).toBeHidden();\n```\n\n### Isolate test data\nEach test should create its own data and clean up after:\n\n```typescript\ntest('edit resource', async ({ api, page }) => {\n  \u002F\u002F Arrange — seed via API\n  const resource = await api.createResource({ name: 'Test' });\n\n  \u002F\u002F Act\n  await page.goto(`\u002Fresources\u002F${resource.id}`);\n  \u002F\u002F ... test logic ...\n\n  \u002F\u002F Cleanup (also runs on failure via afterEach)\n});\n```\n\n### Tag tests for selective runs\n\n```typescript\ntest('checkout flow @slow @checkout', async ({ page }) => {\n  \u002F\u002F Long test tagged for selective execution\n});\n\n\u002F\u002F Run only: npx playwright test --grep @checkout\n\u002F\u002F Skip slow: npx playwright test --grep-invert @slow\n```\n\n### .gitignore additions\n\n```\n# Playwright\ne2e\u002F.auth\u002F\ntest-results\u002F\nplaywright-report\u002F\nblob-report\u002F\n```\n\n## Checklist before finishing\n\n- [ ] `playwright.config.ts` has webServer configured to start the dev server\n- [ ] Auth setup saves storageState and all test projects depend on it\n- [ ] Page objects use role-based locators (`getByRole`, `getByLabel`, `getByText`)\n- [ ] No `waitForTimeout()` calls — only wait for elements, URLs, or responses\n- [ ] Tests create and clean up their own data (no shared mutable state)\n- [ ] CI config has sharding for parallel execution\n- [ ] Trace, screenshot, and video are captured on failure for debugging\n- [ ] `.auth\u002F` directory is in `.gitignore`\n- [ ] `npx playwright test` passes locally before pushing\n",{"name":5,"metadata":59,"description":7},{"tags":60},[28,30,42,51,52,43,33],"main","2b749c82b5d11fac39d9a6e021ce3f5b8a541bd1","cli-tool\u002Fcomponents\u002Fskills\u002Fdevelopment\u002Fplaywright-e2e-builder",3963,"https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates","https:\u002F\u002Faitmpl.com","https:\u002F\u002Fgithub.com\u002Fdavila7","https:\u002F\u002Fdanielavila.me","Building AI dev tools with LLMs","2026-11-15 01:32:48",{"source":8,"skillName":5,"commands":72,"prompt":82,"zipAvailable":83},[73,76,79],{"tool":74,"command":75},"npx","npx skills add davila7\u002Fclaude-code-templates --skill playwright-e2e-builder",{"tool":77,"command":78},"bunx","bunx skills add davila7\u002Fclaude-code-templates --skill playwright-e2e-builder",{"tool":80,"command":81},"pnpm","pnpm dlx skills add davila7\u002Fclaude-code-templates --skill playwright-e2e-builder","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fdevelopment\u002Fplaywright-e2e-builder\u002FSKILL.md",true,[],[86,114,140,173,206,226],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":93,"publishedAt":54},"01M70NHBTQ8BV0A2SCAZXEPHCX","wealthville-pool-scoring","Score DeFi liquidity pools before providing liquidity. Returns a 0-100 pool score and an Enter\u002FHold\u002FExit\u002FReduce\u002FAvoid verdict with calibrated confidence for ~68,800 Solana pools and 575 EVM pools, plus a public miss-inclusive track record. Use when asked whether a pool is worth LPing into, which pools look best right now, or how accurate the scores have actually been.","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fweb-data\u002Fwealthville-pool-scoring\u002FSKILL.md",[92],{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},[94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113],"scoring","pool","wealthville pool scoring","liquidity","which","for","exit","now","use","when","reduce","with","record","track","verdict","evm","solana","how","public","look",{"skillNo":115,"name":116,"nameZh":6,"description":117,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":121,"publishedAt":54},"01M70MB6VR8ERJ4EM8D5KHBMEV","technical-debt-auditor","Scans a codebase and produces a quantified technical debt report with a prioritized remediation plan. Analyzes dead code, TODO\u002FFIXME\u002FHACK markers, dependency staleness, complexity hotspots, code duplication signals, test coverage gaps, unused exports, and outdated patterns. Use this skill when the user asks to audit their codebase for tech debt, wants a health check of their code quality, says things like \"where should I focus refactoring\", \"find code smells\", \"audit my codebase\", \"what technical debt do we have\", \"prioritize cleanup work\", or asks about code quality metrics. Also trigger when the user mentions \"code rot\", \"legacy cleanup\", \"refactoring priorities\", or wants to understand the overall health of a project before a major effort. Trigger even if the user doesn't say \"technical debt\" explicitly — any request to systematically assess code quality and identify improvement priorities belongs here.","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fdevelopment\u002Ftechnical-debt-auditor\u002FSKILL.md",[120],{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},[122,123,124,125,126,127,128,129,130,131,132,103,133,134,135,41,136,137,138,139],"technical debt","debt","technical","technical debt auditor","auditor","coverage","complexity","markers","project","cleanup","unused","code","todo","work","focus","signals","audit","dependency",{"skillNo":141,"name":142,"nameZh":6,"description":143,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":144,"categories":145,"keywords":155,"publishedAt":54},"01M70KPYH9QNHCNME5GJQGE22K","readonly-sql-guard","Make an agent's database access provably read-only. Use when an agent runs caller-supplied SQL against a production\u002FERP\u002Fanalytics database (a \"query\" MCP tool, text-to-SQL, an admin console), or when reviewing DB-access code for write\u002FDDL\u002Fside-effect\u002Ftransaction-escape risks. Checks what a statement CALLS, not just its shape.","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fdatabase\u002Freadonly-sql-guard\u002FSKILL.md",[146,149,150],{"categoryNo":147,"categoryName":148,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":151,"categoryName":152,"taxonomyType":153,"taxonomyTypeDesc":154},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[156,157,158,159,160,161,162,99,163,164,165,166,167,168,169,102,170,171,103,172],"readonly","guard","sql guard","sql","readonly sql guard","erp","effect","read-only","db","just","tool","calls","only","MCP","access","database","query",{"skillNo":174,"name":175,"nameZh":6,"description":176,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":177,"licenseFileUrl":178,"sourceHtmlUrl":179,"categories":180,"keywords":184,"publishedAt":54},"01M6AFY6F7CC2BBZP1QD6VTNVC","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Futilities\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Futilities\u002Fweb-artifacts-builder\u002FSKILL.md",[181],{"categoryNo":182,"categoryName":183,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000009","前端开发",[185,186,187,188,29,46,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,99,205],"artifacts builder","web","web artifacts builder","artifacts","routing","state management","component","css","frontend","ui","Tools","file","components","shadcn","react","Tailwind","suite","jsx","html","single-file","ui components",{"skillNo":207,"name":208,"nameZh":6,"description":209,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":177,"licenseFileUrl":210,"sourceHtmlUrl":211,"categories":212,"keywords":215,"publishedAt":54},"01M6AFWF33SFV9Z3SF4PEEE4BF","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fsecurity\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fsecurity\u002Fwebapp-testing\u002FSKILL.md",[213,214],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":182,"categoryName":183,"taxonomyType":21,"taxonomyTypeDesc":22},[216,42,217,218,28,186,219,193,194,220,221,222,223,99,224,105,225],"webapp testing","webapp","browser","applications","debugging","toolkit","logs","screenshots","local","behavior",{"skillNo":227,"name":228,"nameZh":6,"description":229,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":177,"licenseFileUrl":230,"sourceHtmlUrl":231,"categories":232,"keywords":240,"publishedAt":54},"01M6AF67Q67JJJ5V51JR2P52KA","discernment-nudge","After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals, or emails, estimates or projections, analysis or interpretation of data, factual claims they may rely on, or a multi-step argument — invoke this skill BEFORE finalizing your reply and then, if it applies, append 2-3 short follow-up questions, each tied to something specific in what you just produced, that help the user check key facts, probe the reasoning or assumptions, and notice missing context. Do this at most once per conversation. Skip it when the user asked a trivial how-to or simple lookup, wants a purely educational explanation, asked you only to format, convert, or assemble a file from content they provided, is writing code they will run, is doing creative writing or casual chat, or already asked you to double-check, cite, or review — the skill file explains these boundaries and the exact output format.","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fdiscernment-nudge\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fdiscernment-nudge\u002FSKILL.md",[233,236,237],{"categoryNo":234,"categoryName":235,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":238,"categoryName":239,"taxonomyType":153,"taxonomyTypeDesc":154},"01JBSEEDCAT000000000000036","内容创作者",[241,242,243,244,245,246,32,53,188,247,196,133,248,249,250,251,252,168,253,103,254,255,256,257,258,111,259],"discernment nudge","nudge","interpretation","help","run","reasoning","lookup","content","review","conversation","short","up","invoke","you","analysis","claims","argument","assemble","recommendations"]