plugins/testing-e2e/skills/testing-e2e/SKILL.md
E2E testing with Playwright — the primary user-facing skill for writing, running, and generating browser tests. Use when user asks to "write e2e tests", "test this page", "run playwright tests", "generate browser tests", "check accessibility", or "visual regression". Supports TypeScript tests and Go/HTMX web applications.
npx skillsauth add alexei-led/claude-code-config testing-e2eInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Execute E2E testing workflows using Playwright scripts (via playwright-skill). Do not delete, reset, or mutate non-test data without explicit user confirmation. If the app cannot be started or fixtures are unavailable, report BLOCKED instead of inventing passing results.
Runner: Examples below use
npx playwright. If the project uses Bun, substitutebunx playwrighteverywhere. Both runners work; pick the one matching the project's lockfile (package-lock.json/pnpm-lock.yaml→npx;bun.lock/bun.lockb→bunx).
Use TaskCreate / TaskUpdate to track these 5 phases:
$ARGUMENTS:
run → Run existing E2E testsrecord → Record browser session for test generationgenerate → Generate test from URL or page descriptionverify <feature> → Verify specific feature works in browserIf no argument provided, use AskUserQuestion. Ask one question at a time:
| Header | Question | Options | | ------ | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Action | What E2E testing task to run? | 1. Run tests - Execute existing Playwright tests 2. Record - Record browser session 3. Generate - Create test from URL/description 4. Verify - Check feature |
Before any browser test run or test-generation plan, explicitly include dev-server detection/startup and deterministic test data setup. Do not jump straight to browser steps.
baseURL; start it if missing, or report the blocker if no start command is known.npx playwright test
# or, with Bun:
bunx playwright test
For specific test:
npx playwright test login.spec.ts
For headed mode (visible browser):
npx playwright test --headed
Write a Playwright script to /tmp/playwright-record-*.js that:
headless: false and slowMo: 100cd ~/.claude/skills/playwright-skill && node run.js /tmp/playwright-record-*.jsTranslate manual flows into Playwright actions and assertions, but first define deterministic fixtures: seeded users/items/coupons, fixed dates, stable IDs, reset database state, and mocked external services where needed.
Spawn playwright-tester agent:
Task(
subagent_type="playwright-tester",
description="Generate E2E test",
prompt="Generate E2E test for:
URL: {target URL}
Flow: {user flow description}
Requirements:
- Use Page Object pattern
- Use semantic locators (getByRole, getByLabel, getByText)
- Include assertions for expected outcomes
- No hardcoded waits (use waitFor patterns)
- Include accessibility checks where appropriate"
)
Spawn playwright-tester agent for feature verification:
Task(
subagent_type="playwright-tester",
description="Verify feature",
prompt="Verify this feature works correctly in the browser:
Feature: {feature description}
Steps:
1. Navigate to appropriate page
2. Execute user flow
3. Assert expected outcomes
4. Report PASS/FAIL with evidence (screenshots if needed)"
)
Run the test suite and validate:
npx playwright test --headed
Pass criteria: all tests green, no flaky failures on re-run, deterministic fixtures reset cleanly, and traces/screenshots/videos are saved or linked when failures occur.
If tests fail:
npx playwright test <failed-spec> --headednpx playwright testThe final report must include PASS/FAIL/BLOCKED, dev server status, fixture/reset summary, test results, and artifact paths for traces/screenshots/videos/reports when relevant. If tests were not run, report BLOCKED or explain exactly why; do not imply success.
E2E TESTING
===========
Action: {run|record|generate|verify}
Result: PASS | FAIL | BLOCKED
Tests: {pass/fail count}
Dev server: {reused|started|not needed|blocked: reason}
Fixtures: {deterministic data/reset summary}
Artifacts: {trace/screenshots/videos/report paths or "none"}
Details:
- [test results or generation summary]
Write Playwright scripts to /tmp/ and run via the playwright-skill executor:
cd ~/.claude/skills/playwright-skill && node run.js /tmp/playwright-test-*.js
The executor handles module resolution, auto-installs Chromium if needed, and provides helper utilities. See playwright-skill/SKILL.md for full patterns.
browser_snapshot to verify DOM updates after HTMX swapshx-trigger, hx-swap, hx-target behaviorsHX-* response headers in network requests// BAD: Immediate failure
await page.click("#submit-btn");
// GOOD: Wait with timeout + fallback
const btn = page.locator("#submit-btn");
if ((await btn.count()) === 0) {
// Try alternative selector
await page.click('button[type="submit"]');
} else {
await btn.click();
}
Recovery strategies:
browser_snapshot to inspect current DOM state| Error | Cause | Solution | | ------------------ | ------------------------ | --------------------------------- | | Navigation timeout | Slow page load | Increase timeout, check network | | Action timeout | Element not interactable | Wait for visibility/enabled state | | Expect timeout | Assertion failed | Verify DOM state with snapshot |
// Configure timeouts
test.setTimeout(60000); // Test timeout
page.setDefaultTimeout(30000); // Action timeout
// Or per-action
await page.click("#btn", { timeout: 10000 });
// Wait for network idle
await page.waitForLoadState("networkidle");
// Mock failing endpoints
await page.route("**/api/**", (route) => {
route.fulfill({ status: 500, body: "Server Error" });
});
Avoid:
page.waitForTimeout(1000) delays.btn-23Prefer:
waitForSelector, waitForLoadStategetByRole('button', { name: 'Submit' })browser_snapshot shows accessibility tree# Run with trace
npx playwright test --trace on
# View trace
npx playwright show-trace trace.zip
Execute E2E testing workflow now.
tools
Idiomatic shell development for POSIX sh, Bash, Zsh, Fish, hooks, CI shell steps, and scriptable CLI glue. Use when writing or changing `.sh`, `.bash`, `.zsh`, `.fish`, `.bats`, shell functions, shell pipelines, or command-runner recipes. Emphasizes portability, quoting, safe filesystem/process handling, non-TUI CLI tools, ShellCheck, shfmt, Bats, and ShellSpec. NOT for Python, TypeScript, Go, web code, or infrastructure operations.
tools
Use when planning, executing, checkpointing, finishing, or inspecting lightweight spec-driven work. Runs one task at a time using `.spec/` markdown files and the bundled `specctl` helper. NOT for broad product discovery beyond a short requirement interview.
testing
Author, inspect, troubleshoot, and review infrastructure across IaC, Kubernetes, cloud resources, containers, CI/CD, and Linux hosts. Use when changing Terraform/OpenTofu, Kubernetes, Helm, Kustomize, Dockerfiles, GitHub Actions, AWS, GCP, Cloud Run, BigQuery, IAM, logs, instances, or service health. NOT for deploy/apply/rollback workflows (see deploying-infra). NOT for shell scripts or generic command pipelines (see writing-shell).
development
Configure safe git workflow hygiene: pre-commit/pre-push hooks, Gitleaks secret scanning, .gitignore rules, local git config, and guardrails. Use when setting up git hooks, gitleaks/git leaks, staged pre-commit checks, pre-push validation, core.hooksPath, .gitignore, or git config best practices. NOT for creating commits (use committing-code), cleaning branches/worktrees (use cleanup-git), or creating worktrees (use using-git-worktrees).