Playwright Testing Standards
<metadata>- Load if: Running Playwright tests, analyzing test results
- Prerequisites:
@smith-tests/SKILL.md
CRITICAL: Proactive Failure Monitoring (Primacy Zone)
<required>- MUST check test runner exit code after every run
- MUST inspect failure artifacts before reporting
- MUST read actual error messages (not just "tests failed")
- MUST classify root cause before reporting to user
- MUST proactively detect and report -- do NOT wait for user
- NEVER report "tests failed" without reading error messages
- NEVER assume tests passed without verifying exit code
- NEVER skip failure artifact inspection after a run
Failure Analysis Protocol
<required>After every Playwright test run:
- Check exit code -- non-zero means failures exist
- Inspect failure artifacts -- Playwright creates per-test subdirectories containing page snapshots and screenshots
- Read page snapshots for DOM state at failure time
- Read screenshots for visual confirmation
- Open HTML report for assertion error details
- Classify root cause (see categories below)
- Report with: failed tests, classification, evidence
Root Cause Categories
<context>- Selector mismatch: test expects elements or classes not present in current component implementation
- Timing/flakiness: polling timeout too short, race conditions between UI and async operations
- Backend/dependency: API or SSE response format changed, upstream service unavailable or returning errors
- Environment: services not running, auth expired, port conflicts, missing configuration
- Test data/state: database not seeded, stale fixtures, previous test side effects
Playwright MCP Tools
<context>When Playwright MCP plugin (mcp__plugin_playwright_playwright)
is available, use it to inspect HTML reports programmatically:
Tool discovery: Use ToolSearch with +playwright to load
tools before first use.
Key tools for report inspection:
browser_navigate-- open report URLbrowser_snapshot-- read page as accessibility tree (preferred over screenshot for extracting text)browser_click-- expand failed test detailsbrowser_take_screenshot-- visual capture if neededbrowser_run_code-- run JS for complex extraction
Report inspection workflow:
- Start report server (project AGENTS.md has the command)
browser_navigateto report URLbrowser_snapshotto read test result listbrowser_clickon failed tests to expand error detailsbrowser_snapshotagain to read assertion messages
@smith-tests/SKILL.md- Testing standards, TDD workflow@smith-validation/SKILL.md- Root cause analysis@smith-nuxt/SKILL.md- Nuxt testing patterns
ACTION (Recency Zone)
<required>Post-test checklist:
- Exit code non-zero? Read failure artifacts
- Read page snapshots + screenshots
- Classify root cause
- Report proactively with evidence