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-08-30
- 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 资源文件 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:pw-init |
Set up Playwright — detects framework, generates config, CI, first test |
/pw:generate <spec> |
Generate tests from user story, URL, or component |
/pw: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:pw-init → scaffolds config, CI pipeline, and a first smoke test
2. /pw:generate → generates tests from your spec or URL
3. /pw: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: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: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 (optional — not auto-registered; see Integration Setup)
- 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
Not auto-registered (issue #978). The TestRail and BrowserStack MCP servers are no longer declared in the plugin's
.mcp.json(they failed to connect for every user — no bundlednode_modules). Exporting the env vars below is not enough:/pw:testrail//pw:browserstackfail with "tool not found" until you enable the server manually (cd integrations/<name>-mcp && npm install, then register it in your own user/project MCP config). SeeCLAUDE.md→ Integrations.
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
syllabus
Generates a curated supplementary reading list from any course syllabus using Consensus academic search. Grill-me intake (syllabus input format + course audience + year range) plus a grouping forcing-options checkpoint before any search runs — so the reading list matches the course's level and recency need. Parses the syllabus to extract topics and learning outcomes, searches Consensus for recent peer-reviewed papers per topic, and produces a professionally formatted .docx with clickable Consensus links, plain-language summaries calibrated to audience level, and Bloom-higher-order discussion questions tied to course learning goals. Use when the user uploads a syllabus, course outline, or curriculum document and wants supplementary readings (e.g., 'create a reading list from this syllabus', 'find recent papers for my course') — even casual mentions with a syllabus attached should trigger this skill.
research
Default entry point for any research request — a hybrid router that classifies the question deterministically and either delegates to a specialist research skill (pulse for trends/sentiment, grants for NIH funding, litreview for academic literature, syllabus for course reading, patent for prior-art + IP landscape, dossier for entity research, deepread for evidence-first reading of supplied documents) or runs its own plan-decompose-multi-source-search-synthesize-cite fallback workflow when no specialist matches. Always surfaces the routing decision so users can override. Use when the user makes any research request that doesn't obviously match a more-specific specialist skill (e.g., "research [topic]", "look into [topic]", "what do we know about [topic]", "investigate [topic]", "find me information on [topic]", "do some research on [topic]", "I need to understand [topic]"). Output is a markdown briefing (default) or .docx document (on request) with full citations and an audit log.
pulse
Multi-source recency research skill that takes the pulse of any topic across Reddit, Hacker News, the open web, and optionally X/Twitter within a configurable recent window (default 30 days). Forcing intake clarifies topic specificity, angle (trend/sentiment/problems/opportunities/comparison), time window, and platform scope before searching. Returns a synthesized briefing with citations, engagement metrics, and cross-platform pattern analysis. Use when the user requests multi-source recency intelligence on a topic (e.g., 'pulse on [topic]', 'what's happening with [topic]', 'what are people saying about [topic]', 'current conversation about [topic]', 'take the pulse of [topic]', 'trending: [topic]', 'find me info on [topic]'), and for competitor research, trend discovery, tool comparisons, and audience sentiment analysis.
patent
Patent prior-art and landscape intelligence skill — not generic patent help. Commits to one of five sub-use-cases via forcing intake (novelty search / freedom-to-operate / competitive landscape / acquisition diligence / litigation prior-art) before any search runs. Searches Google Patents, Espacenet, USPTO, and optionally Lens.org for citation-graph signals. Output is an editable Word document (.docx) with verdict, ranked closest art (claim-text extracted), CPC-class-aware landscape, family-resolved hits, geographic coverage, FTO flags where applicable, strategy recommendations, and full audit log. Use when the user asks for patent searching or analysis (e.g., 'prior art search for [invention]', 'freedom to operate analysis for [product]'). Produces search signal, not legal advice — always recommends consulting a patent attorney before filing or licensing decisions. Trademark, copyright, and trade-secret questions are out of scope.
notebooklm
Browser automation skill for controlling Google's NotebookLM. Use when the user wants anything done in NotebookLM (e.g., 'open NotebookLM', 'check my [name] notebook', 'ask my notebook about X', 'add [source] to NotebookLM', 'generate a Video Overview from my notebook', 'use NotebookLM Studio'). Handles reading and querying notebooks, adding sources (URLs, text, files, YouTube links, synthesized content), generating Studio outputs (Audio/Video Overviews, Mind Maps, Reports incl. Briefing Doc/Study Guide/FAQ, Flashcards, Quiz, slide decks, infographics — discover the exact set from the live Studio panel; the UI evolves fast), and creating new notebooks. Requires browser automation environment — fails gracefully when unavailable.
litreview
Academic literature orientation skill that searches papers via free keyless APIs (PubMed E-utilities + OpenAlex) by default — with the Consensus MCP as an optional enhancement lane when connected — builds a strategic search plan using PICO (default) or SPIDER / Decomposition / hybrid as fallbacks, and synthesizes findings into a formatted Word (.docx) research guide. Grill-me intake (research question specificity + framework hint + tentative depth) before the recon search; a second forcing checkpoint after Phase 2 confirms framework + sub-areas + depth before searches consume budget. Configurable depth (5/10/20 queries) controls coverage vs. speed. Output is a 'launching pad' — an orientation guide that lets a researcher dive in confidently, not a finished review. Use when the user starts literature-oriented research (e.g., 'litreview on [topic]', 'literature review on [topic]', 'I'm starting a literature review on X', 'I'm writing a paper on X', 'help me research X', 'I'm doing research on X', 'can you help me research X'). Do NOT use for single one-off paper searches wanting a quick list — that's a plain PubMed/OpenAlex (or Consensus) query.