[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79AH6P6MZ0MSM6N0D1PDVMZ":3,"skill-same:01M79AH6P6MZ0MSM6N0D1PDVMZ":83},{"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":25,"commitSha":26,"skillDirectory":27,"forksCount":14,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M79AH6P6MZ0MSM6N0D1PDVMZ","playwright",null,"Browser automation and E2E testing with Playwright. Auto-detects dev servers, writes clean test scripts. Test pages, fill forms, take screenshots, check responsive design, validate UX, test login flows, check links, automate any browser task. Use for cross-browser testing, visual regression, API testing, component testing in TypeScript\u002FJavaScript and Python projects.","Elogic360\u002Fsoftware-factory","Elogic360","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F156535519?v=4","01M74NH3F0RB13PWB7JZDE2V80","elogic360","01M74NH3FPC65082MDZVMFHDM3",0,"MIT","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fintegrations\u002Fclaude-skills-secondsky\u002Fplugins\u002Fplaywright\u002Fskills\u002Fplaywright\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: playwright\ndescription: Browser automation and E2E testing with Playwright. Auto-detects dev servers, writes clean test scripts. Test pages, fill forms, take screenshots, check responsive design, validate UX, test login flows, check links, automate any browser task. Use for cross-browser testing, visual regression, API testing, component testing in TypeScript\u002FJavaScript and Python projects.\nallowed-tools: Bash, Read, Edit, Write, Grep, Glob, TodoWrite\nlicense: MIT\n---\n\n# Playwright - Browser Automation & E2E Testing\n\nExpert knowledge for browser automation and end-to-end testing with Playwright - a modern cross-browser testing framework.\n\n**IMPORTANT - Path Resolution:**\nThis skill can be installed in different locations. Before executing commands, determine the skill directory based on where you loaded this SKILL.md file, and use that path in all commands. Replace `$SKILL_DIR` with the actual discovered path.\n\nCommon installation paths:\n- Plugin system: `~\u002F.claude\u002Fplugins\u002F*\u002Fplaywright\u002Fskills\u002Fplaywright`\n- Manual global: `~\u002F.claude\u002Fskills\u002Fplaywright`\n- Project-specific: `\u003Cproject>\u002F.claude\u002Fskills\u002Fplaywright`\n\n## CRITICAL WORKFLOW - Follow These Steps\n\nWhen automating browser tasks:\n\n1. **Auto-detect dev servers** - For localhost testing, ALWAYS run server detection FIRST:\n   ```bash\n   cd $SKILL_DIR && node -e \"require('.\u002Flib\u002Fhelpers').detectDevServers().then(servers => console.log(JSON.stringify(servers)))\"\n   ```\n   - If **1 server found**: Use it automatically, inform user\n   - If **multiple servers found**: Ask user which one to test\n   - If **no servers found**: Ask for URL or offer to help start dev server\n\n2. **Write scripts to \u002Ftmp** - NEVER write test files to skill directory; always use `\u002Ftmp\u002Fplaywright-test-*.js`\n\n3. **Use visible browser by default** - Always use `headless: false` unless user specifically requests headless mode\n\n4. **Parameterize URLs** - Always make URLs configurable via constant at top of script\n\n5. **Execute via run.js** - Always run: `cd $SKILL_DIR && node run.js \u002Ftmp\u002Fplaywright-test-*.js`\n\n## Quick Start\n\n### First-Time Setup\n\n```bash\n# Navigate to skill directory\ncd $SKILL_DIR\n\n# Install using bun (preferred)\nbun run setup\n\n# Or using npm\nnpm run setup:npm\n```\n\nThis installs Playwright and Chromium browser. Only needed once.\n\n### Installation (For E2E Testing Projects)\n\n```bash\n# Using Bun (preferred)\nbun add -d @playwright\u002Ftest\nbunx playwright install\n\n# Using npm\nnpm init playwright@latest\n```\n\n### Configuration\n\n```typescript\n\u002F\u002F playwright.config.ts\nimport { defineConfig, devices } from '@playwright\u002Ftest'\n\nexport default defineConfig({\n  testDir: '.\u002Ftests',\n  fullyParallel: true,\n  reporter: 'html',\n  use: {\n    baseURL: 'http:\u002F\u002Flocalhost:3000',\n    trace: 'on-first-retry',\n    screenshot: 'only-on-failure',\n  },\n  projects: [\n    { name: 'chromium', use: { ...devices['Desktop Chrome'] } },\n    { name: 'firefox', use: { ...devices['Desktop Firefox'] } },\n    { name: 'webkit', use: { ...devices['Desktop Safari'] } },\n  ],\n  webServer: {\n    command: 'bun run dev',\n    url: 'http:\u002F\u002Flocalhost:3000',\n  },\n})\n```\n\n## Browser Automation Patterns\n\n### How It Works\n\n1. You describe what you want to test\u002Fautomate\n2. I auto-detect running dev servers (or ask for URL)\n3. I write custom Playwright code in `\u002Ftmp\u002Fplaywright-test-*.js`\n4. I execute it via: `cd $SKILL_DIR && node run.js \u002Ftmp\u002Fplaywright-test-*.js`\n5. Results displayed in real-time, browser window visible\n\n### Test a Page (Multiple Viewports)\n\n```javascript\n\u002F\u002F \u002Ftmp\u002Fplaywright-test-responsive.js\nconst { chromium } = require('playwright');\n\nconst TARGET_URL = 'http:\u002F\u002Flocalhost:3001'; \u002F\u002F Auto-detected\n\n(async () => {\n  const browser = await chromium.launch({ headless: false, slowMo: 100 });\n  const page = await browser.newPage();\n\n  \u002F\u002F Desktop test\n  await page.setViewportSize({ width: 1920, height: 1080 });\n  await page.goto(TARGET_URL);\n  console.log('Desktop - Title:', await page.title());\n  await page.screenshot({ path: '\u002Ftmp\u002Fdesktop.png', fullPage: true });\n\n  \u002F\u002F Mobile test\n  await page.setViewportSize({ width: 375, height: 667 });\n  await page.screenshot({ path: '\u002Ftmp\u002Fmobile.png', fullPage: true });\n\n  await browser.close();\n})();\n```\n\nExecute: `cd $SKILL_DIR && node run.js \u002Ftmp\u002Fplaywright-test-responsive.js`\n\n### Test Login Flow\n\n```javascript\n\u002F\u002F \u002Ftmp\u002Fplaywright-test-login.js\nconst { chromium } = require('playwright');\n\nconst TARGET_URL = 'http:\u002F\u002Flocalhost:3001'; \u002F\u002F Auto-detected\n\n(async () => {\n  const browser = await chromium.launch({ headless: false });\n  const page = await browser.newPage();\n\n  await page.goto(`${TARGET_URL}\u002Flogin`);\n  await page.fill('input[name=\"email\"]', 'test@example.com');\n  await page.fill('input[name=\"password\"]', 'password123');\n  await page.click('button[type=\"submit\"]');\n\n  await page.waitForURL('**\u002Fdashboard');\n  console.log('✅ Login successful, redirected to dashboard');\n\n  await browser.close();\n})();\n```\n\n### Check for Broken Links\n\n```javascript\nconst { chromium } = require('playwright');\n\n(async () => {\n  const browser = await chromium.launch({ headless: false });\n  const page = await browser.newPage();\n\n  await page.goto('http:\u002F\u002Flocalhost:3000');\n\n  const links = await page.locator('a[href^=\"http\"]').all();\n  const results = { working: 0, broken: [] };\n\n  for (const link of links) {\n    const href = await link.getAttribute('href');\n    try {\n      const response = await page.request.head(href);\n      if (response.ok()) {\n        results.working++;\n      } else {\n        results.broken.push({ url: href, status: response.status() });\n      }\n    } catch (e) {\n      results.broken.push({ url: href, error: e.message });\n    }\n  }\n\n  console.log(`✅ Working links: ${results.working}`);\n  console.log(`❌ Broken links:`, results.broken);\n\n  await browser.close();\n})();\n```\n\n## E2E Testing Patterns\n\n### Running Tests\n\n```bash\n# Run all tests\nbunx playwright test\n\n# Headed mode (see browser)\nbunx playwright test --headed\n\n# Specific file\nbunx playwright test tests\u002Flogin.spec.ts\n\n# Debug mode\nbunx playwright test --debug\n\n# UI mode (interactive)\nbunx playwright test --ui\n\n# Specific browser\nbunx playwright test --project=chromium\n\n# Generate report\nbunx playwright show-report\n```\n\n### Writing Tests\n\n```typescript\nimport { test, expect } from '@playwright\u002Ftest'\n\ntest.describe('Login flow', () => {\n  test('successful login', async ({ page }) => {\n    await page.goto('\u002F')\n    await page.getByRole('link', { name: 'Login' }).click()\n    await page.getByLabel('Email').fill('user@example.com')\n    await page.getByLabel('Password').fill('password123')\n    await page.getByRole('button', { name: 'Sign in' }).click()\n\n    await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible()\n  })\n\n  test('shows error for invalid credentials', async ({ page }) => {\n    await page.goto('\u002Flogin')\n    await page.getByLabel('Email').fill('wrong@example.com')\n    await page.getByLabel('Password').fill('wrongpassword')\n    await page.getByRole('button', { name: 'Sign in' }).click()\n\n    await expect(page.getByText('Invalid credentials')).toBeVisible()\n  })\n})\n```\n\n## Selectors (Best Practices)\n\n```typescript\n\u002F\u002F ✅ Role-based (recommended)\nawait page.getByRole('button', { name: 'Submit' })\nawait page.getByRole('link', { name: 'Home' })\n\n\u002F\u002F ✅ Text\u002FLabel\nawait page.getByText('Hello World')\nawait page.getByLabel('Email')\n\n\u002F\u002F ✅ Test ID (fallback)\nawait page.getByTestId('submit-button')\n\n\u002F\u002F ❌ Avoid CSS selectors (brittle)\nawait page.locator('.btn-primary')\n```\n\n## Assertions\n\n```typescript\n\u002F\u002F Visibility\nawait expect(page.getByText('Success')).toBeVisible()\nawait expect(page.getByRole('button')).toBeEnabled()\n\n\u002F\u002F Text\nawait expect(page.getByRole('heading')).toHaveText('Welcome')\nawait expect(page.getByRole('alert')).toContainText('error')\n\n\u002F\u002F Attributes\nawait expect(page.getByRole('link')).toHaveAttribute('href', '\u002Fhome')\n\n\u002F\u002F URL\u002FTitle\nawait expect(page).toHaveURL('\u002Fdashboard')\nawait expect(page).toHaveTitle('Dashboard')\n\n\u002F\u002F Count\nawait expect(page.getByRole('listitem')).toHaveCount(5)\n```\n\n## Actions\n\n```typescript\n\u002F\u002F Clicking\nawait page.getByRole('button').click()\nawait page.getByText('File').dblclick()\n\n\u002F\u002F Typing\nawait page.getByLabel('Email').fill('user@example.com')\nawait page.getByLabel('Search').press('Enter')\n\n\u002F\u002F Selecting\nawait page.getByLabel('Country').selectOption('us')\n\n\u002F\u002F File Upload\nawait page.getByLabel('Upload').setInputFiles('path\u002Fto\u002Ffile.pdf')\n```\n\n## Network Mocking\n\n```typescript\ntest('mocks API response', async ({ page }) => {\n  await page.route('**\u002Fapi\u002Fusers', async route => {\n    await route.fulfill({\n      status: 200,\n      contentType: 'application\u002Fjson',\n      body: JSON.stringify([{ id: 1, name: 'Test User' }]),\n    })\n  })\n\n  await page.goto('\u002Fusers')\n  await expect(page.getByText('Test User')).toBeVisible()\n})\n```\n\n## Visual Testing\n\n```typescript\ntest('captures screenshot', async ({ page }) => {\n  await page.goto('\u002F')\n  await page.screenshot({ path: 'screenshot.png', fullPage: true })\n  await expect(page).toHaveScreenshot('homepage.png')\n})\n```\n\n## Authentication State\n\n```typescript\n\u002F\u002F Save state after login\nsetup('authenticate', async ({ page }) => {\n  await page.goto('\u002Flogin')\n  await page.getByLabel('Email').fill('user@example.com')\n  await page.getByLabel('Password').fill('password123')\n  await page.getByRole('button', { name: 'Sign in' }).click()\n  await page.context().storageState({ path: 'auth.json' })\n})\n\n\u002F\u002F Reuse in config\nuse: { storageState: 'auth.json' }\n```\n\n## Page Object Model\n\n```typescript\n\u002F\u002F pages\u002FLoginPage.ts\nimport { Page, Locator } from '@playwright\u002Ftest'\n\nexport class LoginPage {\n  readonly emailInput: Locator\n  readonly passwordInput: Locator\n  readonly submitButton: Locator\n\n  constructor(page: 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 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\n\u002F\u002F Usage\nconst loginPage = new LoginPage(page)\nawait loginPage.login('user@example.com', 'password123')\n```\n\n## Available Helpers\n\nOptional utility functions in `lib\u002Fhelpers.js`:\n\n```javascript\nconst helpers = require('.\u002Flib\u002Fhelpers');\n\n\u002F\u002F Detect running dev servers (CRITICAL - use this first!)\nconst servers = await helpers.detectDevServers();\nconsole.log('Found servers:', servers);\n\n\u002F\u002F Safe click with retry\nawait helpers.safeClick(page, 'button.submit', { retries: 3 });\n\n\u002F\u002F Safe type with clear\nawait helpers.safeType(page, '#username', 'testuser');\n\n\u002F\u002F Take timestamped screenshot\nawait helpers.takeScreenshot(page, 'test-result');\n\n\u002F\u002F Handle cookie banners\nawait helpers.handleCookieBanner(page);\n\n\u002F\u002F Extract table data\nconst data = await helpers.extractTableData(page, 'table.results');\n\n\u002F\u002F Create context with custom headers\nconst context = await helpers.createContext(browser);\n```\n\n## Custom HTTP Headers\n\nConfigure custom headers for all HTTP requests via environment variables:\n\n```bash\n# Single header (common case)\nPW_HEADER_NAME=X-Automated-By PW_HEADER_VALUE=playwright-skill \\\n  cd $SKILL_DIR && node run.js \u002Ftmp\u002Fmy-script.js\n\n# Multiple headers (JSON format)\nPW_EXTRA_HEADERS='{\"X-Automated-By\":\"playwright-skill\",\"X-Debug\":\"true\"}' \\\n  cd $SKILL_DIR && node run.js \u002Ftmp\u002Fmy-script.js\n```\n\nHeaders are automatically applied when using `helpers.createContext()`.\n\n## Inline Execution (Simple Tasks)\n\nFor quick one-off tasks:\n\n```bash\ncd $SKILL_DIR && node run.js \"\nconst browser = await chromium.launch({ headless: false });\nconst page = await browser.newPage();\nawait page.goto('http:\u002F\u002Flocalhost:3001');\nawait page.screenshot({ path: '\u002Ftmp\u002Fquick-screenshot.png', fullPage: true });\nconsole.log('Screenshot saved');\nawait browser.close();\n\"\n```\n\n**When to use:**\n- **Inline**: Quick one-off tasks (screenshot, element check)\n- **Files**: Complex tests, reusable automation\n\n## Best Practices\n\n- **CRITICAL: Detect servers FIRST** - Always run `detectDevServers()` before writing test code\n- **Use \u002Ftmp for test files** - Write to `\u002Ftmp\u002Fplaywright-test-*.js`, never to skill directory\n- **Parameterize URLs** - Put detected\u002Fprovided URL in `TARGET_URL` constant\n- **DEFAULT: Visible browser** - Always use `headless: false` unless explicitly requested\n- **Prefer role-based selectors** - More stable than CSS selectors\n- **Trust auto-waiting** - No manual sleeps needed\n- **Each test gets fresh context** - Automatic isolation\n- **Run tests in parallel** - Default behavior\n- **Mock external dependencies** - Use `page.route()`\n- **Use trace viewer** - Time-travel debugging\n\n## Tips\n\n- **Slow down:** Use `slowMo: 100` to make actions visible\n- **Wait strategies:** Use `waitForURL`, `waitForSelector`, `waitForLoadState` instead of fixed timeouts\n- **Error handling:** Always use try-catch for robust automation\n- **Console output:** Use `console.log()` to track progress\n\n## Troubleshooting\n\n**Playwright not installed:**\n```bash\ncd $SKILL_DIR && bun run setup\n```\n\n**Module not found:**\nEnsure running from skill directory via `run.js` wrapper\n\n**Browser doesn't open:**\nCheck `headless: false` and ensure display available\n\n**Element not found:**\nAdd wait: `await page.waitForSelector('.element', { timeout: 10000 })`\n\n## Secure Installation\n\nWhen installing Playwright and browser binaries, follow supply chain security best practices:\n\n- **Block post-install scripts** — `npm config set ignore-scripts true` (then manually run `npx playwright install` to download browsers)\n- **Cooldown period** — Wait 7 days for new package versions to be vetted by the community\n- **Audit before installing** — Run `socket package score npm \u003Cpkg>` or use `socket npm install \u003Cpkg>` to check packages\n\nLoad the `dependency-upgrade` skill for full security configuration including Socket CLI integration, cooldown setup, lockfile validation, and CI enforcement.\n\n## See Also\n\n- `vitest-testing` - Unit and integration testing\n- `api-testing` - HTTP API testing\n- `test-quality-analysis` - Test quality patterns\n\n## When to Load References\n\nLoad `references\u002FAPI_REFERENCE.md` when you need:\n- Advanced selector patterns and locator strategies\n- Network interception and request\u002Fresponse mocking\n- Authentication patterns and session management\n- Visual regression testing setup\n- Mobile device emulation configurations\n- Performance testing and metrics\n- Debugging techniques (trace viewer, inspector)\n- CI\u002FCD pipeline integration\n- Accessibility testing with axe-core\n- Data-driven and parameterized testing\n- Page Object Model advanced patterns\n- Parallel execution strategies\n","# Playwright - Browser Automation & E2E Testing\n\nExpert knowledge for browser automation and end-to-end testing with Playwright - a modern cross-browser testing framework.\n\n**IMPORTANT - Path Resolution:**\nThis skill can be installed in different locations. Before executing commands, determine the skill directory based on where you loaded this SKILL.md file, and use that path in all commands. Replace `$SKILL_DIR` with the actual discovered path.\n\nCommon installation paths:\n- Plugin system: `~\u002F.claude\u002Fplugins\u002F*\u002Fplaywright\u002Fskills\u002Fplaywright`\n- Manual global: `~\u002F.claude\u002Fskills\u002Fplaywright`\n- Project-specific: `\u003Cproject>\u002F.claude\u002Fskills\u002Fplaywright`\n\n## CRITICAL WORKFLOW - Follow These Steps\n\nWhen automating browser tasks:\n\n1. **Auto-detect dev servers** - For localhost testing, ALWAYS run server detection FIRST:\n   ```bash\n   cd $SKILL_DIR && node -e \"require('.\u002Flib\u002Fhelpers').detectDevServers().then(servers => console.log(JSON.stringify(servers)))\"\n   ```\n   - If **1 server found**: Use it automatically, inform user\n   - If **multiple servers found**: Ask user which one to test\n   - If **no servers found**: Ask for URL or offer to help start dev server\n\n2. **Write scripts to \u002Ftmp** - NEVER write test files to skill directory; always use `\u002Ftmp\u002Fplaywright-test-*.js`\n\n3. **Use visible browser by default** - Always use `headless: false` unless user specifically requests headless mode\n\n4. **Parameterize URLs** - Always make URLs configurable via constant at top of script\n\n5. **Execute via run.js** - Always run: `cd $SKILL_DIR && node run.js \u002Ftmp\u002Fplaywright-test-*.js`\n\n## Quick Start\n\n### First-Time Setup\n\n```bash\n# Navigate to skill directory\ncd $SKILL_DIR\n\n# Install using bun (preferred)\nbun run setup\n\n# Or using npm\nnpm run setup:npm\n```\n\nThis installs Playwright and Chromium browser. Only needed once.\n\n### Installation (For E2E Testing Projects)\n\n```bash\n# Using Bun (preferred)\nbun add -d @playwright\u002Ftest\nbunx playwright install\n\n# Using npm\nnpm init playwright@latest\n```\n\n### Configuration\n\n```typescript\n\u002F\u002F playwright.config.ts\nimport { defineConfig, devices } from '@playwright\u002Ftest'\n\nexport default defineConfig({\n  testDir: '.\u002Ftests',\n  fullyParallel: true,\n  reporter: 'html',\n  use: {\n    baseURL: 'http:\u002F\u002Flocalhost:3000',\n    trace: 'on-first-retry',\n    screenshot: 'only-on-failure',\n  },\n  projects: [\n    { name: 'chromium', use: { ...devices['Desktop Chrome'] } },\n    { name: 'firefox', use: { ...devices['Desktop Firefox'] } },\n    { name: 'webkit', use: { ...devices['Desktop Safari'] } },\n  ],\n  webServer: {\n    command: 'bun run dev',\n    url: 'http:\u002F\u002Flocalhost:3000',\n  },\n})\n```\n\n## Browser Automation Patterns\n\n### How It Works\n\n1. You describe what you want to test\u002Fautomate\n2. I auto-detect running dev servers (or ask for URL)\n3. I write custom Playwright code in `\u002Ftmp\u002Fplaywright-test-*.js`\n4. I execute it via: `cd $SKILL_DIR && node run.js \u002Ftmp\u002Fplaywright-test-*.js`\n5. Results displayed in real-time, browser window visible\n\n### Test a Page (Multiple Viewports)\n\n```javascript\n\u002F\u002F \u002Ftmp\u002Fplaywright-test-responsive.js\nconst { chromium } = require('playwright');\n\nconst TARGET_URL = 'http:\u002F\u002Flocalhost:3001'; \u002F\u002F Auto-detected\n\n(async () => {\n  const browser = await chromium.launch({ headless: false, slowMo: 100 });\n  const page = await browser.newPage();\n\n  \u002F\u002F Desktop test\n  await page.setViewportSize({ width: 1920, height: 1080 });\n  await page.goto(TARGET_URL);\n  console.log('Desktop - Title:', await page.title());\n  await page.screenshot({ path: '\u002Ftmp\u002Fdesktop.png', fullPage: true });\n\n  \u002F\u002F Mobile test\n  await page.setViewportSize({ width: 375, height: 667 });\n  await page.screenshot({ path: '\u002Ftmp\u002Fmobile.png', fullPage: true });\n\n  await browser.close();\n})();\n```\n\nExecute: `cd $SKILL_DIR && node run.js \u002Ftmp\u002Fplaywright-test-responsive.js`\n\n### Test Login Flow\n\n```javascript\n\u002F\u002F \u002Ftmp\u002Fplaywright-test-login.js\nconst { chromium } = require('playwright');\n\nconst TARGET_URL = 'http:\u002F\u002Flocalhost:3001'; \u002F\u002F Auto-detected\n\n(async () => {\n  const browser = await chromium.launch({ headless: false });\n  const page = await browser.newPage();\n\n  await page.goto(`${TARGET_URL}\u002Flogin`);\n  await page.fill('input[name=\"email\"]', 'test@example.com');\n  await page.fill('input[name=\"password\"]', 'password123');\n  await page.click('button[type=\"submit\"]');\n\n  await page.waitForURL('**\u002Fdashboard');\n  console.log('✅ Login successful, redirected to dashboard');\n\n  await browser.close();\n})();\n```\n\n### Check for Broken Links\n\n```javascript\nconst { chromium } = require('playwright');\n\n(async () => {\n  const browser = await chromium.launch({ headless: false });\n  const page = await browser.newPage();\n\n  await page.goto('http:\u002F\u002Flocalhost:3000');\n\n  const links = await page.locator('a[href^=\"http\"]').all();\n  const results = { working: 0, broken: [] };\n\n  for (const link of links) {\n    const href = await link.getAttribute('href');\n    try {\n      const response = await page.request.head(href);\n      if (response.ok()) {\n        results.working++;\n      } else {\n        results.broken.push({ url: href, status: response.status() });\n      }\n    } catch (e) {\n      results.broken.push({ url: href, error: e.message });\n    }\n  }\n\n  console.log(`✅ Working links: ${results.working}`);\n  console.log(`❌ Broken links:`, results.broken);\n\n  await browser.close();\n})();\n```\n\n## E2E Testing Patterns\n\n### Running Tests\n\n```bash\n# Run all tests\nbunx playwright test\n\n# Headed mode (see browser)\nbunx playwright test --headed\n\n# Specific file\nbunx playwright test tests\u002Flogin.spec.ts\n\n# Debug mode\nbunx playwright test --debug\n\n# UI mode (interactive)\nbunx playwright test --ui\n\n# Specific browser\nbunx playwright test --project=chromium\n\n# Generate report\nbunx playwright show-report\n```\n\n### Writing Tests\n\n```typescript\nimport { test, expect } from '@playwright\u002Ftest'\n\ntest.describe('Login flow', () => {\n  test('successful login', async ({ page }) => {\n    await page.goto('\u002F')\n    await page.getByRole('link', { name: 'Login' }).click()\n    await page.getByLabel('Email').fill('user@example.com')\n    await page.getByLabel('Password').fill('password123')\n    await page.getByRole('button', { name: 'Sign in' }).click()\n\n    await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible()\n  })\n\n  test('shows error for invalid credentials', async ({ page }) => {\n    await page.goto('\u002Flogin')\n    await page.getByLabel('Email').fill('wrong@example.com')\n    await page.getByLabel('Password').fill('wrongpassword')\n    await page.getByRole('button', { name: 'Sign in' }).click()\n\n    await expect(page.getByText('Invalid credentials')).toBeVisible()\n  })\n})\n```\n\n## Selectors (Best Practices)\n\n```typescript\n\u002F\u002F ✅ Role-based (recommended)\nawait page.getByRole('button', { name: 'Submit' })\nawait page.getByRole('link', { name: 'Home' })\n\n\u002F\u002F ✅ Text\u002FLabel\nawait page.getByText('Hello World')\nawait page.getByLabel('Email')\n\n\u002F\u002F ✅ Test ID (fallback)\nawait page.getByTestId('submit-button')\n\n\u002F\u002F ❌ Avoid CSS selectors (brittle)\nawait page.locator('.btn-primary')\n```\n\n## Assertions\n\n```typescript\n\u002F\u002F Visibility\nawait expect(page.getByText('Success')).toBeVisible()\nawait expect(page.getByRole('button')).toBeEnabled()\n\n\u002F\u002F Text\nawait expect(page.getByRole('heading')).toHaveText('Welcome')\nawait expect(page.getByRole('alert')).toContainText('error')\n\n\u002F\u002F Attributes\nawait expect(page.getByRole('link')).toHaveAttribute('href', '\u002Fhome')\n\n\u002F\u002F URL\u002FTitle\nawait expect(page).toHaveURL('\u002Fdashboard')\nawait expect(page).toHaveTitle('Dashboard')\n\n\u002F\u002F Count\nawait expect(page.getByRole('listitem')).toHaveCount(5)\n```\n\n## Actions\n\n```typescript\n\u002F\u002F Clicking\nawait page.getByRole('button').click()\nawait page.getByText('File').dblclick()\n\n\u002F\u002F Typing\nawait page.getByLabel('Email').fill('user@example.com')\nawait page.getByLabel('Search').press('Enter')\n\n\u002F\u002F Selecting\nawait page.getByLabel('Country').selectOption('us')\n\n\u002F\u002F File Upload\nawait page.getByLabel('Upload').setInputFiles('path\u002Fto\u002Ffile.pdf')\n```\n\n## Network Mocking\n\n```typescript\ntest('mocks API response', async ({ page }) => {\n  await page.route('**\u002Fapi\u002Fusers', async route => {\n    await route.fulfill({\n      status: 200,\n      contentType: 'application\u002Fjson',\n      body: JSON.stringify([{ id: 1, name: 'Test User' }]),\n    })\n  })\n\n  await page.goto('\u002Fusers')\n  await expect(page.getByText('Test User')).toBeVisible()\n})\n```\n\n## Visual Testing\n\n```typescript\ntest('captures screenshot', async ({ page }) => {\n  await page.goto('\u002F')\n  await page.screenshot({ path: 'screenshot.png', fullPage: true })\n  await expect(page).toHaveScreenshot('homepage.png')\n})\n```\n\n## Authentication State\n\n```typescript\n\u002F\u002F Save state after login\nsetup('authenticate', async ({ page }) => {\n  await page.goto('\u002Flogin')\n  await page.getByLabel('Email').fill('user@example.com')\n  await page.getByLabel('Password').fill('password123')\n  await page.getByRole('button', { name: 'Sign in' }).click()\n  await page.context().storageState({ path: 'auth.json' })\n})\n\n\u002F\u002F Reuse in config\nuse: { storageState: 'auth.json' }\n```\n\n## Page Object Model\n\n```typescript\n\u002F\u002F pages\u002FLoginPage.ts\nimport { Page, Locator } from '@playwright\u002Ftest'\n\nexport class LoginPage {\n  readonly emailInput: Locator\n  readonly passwordInput: Locator\n  readonly submitButton: Locator\n\n  constructor(page: 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 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\n\u002F\u002F Usage\nconst loginPage = new LoginPage(page)\nawait loginPage.login('user@example.com', 'password123')\n```\n\n## Available Helpers\n\nOptional utility functions in `lib\u002Fhelpers.js`:\n\n```javascript\nconst helpers = require('.\u002Flib\u002Fhelpers');\n\n\u002F\u002F Detect running dev servers (CRITICAL - use this first!)\nconst servers = await helpers.detectDevServers();\nconsole.log('Found servers:', servers);\n\n\u002F\u002F Safe click with retry\nawait helpers.safeClick(page, 'button.submit', { retries: 3 });\n\n\u002F\u002F Safe type with clear\nawait helpers.safeType(page, '#username', 'testuser');\n\n\u002F\u002F Take timestamped screenshot\nawait helpers.takeScreenshot(page, 'test-result');\n\n\u002F\u002F Handle cookie banners\nawait helpers.handleCookieBanner(page);\n\n\u002F\u002F Extract table data\nconst data = await helpers.extractTableData(page, 'table.results');\n\n\u002F\u002F Create context with custom headers\nconst context = await helpers.createContext(browser);\n```\n\n## Custom HTTP Headers\n\nConfigure custom headers for all HTTP requests via environment variables:\n\n```bash\n# Single header (common case)\nPW_HEADER_NAME=X-Automated-By PW_HEADER_VALUE=playwright-skill \\\n  cd $SKILL_DIR && node run.js \u002Ftmp\u002Fmy-script.js\n\n# Multiple headers (JSON format)\nPW_EXTRA_HEADERS='{\"X-Automated-By\":\"playwright-skill\",\"X-Debug\":\"true\"}' \\\n  cd $SKILL_DIR && node run.js \u002Ftmp\u002Fmy-script.js\n```\n\nHeaders are automatically applied when using `helpers.createContext()`.\n\n## Inline Execution (Simple Tasks)\n\nFor quick one-off tasks:\n\n```bash\ncd $SKILL_DIR && node run.js \"\nconst browser = await chromium.launch({ headless: false });\nconst page = await browser.newPage();\nawait page.goto('http:\u002F\u002Flocalhost:3001');\nawait page.screenshot({ path: '\u002Ftmp\u002Fquick-screenshot.png', fullPage: true });\nconsole.log('Screenshot saved');\nawait browser.close();\n\"\n```\n\n**When to use:**\n- **Inline**: Quick one-off tasks (screenshot, element check)\n- **Files**: Complex tests, reusable automation\n\n## Best Practices\n\n- **CRITICAL: Detect servers FIRST** - Always run `detectDevServers()` before writing test code\n- **Use \u002Ftmp for test files** - Write to `\u002Ftmp\u002Fplaywright-test-*.js`, never to skill directory\n- **Parameterize URLs** - Put detected\u002Fprovided URL in `TARGET_URL` constant\n- **DEFAULT: Visible browser** - Always use `headless: false` unless explicitly requested\n- **Prefer role-based selectors** - More stable than CSS selectors\n- **Trust auto-waiting** - No manual sleeps needed\n- **Each test gets fresh context** - Automatic isolation\n- **Run tests in parallel** - Default behavior\n- **Mock external dependencies** - Use `page.route()`\n- **Use trace viewer** - Time-travel debugging\n\n## Tips\n\n- **Slow down:** Use `slowMo: 100` to make actions visible\n- **Wait strategies:** Use `waitForURL`, `waitForSelector`, `waitForLoadState` instead of fixed timeouts\n- **Error handling:** Always use try-catch for robust automation\n- **Console output:** Use `console.log()` to track progress\n\n## Troubleshooting\n\n**Playwright not installed:**\n```bash\ncd $SKILL_DIR && bun run setup\n```\n\n**Module not found:**\nEnsure running from skill directory via `run.js` wrapper\n\n**Browser doesn't open:**\nCheck `headless: false` and ensure display available\n\n**Element not found:**\nAdd wait: `await page.waitForSelector('.element', { timeout: 10000 })`\n\n## Secure Installation\n\nWhen installing Playwright and browser binaries, follow supply chain security best practices:\n\n- **Block post-install scripts** — `npm config set ignore-scripts true` (then manually run `npx playwright install` to download browsers)\n- **Cooldown period** — Wait 7 days for new package versions to be vetted by the community\n- **Audit before installing** — Run `socket package score npm \u003Cpkg>` or use `socket npm install \u003Cpkg>` to check packages\n\nLoad the `dependency-upgrade` skill for full security configuration including Socket CLI integration, cooldown setup, lockfile validation, and CI enforcement.\n\n## See Also\n\n- `vitest-testing` - Unit and integration testing\n- `api-testing` - HTTP API testing\n- `test-quality-analysis` - Test quality patterns\n\n## When to Load References\n\nLoad `references\u002FAPI_REFERENCE.md` when you need:\n- Advanced selector patterns and locator strategies\n- Network interception and request\u002Fresponse mocking\n- Authentication patterns and session management\n- Visual regression testing setup\n- Mobile device emulation configurations\n- Performance testing and metrics\n- Debugging techniques (trace viewer, inspector)\n- CI\u002FCD pipeline integration\n- Accessibility testing with axe-core\n- Data-driven and parameterized testing\n- Page Object Model advanced patterns\n- Parallel execution strategies\n",{"name":5,"license":15,"description":7,"allowed-tools":24},"Bash, Read, Edit, Write, Grep, Glob, TodoWrite","main","c475fc64e94e803b50d14a791dfee8853fbb2c5c","integrations\u002Fclaude-skills-secondsky\u002Fplugins\u002Fplaywright\u002Fskills\u002Fplaywright","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory","https:\u002F\u002Fgithub.com\u002FElogic360","2026-11-08 22:21:22",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add Elogic360\u002Fsoftware-factory --skill playwright",{"tool":37,"command":38},"bunx","bunx skills add Elogic360\u002Fsoftware-factory --skill playwright",{"tool":40,"command":41},"pnpm","pnpm dlx skills add Elogic360\u002Fsoftware-factory --skill playwright","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fintegrations\u002Fclaude-skills-secondsky\u002Fplugins\u002Fplaywright\u002Fskills\u002Fplaywright\u002FSKILL.md",true,[45,51,57,61,65,69,75,79],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"bun.lock","OTHER","其他",1129,"https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fintegrations\u002Fclaude-skills-secondsky\u002Fplugins\u002Fplaywright\u002Fskills\u002Fplaywright\u002Fbun.lock",{"path":52,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":55,"sourceHtmlUrl":56},"examples\u002Fform-test.js","SCRIPT","脚本",876,"https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fintegrations\u002Fclaude-skills-secondsky\u002Fplugins\u002Fplaywright\u002Fskills\u002Fplaywright\u002Fexamples\u002Fform-test.js",{"path":58,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":59,"sourceHtmlUrl":60},"examples\u002Flink-checker.js",1835,"https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fintegrations\u002Fclaude-skills-secondsky\u002Fplugins\u002Fplaywright\u002Fskills\u002Fplaywright\u002Fexamples\u002Flink-checker.js",{"path":62,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":63,"sourceHtmlUrl":64},"examples\u002Fresponsive-test.js",1127,"https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fintegrations\u002Fclaude-skills-secondsky\u002Fplugins\u002Fplaywright\u002Fskills\u002Fplaywright\u002Fexamples\u002Fresponsive-test.js",{"path":66,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":67,"sourceHtmlUrl":68},"lib\u002Fhelpers.js",13491,"https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fintegrations\u002Fclaude-skills-secondsky\u002Fplugins\u002Fplaywright\u002Fskills\u002Fplaywright\u002Flib\u002Fhelpers.js",{"path":70,"resourceType":71,"resourceTypeDesc":72,"sizeBytes":73,"sourceHtmlUrl":74},"package.json","REFERENCE","参考文档",1036,"https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fintegrations\u002Fclaude-skills-secondsky\u002Fplugins\u002Fplaywright\u002Fskills\u002Fplaywright\u002Fpackage.json",{"path":76,"resourceType":71,"resourceTypeDesc":72,"sizeBytes":77,"sourceHtmlUrl":78},"references\u002FAPI_REFERENCE.md",14918,"https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fintegrations\u002Fclaude-skills-secondsky\u002Fplugins\u002Fplaywright\u002Fskills\u002Fplaywright\u002Freferences\u002FAPI_REFERENCE.md",{"path":80,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":81,"sourceHtmlUrl":82},"run.js",6798,"https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fintegrations\u002Fclaude-skills-secondsky\u002Fplugins\u002Fplaywright\u002Fskills\u002Fplaywright\u002Frun.js",[84,92,99,106,113,120],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":88,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M79G206MT3J6S0GY3C45P2KV","vss-summarize-video","Use to summarize a recorded video via the LVS summarization microservice (HITL-gated) with a VLM fallback. Not for report generation or live RTSP captioning.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-summarize-video\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":88,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":19},"01M79G1WN63PGRE8CKD47WEBQ5","vss-setup-video-analytics-api","Use to deploy the vss-video-analytics-api REST service standalone (config-source, data-log bind, Elasticsearch, optional Kafka). Not for full warehouse deploy.","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-setup-video-analytics-api\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":88,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":19},"01M79G1S9F7VY3EF6H53PRP5AN","vss-setup-behavior-analytics","Use to deploy the vss-behavior-analytics service standalone (entrypoint, config-source, optional calibration). Not for the full warehouse deploy.","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-setup-behavior-analytics\u002FSKILL.md",[],[],{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":88,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":19},"01M79G1N1S1Y27PFZPYMNK1MTQ","vss-search-archive","Use this skill to run top-level VSS fusion search on archived video, or to ingest video files \u002F RTSP streams for search. Do NOT use for ad-hoc visual Q&A (use vss-ask-video), live captioning (use vss-deploy-dense-captioning), or video summarization and reports (use vss-summarize-video).","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-search-archive\u002FSKILL.md",[],[],{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":88,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":19},"01M79G1H6WN0Q6C0VCAXCZX6B7","vss-query-analytics","Use this skill when reading video-analytics metrics, incidents, alerts, and sensor data via the VA-MCP server (port 9901). Not for live VLM or incident-range narrative reports.","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-query-analytics\u002FSKILL.md",[],[],{"skillNo":121,"name":122,"nameZh":6,"description":123,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":88,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":126,"publishedAt":19},"01M79G1DYPNXQS7QHZ0AAF5FX5","vss-manage-video-io-storage","Use to call the VIOS REST API (sensor list, timelines, clip extraction, snapshots, add\u002Fdelete sensors and streams). Not for VLM inference or search.","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-manage-video-io-storage\u002FSKILL.md",[],[]]