musingfox/cc-plugins/playwright
Claude Code and agent skill by musingfox/cc-plugins
- community
Checking that the SKILL.md file is still in the repository.
Use to write or set up Playwright / @playwright/test E2E tests — test specs, locators, assertions, fixtures, config. Focuses on structuring tests with high-precision locator strategies. Not for live page exploration or debugging (use agent-browser or web-test).
Install
npx vskill@latest install musingfox/cc-plugins/playwrightSKILL.md
The same SKILL.md was published earlier as musingfox/cc-plugins/playwright.
Playwright Test Writing
Overview
Write browser tests using @playwright/test, the official Playwright test runner. It provides auto-waiting, test isolation, built-in web assertions with auto-retry, and parallel execution out of the box.
For console, network, or page-state diagnostics outside a test, use the web-test skill.
Project Setup
npm init playwright@latest asks interactive questions, so leave it for the user to run in their own terminal.
Essential playwright.config.ts (for full multi-browser, reporter, and webServer config, see references/api-patterns.md):
Test File Structure
Tests follow the pattern: tests/<feature>.spec.ts
Always use the AAA pattern: Arrange (locate elements), Act (interact), Assert (verify outcome).
Locator Strategy (Precision Order)
Apply locators in strict priority order — always prefer the highest-precision option available:
| Priority | Locator | When to Use | Stability | |
|---|---|---|---|---|
| 1 | getByTestId('id') | Element has data-testid attribute | Highest — immune to text/structure changes | |
| 2 | getByRole('role', { name }) | Element has clear ARIA role and accessible name | Very high — maps from accessibility tree | |
| 3 | getByLabel('label') | Form inputs with associated <label> | High — tied to label text | |
| 4 | getByPlaceholder('text') | Input with placeholder text | Medium-high — placeholder may change | |
| 5 | getByText('text', { exact: true }) | Visible text content | Medium — text may change | |
| 6 | page.locator('[data-attr="val"]') | Custom data attributes | Medium — depends on attribute stability | |
| 7 | page.locator('css') | Last resort — specific CSS selector | Low — fragile to DOM restructuring |
Rules:
- Never use index-based locators (
nth(0)) unless testing a list where index is semantically meaningful. - Never use XPath unless no other option exists.
- Always pass
{ exact: true }togetByText()to prevent partial matches. - When multiple elements share the same locator, narrow with
.filter({ hasText: 'unique' })or scope to a parent.
For locator disambiguation patterns (filter, chaining, scoping), see references/api-patterns.md.
Web Assertions (Auto-retry)
Playwright's expect API auto-retries assertions until timeout (default 5s):
Critical: Always use await expect(locator).toHaveText() — not expect(await locator.textContent()).toBe(). Web assertions auto-retry; manual extraction does not.
Page Interactions
Test Lifecycle
Custom Fixtures
Extend the test object with reusable setup logic:
Running Tests
After writing a spec, run it with npx playwright test <new-file>. On a failure, read the error, fix the spec, and rerun. The spec is done when that run passes.
Additional Resources
Reference Files
For detailed locator mapping, assertion catalog, and advanced configuration:
- `references/api-patterns.md` — Locator disambiguation patterns, assertion quick reference, advanced fixtures and configuration
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingagent-browser/skills/playwright/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/musingfox/cc-plugins/playwright)