/quality-gates:playwright-testsfrom quality-gates
Writes, generates, and fixes Playwright end-to-end tests covering user journeys in a real browser. Guides locator selection, auth state, test data isolation, and flaky test resolution.
Ships in quality-gates. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
An end-to-end test follows one user journey through the real app and asserts what the user would see. Every wait is a wait for an outcome, never for time.
playwright.config: baseURL, webServer, testDir, projects, any setup project and storageState.npx playwright codegen <url>. Do not guess selectors from source. Browser tool: if command -v obscura finds it, use it first (obscura --allow-private-network fetch <url> --dump html); otherwise use Chrome. The specs themselves still run on the project's own Playwright browsers. For a faster local loop you can also run them on obscura: start obscura --allow-private-network serve --port 9222, then override the browser fixture with chromium.connectOverCDP('http://127.0.0.1:9222'). This does not replace a Chromium run. Hover assertions such as toHaveCSS after hover() fail on obscura, and its rendering can differ, so the --project=chromium run below is still the one that counts.The journeys whose failure costs money or trust: sign in, the core create-edit-delete flow, checkout, permissions. One journey per test. Edge cases of logic belong in unit tests.
getByRole('button', { name: 'Save' })getByLabel, getByPlaceholder, getByTextgetByTestId, when nothing user-visible is stableScope by chaining or filter({ hasText }). No CSS or XPath chains, no nth() on unscoped lists. A control that cannot be found by role is often an accessibility bug: report it.
| Do | Not |
|---|---|
await expect(locator).toBeVisible() (retries) | expect(await locator.isVisible()).toBe(true) |
await expect(page).toHaveURL(...) after navigation | waitForTimeout, networkidle |
Start page.waitForResponse(...) before the click, await it after | Sleeping until the request is probably done |
await expect(async () => {...}).toPass() for real polling | Raising the timeout |
storageState, reuse it. No UI login in each test.request fixture) with a unique id, and delete it after. Tests run in parallel and in any order.page.route for third parties and for forcing error states. Do not mock your own backend in a journey test.user can reset a password.test.step for the stages of a long journey.Turn on trace: 'on-first-retry', open the trace, and find what the test did not wait for. Adding retries, timeouts or sleeps hides the bug; it is either a missing wait in the test or a race in the app.
npx playwright test <path> --project=chromiumnpx playwright test <path> --repeat-each=5 to show it is stable.Journey: <one line each>
Run: <command> -> <result>
Repeat x5: <result>
Data: <how created and cleaned up>
Not covered: <browsers, journeys or states left out>
Key decisions in this skill: the test boundary (what to mock vs hit for real), the auth or seeding strategy, and adding or changing a fixture or config shared by many specs.
Before acting on one, get a second opinion: call the Agent tool with model: "opus" (subagent_type Plan, read-only). Give it the decision, each option in one line, the evidence (file:line, measurements, the diff) and the constraints. Ask for a pick, the main risk of that pick, and what would change its mind. Do not send secrets or .env contents.
Advisor: <decision> -> <pick> (<agreed | overruled because ...>).Spend the strong models on judgment and the cheap ones on volume. When this skill spawns subagents with the Agent tool, set model by role:
| Role | Model | Use for |
|---|---|---|
| Think | fable (Fable 5.2), or opus when limits are tight | Plan, decompose, pick an approach. One call, read-only (subagent_type: "Plan"). |
| Execute | sonnet (Sonnet 5.5) | Write and edit code, run checks, produce the deliverable. |
| Review | opus (Opus 5.5) | Check the finished work before reporting: correctness, security, money, data loss. |
| Swarm | haiku (Haiku 5.5) | Many small parallel jobs: search, read, extract, classify, per-file scans. |
mcp__ccd_session_mgmt__get_usage (load it with ToolSearch if deferred). Use fable only when every window has room: 5-hour limit under 70% used, "Weekly · all models" under 80%, and "Weekly · Fable" (if listed) under 80%. Otherwise use opus. If the tool is missing, or its status is unavailable or not_applicable (API key, Bedrock, Vertex), use opus. Say the pick in one line: Think: <model> (5h <n>%, weekly <n>%, Fable <n>%).Lessons from earlier runs live in two files: ~/.claude/skill-lessons/playwright-tests.md (any repo) and .claude/skill-lessons/playwright-tests.md at the repo root (this repo only).
- <YYYY-MM-DD>: <do or avoid X> because <Y>. (seen: 1). When a line already says the same thing, raise its seen count and date instead of adding one. Facts about this repo go in the repo file, everything else in the user file. Keep each file under 30 lines by merging or dropping stale lessons.seen: 3: if the ashish-claude-skills source repo is open, propose the edit to plugins/quality-gates/skills/playwright-tests/SKILL.md as a diff and wait for a yes, then delete the lesson once it lands; otherwise say Lesson ready to promote: <line> in the report.Learned: <the line written | nothing>.What SKILL.md sets; muted values are Claude Code's defaults
10 skills in this plugin
/claude-md-syncUse after changing business logic, domain rules, data models, APIs, architecture, commands, config or dependencies, before calling the work done, to keep CLAUDE.md true to the code. Also when the user says "update CLAUDE.md", "sync the docs" or "is CLAUDE.md still right"./design-auditUse when a UI component, page or stylesheet has just been built or changed and its visual quality needs checking, when the user asks whether a screen looks right, consistent or polished, or before shipping front-end work./login-and-accessUse when writing, changing or reviewing sign-in, sign-up, logout, password reset, magic links, OAuth or SSO, MFA, sessions, cookies, JWTs, refresh tokens, roles, permissions, admin areas, multi-tenant data or any route that must know who the caller is and what they may see.npx claudepluginhub ashishyd/ashish-claude-skills --plugin quality-gatesOther plugins' skills for the same job