playwright-pro
Production-grade Playwright testing toolkit. Use when the user mentions Playwright tests, end-to-end testing, browser automation, fixing flaky tests, test migration, CI/CD testing, or test suites. Generate tests, fix flaky failures, migrate from Cypress/Selenium, sync with TestRail, run on BrowserStack. 55 templates, 3 agents, smart reporting.
- License 许可
- MIT
- 最近更新
- 2026-11-04
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- playwright-pro
- description
- Production-grade Playwright testing toolkit. Use when the user mentions Playwright tests, end-to-end testing, browser automation, fixing flaky tests, test migration, CI/CD testing, or test suites. Generate tests, fix flaky failures, migrate from Cypress/Selenium, sync with TestRail, run on BrowserStack. 55 templates, 3 agents, smart reporting.
02 资源文件 62
- 参考文档reference/assertions.md2.2 KB
- 参考文档reference/common-pitfalls.md3.1 KB
- 参考文档reference/fixtures.md3.1 KB
- 参考文档reference/flaky-tests.md1.5 KB
- 参考文档reference/golden-rules.md906 B
- 参考文档reference/locators.md2.1 KB
- 参考文档templates/accessibility/color-contrast.md5.5 KB
- 参考文档templates/accessibility/keyboard-navigation.md5.2 KB
- 参考文档templates/accessibility/screen-reader.md5.6 KB
- 参考文档templates/api/auth-headers.md4.7 KB
- 参考文档templates/api/error-responses.md5.4 KB
- 参考文档templates/api/graphql.md5.9 KB
- 参考文档templates/api/rate-limiting.md5.5 KB
- 参考文档templates/api/rest-crud.md5.0 KB
- 参考文档templates/auth/login.md4.6 KB
- 参考文档templates/auth/logout.md4.1 KB
- 参考文档templates/auth/mfa.md5.1 KB
- 参考文档templates/auth/password-reset.md5.7 KB
- 参考文档templates/auth/rbac.md4.7 KB
- 参考文档templates/auth/remember-me.md5.6 KB
- 参考文档templates/auth/session-timeout.md4.3 KB
- 参考文档templates/auth/sso.md4.5 KB
- 参考文档templates/checkout/add-to-cart.md4.1 KB
- 参考文档templates/checkout/apply-coupon.md5.0 KB
- 参考文档templates/checkout/order-confirm.md4.1 KB
- 参考文档templates/checkout/order-history.md4.6 KB
- 参考文档templates/checkout/payment.md5.4 KB
- 参考文档templates/checkout/update-quantity.md4.8 KB
- 参考文档templates/crud/bulk-operations.md5.2 KB
- 参考文档templates/crud/create.md4.7 KB
- 参考文档templates/crud/delete.md5.1 KB
- 参考文档templates/crud/read.md4.6 KB
- 参考文档templates/crud/soft-delete.md4.7 KB
- 参考文档templates/crud/update.md5.6 KB
- 参考文档templates/dashboard/chart-rendering.md4.9 KB
- 参考文档templates/dashboard/data-loading.md4.9 KB
- 参考文档templates/dashboard/date-range-filter.md5.5 KB
- 参考文档templates/dashboard/export.md5.7 KB
- 参考文档templates/dashboard/realtime-updates.md5.1 KB
- 参考文档templates/forms/autosave.md5.3 KB
- 参考文档templates/forms/conditional-fields.md5.6 KB
- 参考文档templates/forms/file-upload.md5.2 KB
- 参考文档templates/forms/multi-step.md5.5 KB
- 参考文档templates/forms/single-step.md4.8 KB
- 参考文档templates/forms/validation.md5.8 KB
- 参考文档templates/notifications/in-app.md4.8 KB
- 参考文档templates/notifications/notification-center.md4.7 KB
- 参考文档templates/notifications/toast-messages.md5.2 KB
- 参考文档templates/onboarding/email-verification.md5.0 KB
- 参考文档templates/onboarding/first-time-setup.md5.3 KB
- 参考文档templates/onboarding/registration.md5.7 KB
- 参考文档templates/onboarding/welcome-tour.md4.8 KB
- 参考文档templates/README.md4.8 KB
- 参考文档templates/search/basic-search.md4.4 KB
- 参考文档templates/search/empty-state.md4.5 KB
- 参考文档templates/search/filters.md5.1 KB
- 参考文档templates/search/pagination.md4.4 KB
- 参考文档templates/search/sorting.md5.1 KB
- 参考文档templates/settings/account-delete.md5.7 KB
- 参考文档templates/settings/notification-prefs.md5.2 KB
- 参考文档templates/settings/password-change.md6.9 KB
- 参考文档templates/settings/profile-update.md5.2 KB
03 SKILL.md 正文
Playwright Pro
Production-grade Playwright testing toolkit for AI coding agents.
Available Commands
When installed as a Claude Code plugin, these are available as /pw: commands:
| Command | What it does |
|---|---|
/pw:init |
Set up Playwright — detects framework, generates config, CI, first test |
/pw:generate <spec> |
Generate tests from user story, URL, or component |
/pw:review |
Review tests for anti-patterns and coverage gaps |
/pw:fix <test> |
Diagnose and fix failing or flaky tests |
/pw:migrate |
Migrate from Cypress or Selenium to Playwright |
/pw:coverage |
Analyze what's tested vs. what's missing |
/pw:testrail |
Sync with TestRail — read cases, push results |
/pw:browserstack |
Run on BrowserStack, pull cross-browser reports |
/pw:report |
Generate test report in your preferred format |
Quick Start Workflow
The recommended sequence for most projects:
1. /pw:init → scaffolds config, CI pipeline, and a first smoke test
2. /pw:generate → generates tests from your spec or URL
3. /pw:review → validates quality and flags anti-patterns ← always run after generate
4. /pw:fix <test> → diagnoses and repairs any failing/flaky tests ← run when CI turns red
Validation checkpoints:
- After
/pw:generate— always run/pw:reviewbefore committing; it catches locator anti-patterns and missing assertions automatically. - After
/pw:fix— re-run the full suite locally (npx playwright test) to confirm the fix doesn't introduce regressions. - After
/pw:migrate— run/pw:coverageto confirm parity with the old suite before decommissioning Cypress/Selenium tests.
Example: Generate → Review → Fix
# 1. Generate tests from a user story
/pw:generate "As a user I can log in with email and password"
# Generated: tests/auth/login.spec.ts
# → Playwright Pro creates the file using the auth template.
# 2. Review the generated tests
/pw:review tests/auth/login.spec.ts
# → Flags: one test used page.locator('input[type=password]') — suggests getByLabel('Password')
# → Fix applied automatically.
# 3. Run locally to confirm
npx playwright test tests/auth/login.spec.ts --headed
# 4. If a test is flaky in CI, diagnose it
/pw:fix tests/auth/login.spec.ts
# → Identifies missing web-first assertion; replaces waitForTimeout(2000) with expect(locator).toBeVisible()
Golden Rules
getByRole()over CSS/XPath — resilient to markup changes- Never
page.waitForTimeout()— use web-first assertions expect(locator)auto-retries;expect(await locator.textContent())does not- Isolate every test — no shared state between tests
baseURLin config — zero hardcoded URLs- Retries:
2in CI,0locally - Traces:
'on-first-retry'— rich debugging without slowdown - Fixtures over globals —
test.extend()for shared state - One behavior per test — multiple related assertions are fine
- Mock external services only — never mock your own app
Locator Priority
1. getByRole() — buttons, links, headings, form elements
2. getByLabel() — form fields with labels
3. getByText() — non-interactive text
4. getByPlaceholder() — inputs with placeholder
5. getByTestId() — when no semantic option exists
6. page.locator() — CSS/XPath as last resort
What's Included
- 9 skills with detailed step-by-step instructions
- 3 specialized agents: test-architect, test-debugger, migration-planner
- 55 test templates: auth, CRUD, checkout, search, forms, dashboard, settings, onboarding, notifications, API, accessibility
- 2 MCP servers (TypeScript): TestRail and BrowserStack integrations
- Smart hooks: auto-validate test quality, auto-detect Playwright projects
- 6 reference docs: golden rules, locators, assertions, fixtures, pitfalls, flaky tests
- Migration guides: Cypress and Selenium mapping tables
Integration Setup
TestRail (Optional)
export TESTRAIL_URL="https://your-instance.testrail.io"
export TESTRAIL_USER="your@email.com"
export TESTRAIL_API_KEY="your-api-key"
BrowserStack (Optional)
export BROWSERSTACK_USERNAME="your-username"
export BROWSERSTACK_ACCESS_KEY="your-access-key"
Quick Reference
See reference/ directory for:
golden-rules.md— The 10 non-negotiable ruleslocators.md— Complete locator priority with cheat sheetassertions.md— Web-first assertions referencefixtures.md— Custom fixtures and storageState patternscommon-pitfalls.md— Top 10 mistakes and fixesflaky-tests.md— Diagnosis commands and quick fixes
See templates/README.md for the full template index.
04 同仓库更多 Skills
webapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
youtube-downloader
Download YouTube videos with customizable quality and format options. Use this skill when the user asks to download, save, or grab YouTube videos. Supports various quality settings (best, 1080p, 720p, 480p, 360p), multiple formats (mp4, webm, mkv), and audio-only downloads as MP3.
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.
template-skill
Replace with description of the skill and when Claude should use it.
tailored-resume-generator
Analyzes job descriptions and generates tailored resumes that highlight relevant experience, skills, and achievements to maximize interview chances
slack-gif-creator
Toolkit for creating animated GIFs optimized for Slack, with validators for size constraints and composable animation primitives. This skill applies when users request animated GIFs or emoji animations for Slack from descriptions like "make me a GIF for Slack of X doing Y".