/frontend-experience:playwright-generate-testfrom frontend-experience
Generates Playwright TypeScript tests from user scenarios by using Playwright MCP to explore browser interactions, then writing, running, and iterating on the test until it passes.
Ships in frontend-experience. 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.
Generate a Playwright TypeScript test from a user scenario by first exercising the scenario with Playwright MCP, then writing the spec into the tests directory, executing it, and iterating until it passes.
@playwright/test is already present.tests directory. If the repository uses a nested Playwright convention such as tests/e2e, follow the existing convention inside tests.@playwright/test.tests directory with a descriptive .spec.ts name.npx playwright test <test-file> when the project has Playwright installed.| Scenario part | Capture | Test representation |
|---|---|---|
| Entry point | URL, route, fixture, auth state, viewport if relevant | await page.goto('<url>') or existing test fixture setup |
| User action | Clicks, fills, selections, keyboard input, uploads, navigation | page.getByRole, getByLabel, getByText, locator, selectOption, press |
| Observable result | URL change, visible message, table row, enabled control, network-driven UI state | await expect(...).toBeVisible(), toHaveURL, toContainText, toBeEnabled |
| Required wait | UI transition, navigation, async rendering | Prefer web-first assertions; avoid arbitrary sleeps |
| Test data | Unique names, emails, IDs, clean-up needs | Generate deterministic or unique data inside the test without hardcoded shared secrets |
| Preference | Use | Avoid |
|---|---|---|
| Accessible role | page.getByRole('button', { name: 'Save' }) | CSS class chains tied to styling |
| Form labels | page.getByLabel('Email') | Index-based selectors like locator('input').nth(2) |
| Stable test ids | page.getByTestId('submit-order') when the project uses them | Adding test ids without user approval unless already conventional |
| Visible text | page.getByText('Order submitted') for user-facing outcomes | Text that is dynamic, localized, or incidental |
| Structural locator | Scoped locator() only when accessible selectors are unavailable | XPath copied from browser devtools |
@playwright/test: import { test, expect } from '@playwright/test';.test.describe only when grouping multiple related tests in the same file.page.waitForTimeout.| Defect | Why it fails | Correction |
|---|---|---|
| Code before exploration | The test encodes assumptions and misses actual labels, routing, or timing | Complete all Playwright MCP steps before emitting code |
| Brittle selector | Styling or DOM order changes break the test without behavior changing | Use role, label, text, or test id selectors |
| Missing assertion | The test only clicks through the flow and can pass while the feature is broken | Assert visible outcome, URL, or persisted UI state |
| Arbitrary sleep | Slow or fast environments make waitForTimeout flaky | Use await expect(locator).to... |
| Unscoped data | Shared fixed values collide across runs | Generate unique data or clean up through existing helpers |
| Symptom | Likely cause | Resolution |
|---|---|---|
| Test cannot find a locator | The selected locator was not stable or the element appears later | Re-open the page with Playwright MCP, inspect accessible names, and replace with a web-first locator plus assertion |
| Test passes locally but fails in CI | Timing, viewport, auth state, or test data differs | Remove sleeps, assert readiness, use existing storage state or fixtures, and avoid shared data |
| Navigation assertion times out | The action does not navigate or the URL pattern is too strict | Assert the actual post-action UI state, or use a looser toHaveURL pattern backed by exploration evidence |
| Browser is not installed | Playwright dependency exists but browsers are missing | Run the project's documented install command, commonly npx playwright install, only when dependency setup is expected |
## Playwright test generation result
**Status:** passed | blocked
**Scenario:** <one-sentence scenario summary>
**Test file:** `tests/<name>.spec.ts`
### Exploration evidence
| Step | Interaction | Selector or URL | Observed outcome |
| --- | --- | --- | --- |
| 1 | <action> | `<selector-or-url>` | <visible result> |
### Generated test
- Framework: `@playwright/test`
- Command: `<test command>`
- Result: pass | fail
### Remaining work
- <none, or blocker with evidence>
@playwright/test.tests directory.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
21 skills in this plugin
/anti-ui-slopPrevent generic web and iOS interfaces by extracting product-specific design decisions from repository evidence and UIZZE's public catalogue of 800,000+ real web and iOS screens. Use this skill when building, refactoring, or reviewing UI, when asked to browse https://uizze.com before choosing a layout, or when the user wants a hard finish gate against interchangeable dashboard cards, filler metrics, vague headings, and generic calls to action./frontend-accessibilityDefine and verify WCAG 2.2 AA, semantic, keyboard, focus, zoom, contrast, motion, media, data visualization, form, SPA, and native accessibility behavior. Use this skill when frontend design, implementation, review, testing, or release evidence involves accessibility./frontend-backend-integrationValidate frontend behavior across REST, OpenAPI, GraphQL, WebSocket, SSE, AsyncAPI, authentication, uploads, mocks, contracts, ephemeral services, and backend failures. Use this skill when frontend work consumes remote data, services, schemas, generated clients, or realtime events.npx claudepluginhub gbb-acelerators/awesome-harness-primitives --plugin frontend-experienceOther plugins' skills for the same job