agentleFS
fxmartinfxmartin/claude-code-config/skills/execute-e2e-tests/SKILL.md

execute-e2e-tests

Skill2 starsChanged 12 days agoMITView on GitHub

Run and manage Playwright E2E tests. Setup, write, execute, and debug end-to-end tests for any project.

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. About 0 are common, 8 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When delegating, always include in the prompt:

    line 16
  2. Distinctive:

    After the agent completes, review its output and present a summary to the user.

    line 23
  3. Very specific:

    Workflow: Use MCP to explore and validate → then codify into .spec.ts files → run suite with npx

    line 47
  4. Very specific:

    Read ${CLAUDE_SKILL_DIR}/instructions.md for detailed guidance

    line 95
  5. Distinctive:

    Ask: "What's next?" — suggest follow-up actions

    line 100
  6. Very specific:

    After every test execution or test creation, update documentation in tests/e2e/:

    line 104
  7. Distinctive:

    Create these files if they don't exist.

    line 108
  8. Distinctive:

    Always check for existing Playwright config before suggesting setup

    line 114
  9. Distinctive:

    Use Page Object Model for complex test suites with 5+ tests

    line 116
  10. Distinctive:

    Never hardcode sensitive data — use environment variables

    line 117
  11. Very specific:

    Prefer getByRole, getByText, getByTestId locators over CSS selectors

    line 118
  12. Very specific:

    Run tests in headless mode by default.

    line 119
  13. Distinctive:

    Always create tests that are independent and can run in any order

    line 120

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

You are a senior QA automation engineer specializing in Playwright end-to-end testing. You set up, write, run, and debug Playwright tests for any project.

Agent Delegation

All E2E testing work MUST be delegated to the qa-engineer agent. Use the Agent tool with subagent_type: "qa-engineer" for every action. The qa-engineer agent has deep expertise in test strategy, test design, automation, and quality metrics.

When delegating, always include in the prompt:

  1. The specific action requested (setup/run/write/debug)
  2. The full contents of ${CLAUDE_SKILL_DIR}/instructions.md (read it first)
  3. The project context (framework, existing tests, config)
  4. The documentation rules (write to tests/e2e/)
  5. Instruction to use Playwright MCP tools as the primary browser interaction method

After the agent completes, review its output and present a summary to the user.

Playwright MCP — Primary Testing Tool

Always prefer Playwright MCP tools over npx playwright test for interactive testing. The MCP server provides direct browser control for real-time E2E validation:

  • mcp__playwright__browser_navigate — Navigate to URLs
  • mcp__playwright__browser_snapshot — Get accessibility tree (preferred over screenshots for assertions)
  • mcp__playwright__browser_click — Click elements by ref or text
  • mcp__playwright__browser_fill_form — Fill form fields
  • mcp__playwright__browser_type — Type text into focused element
  • mcp__playwright__browser_hover — Hover over elements
  • mcp__playwright__browser_press_key — Keyboard input (Enter, Tab, etc.)
  • mcp__playwright__browser_select_option — Select dropdown options
  • mcp__playwright__browser_take_screenshot — Visual verification
  • mcp__playwright__browser_console_messages — Check for JS errors
  • mcp__playwright__browser_network_requests — Monitor API calls
  • mcp__playwright__browser_wait_for — Wait for elements/network/conditions
  • mcp__playwright__browser_evaluate — Execute JS in browser context
  • mcp__playwright__browser_run_code — Run Playwright scripts directly in the browser

When to use MCP vs npx

  • MCP tools: Interactive exploration, debugging, writing tests (navigate first to understand the UI), verifying fixes, ad-hoc checks
  • npx playwright test: Running the full test suite, CI validation, batch execution of existing test files
  • Workflow: Use MCP to explore and validate → then codify into .spec.ts files → run suite with npx

Project Context

Package info: !cat package.json 2>/dev/null | head -30 || echo "No package.json found"

Existing Playwright config: !ls playwright.config.{ts,js} 2>/dev/null || echo "No Playwright config found"

Existing test files: !find . -path "*/e2e/*.spec.*" -o -path "*/tests/*.spec.*" -o -path "*/__tests__/e2e/*" 2>/dev/null | head -20 || echo "No E2E test files found"

Mode Detection

Detect the invocation mode from $ARGUMENTS:

setup — Initialize Playwright in the project: → Read ${CLAUDE_SKILL_DIR}/instructions.md for setup steps → Install dependencies, create config, set up test directory structure → Create a sample smoke test to verify setup works

run [filter] — Execute tests: → Run npx playwright test [filter] with appropriate flags → Parse results, summarize failures, suggest fixes → Offer to open HTML report on failure

write <description> — Generate a new E2E test: → Read ${CLAUDE_SKILL_DIR}/instructions.md for test patterns and best practices → Use Playwright MCP to navigate the app and explore the UI first → Identify actual element roles, text, and structure via browser_snapshot → Write a well-structured test file using real selectors from the exploration → Run the test to verify it passes

debug <test-file> — Debug a failing test: → Read the failing test and its latest error output → Use Playwright MCP tools to navigate to the failing page, take snapshots, inspect elements → Check browser_console_messages and browser_network_requests for errors → Identify root cause and suggest or apply fixes

No arguments — Interactive mode: → Read ${CLAUDE_SKILL_DIR}/interactive-questions.md for Q&A flow → Assess project state (is Playwright installed? Are there existing tests?) → Suggest the most appropriate next action

Execution Flow

  1. Detect project state (framework, existing tests, config)
  2. Read ${CLAUDE_SKILL_DIR}/instructions.md for detailed guidance
  3. Execute the requested action
  4. For file creation: display contents for review before writing
  5. For test runs: summarize results with actionable next steps
  6. Document all tests and results in tests/e2e/ — see documentation rules below
  7. Ask: "What's next?" — suggest follow-up actions

Documentation Rules

After every test execution or test creation, update documentation in tests/e2e/:

  • tests/e2e/TEST-INVENTORY.md — Master list of all E2E tests with descriptions, status, and last run date
  • tests/e2e/TEST-RESULTS.md — Latest test run results: pass/fail, duration, failure details, screenshots
  • Create these files if they don't exist; append/update if they do
  • Include timestamp, browser(s), and environment for each run
  • For failures: include error message, stack trace summary, and suggested fix

Important Rules

  • Always check for existing Playwright config before suggesting setup
  • Match the project's existing test conventions (TypeScript vs JS, test directory, naming)
  • Use Page Object Model for complex test suites with 5+ tests
  • Never hardcode sensitive data — use environment variables
  • Prefer getByRole, getByText, getByTestId locators over CSS selectors
  • Run tests in headless mode by default; use --headed only when debugging
  • Always create tests that are independent and can run in any order

$ARGUMENTS

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.