Skip to content

JPeetz/agent-skills / skills/qa-testing/playwright-e2e-testing

playwright-e2e-testing

Verified

Use this skill when writing, debugging, or maintaining Playwright end-to-end tests in TypeScript, JavaScript, or Python. Covers test structure and architecture (Page Object Model, fixtures, custom matchers), locator strategy (role-based, test-ID, accessible selectors), auto-waiting and retry, API/network mocking, visual regression, component testing (React, Vue, Svelte), accessibility audits (axe-core), device emulation, authentication and session management (multi-profile, OAuth, 2FA), performance testing (Web Vitals, Lighthouse), CI/CD configuration (GitHub Actions, GitLab CI, sharding), flaky test detection and auto-healing, test data/fixtures, i18n testing, Electron and browser extension testing, security testing (XSS, CSRF, CSP), and WebSocket testing. Designed for agentic platforms — Claude Code, Codex, Cursor, Gemini CLI, OpenClaw, GitHub Copilot, Windsurf, OpenCode, and all SKILL.md-compatible agents.

FileKindSize
CHANGELOG.mdmarkdown2.2 KB
LICENSEother1.0 KB
SKILL.mdskill md23.4 KB
evals/evals.jsonconfig5.3 KB
references/ci-cd-patterns.mdmarkdown2.5 KB
references/locator-strategies.mdmarkdown3.0 KB
references/testing-types-matrix.mdmarkdown3.2 KB
scripts/flake-detector.shexecutablescript2.0 KB
scripts/generate-auth-profile.tsscript3.4 KB
scripts/validate-playwright-setup.shexecutablescript2.2 KB

references/ci-cd-patterns.md

View on GitHub
# CI/CD Patterns for Playwright

## GitHub Actions — Complete Workflow

```yaml
name: Playwright Tests
on:
  push:
    branches: [main, develop]
  pull_request:
    branches: [main]
  schedule:
    - cron: '0 6 * * 1-5'  # Daily weekday run

jobs:
  e2e:
    timeout-minutes: 30
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        shard: [1, 2, 3, 4]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: '20', cache: 'npm' }
      - run: npm ci
      - run: npx playwright install --with-deps chromium
      - run: npx playwright test --shard=${{ matrix.shard }}/4
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: report-${{ matrix.shard }}
          path: test-results/
```

## GitLab CI

```yaml
playwright:
  image: mcr.microsoft.com/playwright:v1.56.0-focal
  parallel: 4
  script:
    - npm ci
    - npx playwright test --shard=$CI_NODE_INDEX/$CI_NODE_TOTAL
  artifacts:
    when: always
    paths: [test-results/]
    expire_in: 7 days
```

## CircleCI

```yaml
executors:
  playwright:
    docker:
      - image: mcr.microsoft.com/playwright:v1.56.0-focal
jobs:
  test:
    executor: playwright
    parallelism: 4
    steps:
      - checkout
      - run: npm ci
      - run:
          command: |
            npx playwright test --shard=$(expr $CIRCLE_NODE_INDEX + 1)/$CIRCLE_NODE_TOTAL
```

## Performance Optimization

| Strategy | Impact | Configuration |
|----------|--------|---------------|
| Browser cache | -2min cold start | `cache: ['~/.cache/ms-playwright']` in CI |
| npm cache | -30sec install | `cache: 'npm'` in setup-node |
| Sharding | 4x speedup | Matrix strategy with `--shard` |
| Selective tests | 10x for PRs | `--grep` smoke tests on PR, full on main |
| Workers | CPU-bound tuning | `workers: process.env.CI ? 4 : undefined` |

## Failure Notification

```yaml
- name: Notify on failure
  if: failure()
  uses: slackapi/slack-github-action@v2
  with:
    webhook: ${{ secrets.SLACK_WEBHOOK }}
    webhook-type: incoming-webhook
    payload: |
      {
        "text": "⚠️ Playwright tests failed on ${{ github.ref_name }}: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
      }
```

## Docker Container for Isolated Runs

```dockerfile
FROM mcr.microsoft.com/playwright:v1.56.0-focal
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
CMD ["npx", "playwright", "test"]
```

Run: `docker build -t playwright-tests . && docker run playwright-tests`
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 470kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 470kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 470kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall