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-05-04
- Stars
- ★ 1
- 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 资源文件 84
- 参考文档.claude-plugin/plugin.json633 B
- 参考文档.mcp.json668 B
- 参考文档agents/migration-planner.md3.5 KB
- 参考文档agents/test-architect.md3.1 KB
- 参考文档agents/test-debugger.md3.1 KB
- 参考文档CLAUDE.md3.6 KB
- 脚本hooks/detect-playwright.sh770 B
- 参考文档hooks/hooks.json464 B
- 脚本hooks/validate-test.sh1.9 KB
- 参考文档integrations/browserstack-mcp/package.json400 B
- 脚本integrations/browserstack-mcp/src/client.ts2.8 KB
- 脚本integrations/browserstack-mcp/src/index.ts6.1 KB
- 脚本integrations/browserstack-mcp/src/types.ts1.3 KB
- 参考文档integrations/browserstack-mcp/tsconfig.json284 B
- 参考文档integrations/testrail-mcp/package.json392 B
- 脚本integrations/testrail-mcp/src/client.ts3.6 KB
- 脚本integrations/testrail-mcp/src/index.ts9.9 KB
- 脚本integrations/testrail-mcp/src/types.ts2.0 KB
- 参考文档integrations/testrail-mcp/tsconfig.json284 B
- 许可证LICENSE1.0 KB
- 参考文档README.md4.4 KB
- 参考文档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
- 参考文档settings.json102 B
- 参考文档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
vercel-react-view-transitions
Guide for implementing smooth, native-feeling animations using React's View Transition API (`<ViewTransition>` component, `addTransitionType`, and CSS view transition pseudo-elements). Use this skill whenever the user wants to add page transitions, animate route changes, create shared element animations, animate enter/exit of components, animate list reorder, implement directional (forward/back) navigation animations, or integrate view transitions in Next.js. Also use when the user mentions view transitions, `startViewTransition`, `ViewTransition`, transition types, or asks about animating between UI states in React without third-party animation libraries.
vercel-react-native-skills
React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.
vercel-react-best-practices
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
vercel-composition-patterns
React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes.
supabase-postgres-best-practices
Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.
portable-text-serialization
Render and serialize Portable Text to React, Svelte, Vue, Astro, HTML, Markdown, and plain text. Use when implementing Portable Text rendering in any frontend framework, building custom serializers for non-standard block types, converting Portable Text to HTML strings server-side, converting Portable Text to Markdown, extracting plain text from Portable Text, or troubleshooting rendering issues with marks, blocks, lists, or custom types.