Agent skill
smith-playwright
Playwright testing patterns including proactive failure monitoring, artifact inspection, and root cause classification. Use when running Playwright tests or analyzing Playwright test results.
Install this agent skill to your Project
npx add-skill https://github.com/tianjianjiang/smith/tree/main/smith-playwright
SKILL.md
Playwright Testing Standards
- Load if: Running Playwright tests, analyzing test results
- Prerequisites:
@smith-tests/SKILL.md
CRITICAL: Proactive Failure Monitoring (Primacy Zone)
- 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
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
- 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
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)
Post-test checklist:
- Exit code non-zero? Read failure artifacts
- Read page snapshots + screenshots
- Classify root cause
- Report proactively with evidence
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
smith-style
File naming, path standards, and conventional commits. Use when naming files, creating branches, writing commit messages, or setting up new projects. Covers underscore vs hyphen conventions, commit format, and branch naming patterns.
smith-stacks
Stacked pull request workflows for large features. Use when creating stacked PRs, managing dependent PRs, or rebasing after parent merges. Covers stack creation, merge order, and squash merge handling.
smith-python
Python development with uv, pytest, ruff, and type hints. Use when writing Python code, running tests, managing Python packages, or working with virtual environments. Covers import organization, type hints, pytest patterns, and environment variables.
smith-principles
Fundamental coding principles (DRY, KISS, YAGNI, SOLID, HHH). Use when starting any development task, evaluating implementation approaches, or reviewing code quality. Always active as foundation for all development decisions.
smith-nuxt
Nuxt 3 development patterns including auto-import stubbing for tests, environment variable conventions, and middleware testing. Use when working with Nuxt projects, testing Nuxt components/middleware, or configuring Nuxt environment variables.
smith-plan
Plan tracking protocol (portable). Progress tracking with checkboxes, iteration workflow, completion/blocker signals. Use when executing multi-step plans, tracking task progress, or working from plan files. IMPORTANT - Always update the plan file after completing tasks.
Didn't find tool you were looking for?