Testing playwright
Skill Syo-M/fable-frontend-skills/.claude/skills/testing-playwright
Playwright E2E conventions — locators, web-first assertions, isolation, network stubbing, flake prevention. Use when writing or fixing E2E tests or playwright.config. 日本語の依頼例:「E2Eテスト書いて」「Playwright」「ブラウザテスト」「ユーザー操作の通しテスト」「テストが不安定/flaky」。From its SKILL.md
npx -y skills add Syo-M/fable-frontend-skills --skill testing-playwrightAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.4 KB, 734 tokens by cl100k_base, as published. Nobody here has run it
Playwright
E2E tests cover critical user journeys end-to-end (signup, checkout, the money paths) — not every permutation. Component-level behavior belongs in Storybook/Vitest.
Locators — user-facing only
- Priority (same list as
testing-vitest):getByRole(…, { name })>getByLabel>getByText>getByTestId(last resort). Reaching forgetByPlaceholderis a smell — the input probably lacks a label (seea11y); fix the markup instead. - Never CSS/XPath selectors tied to DOM structure or generated class names (
.css-x91kb) — they encode implementation, not behavior. - Scope with
locator.filter()/ chaining instead ofnth()indexes when possible.
Web-first assertions — the anti-flake core
await expect(locator).toBeVisible() / toHaveText() / toHaveCount()— these auto-retry until timeout. Use them for ALL state checks.- Banned:
page.waitForTimeout(),expect(await locator.isVisible())(no retry), manual polling loops. A hard wait is always a hidden race. - Wait for meaning, not mechanics: assert the UI state you need next, rather than
waitForLoadState('networkidle').
Isolation & auth
- Every test independent: own data, no ordering, parallel-safe. A test must pass alone via
--repeat-each=2and with the full suite sharded. - Auth once per worker via a setup project +
storageState, not a UI login in every test. Test the login flow itself in exactly one spec. storageStatefiles contain live session tokens: keep them inplaywright/.auth/and gitignore that directory; authenticate only dedicated, ephemeral test accounts — never real users or production credentials.- Create test data via API/seed scripts in fixtures, not by clicking through the UI; clean up in the fixture teardown.
Fixtures over Page Objects
- Encode app-specific setup as custom fixtures (
test.extend) — authenticated page, seeded user, feature flags. - Keep page helpers lightweight: functions/classes wrapping actions (
checkout.fillShipping(data)), not assertion museums. Assertions live in tests.
Network
- True E2E (against real backend) for the few critical paths;
page.route()stubbing for hard-to-trigger states (server errors, empty lists, slow responses). - Never stub the thing the test exists to verify.
Config
webServerblock to build+serve the app — tests own their server lifecycle, locally and in CI.- CI:
retries: 2,trace: 'on-first-retry',forbidOnly: true, sharding for speed. Local: 0 retries so flake is loud. - A retried-pass is a flake report, not a success — fix the cause (usually a missing web-first assertion before an action).
toHaveScreenshotassertions follow thevisual-regressionskill (own project, fixture data, determinism rules) — they don't belong in functional E2E specs.- Cover the browsers users use (chromium minimum; add webkit/firefox per project requirements) — but don't 3x the matrix for stubbed-network tests.
A11y gate
@axe-core/playwrightscan on each key page/state in a dedicated spec; fail on serious/critical violations.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.
Gives 0 of the 12 instructions most e2e browser skills give in 734 tokens
Counted across 499 of the 513 authors here whose files we hold, read 2026-09-06
- Capture screenshots, videos, and traces on failurein 32 of 499, across 23 files
- Close the browser when donein 22 of 499
- Interact with elements using snapshot refsin 21 of 499, across 20 files
- Wait for specific network responses instead of fixed timeoutsin 20 of 499, across 10 files
- Keep tests independent with no shared statein 19 of 499, across 17 files
- Use Page Object Model classes to encapsulate page interactionsin 19 of 499, across 9 files
- Locate elements with data-testid attributesin 19 of 499, across 10 files
- Quarantine flaky tests with fixme or skipin 17 of 499, across 7 files
- Upload test artifacts after every CI runin 17 of 499, across 8 files
- Wait on conditions instead of using fixed sleepsin 17 of 499, across 13 files
- Clean up test data after each testin 17 of 499, across 16 files
- Test user-visible behavior, not implementation detailsin 16 of 499, across 10 files
Said here and by no other author read
- use user-facing locators, testId as last resort
- wait for UI meaning, not network idle
- authenticate once per worker via storageState setup
- gitignore the storageState auth directory
- encode setup as custom fixtures, not page objects
- stub only hard-to-trigger states with page.route
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.