About playwright
playwright is a skill for work involving Playwright Test and browser automation, covering setup, testing practices, debugging, and CI. It helps developers and coding agents follow the existing project conventions and consult the relevant guidance for each task.
Key features
- 01Inspect local Playwright setup
- 02Guidance for configuration and CLI
- 03Locator and assertion practices
- 04Fixtures, auth, and network mocking
- 05Debugging, CI, and advanced topics
Use cases
- 01Add or update browser end-to-end tests
- 02Investigate locator or timing failures
- 03Adjust CI, authentication, or network mocks
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ dobroslavradosavljevic/ skills --skill playwrightAfter installing, type/playwrightin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
agents/openai.yamlreferences/debugging-ci-advanced.mdfixtures-auth-network.mdlocators-assertions.mdsetup-core.mdsource-map.mdDetails
From the project READMEPlaywright
Use this skill when work touches Playwright Test, browser automation, E2E tests, locators, fixtures, auth setup, network mocking, traces, CI, API testing alongside UI, component stories, or agent browser tooling built on Playwright.
Snapshot: @playwright/[email protected] / [email protected] / [email protected] (verified current 2026-10-01). Refresh from source-map.md if versions differ.
Workflow
- Inspect the local Playwright surface before changing code:
- Package versions for
@playwright/test,playwright, optional@playwright/browser-*, leftover@playwright/experimental-ct-*, Node, and Docker image tags. - Config:
playwright.config.ts/.js,testDir, projects,useoptions,webServer, reporters, retries/retryStrategy/workers. - Test layout: specs, setup projects, fixtures, POM classes,
playwright/.auth, snapshots, stories/galleries, and CI workflows. - Runtime intent: E2E UI, API-only, auth reuse, network mocks, visual/a11y checks, component stories, or agent-driven exploration.
- Package versions for
- Refresh docs when the user asks for latest/current behavior, versions are unclear, or the work touches CI, CT, or agent tooling. Start from source-map.md.
- For install, Library vs Test, config, projects,
webServer, and CLI, use setup-core.md. - For locators, actions, auto-waiting, web-first assertions, and anti-patterns, use locators-assertions.md.
- For fixtures, POM, auth/
storageState, parallelism, test locks, and network/HAR mocking, use fixtures-auth-network.md. - For traces, UI Mode, debug, CI/sharding/Docker, API testing, CT, a11y/visuals, and agent tooling, use debugging-ci-advanced.md.
- Implement in the existing project style:
- Prefer
@playwright/testfor E2E. Use theplaywrightlibrary only for standalone scripts/automation without the Test Runner. - After changing Playwright package versions, reinstall matching browser binaries.
- Match local locator conventions, fixture patterns, and CI artifact settings unless they contradict official guidance.
- Prefer
Playwright Judgment
- Prefer user-facing locators:
getByRolefirst, then label/placeholder/text/alt/title, thengetByTestId. Avoid CSS/XPath unless justified. - Prefer
locator.visible()over the:visibleCSS pseudo-class. Prefer a unique role/name over visibility filters when the contract allows. - Use
page.frameLocator()without a selector only when the target may live in any iframe; the rest of the locator still must resolve inside a single frame. - Assert with web-first
await expect(...).toBeVisible()(and siblings). Neverexpect(await locator.isVisible()).toBe(true). - Trust auto-waiting. Do not ship
waitForTimeout/ sleep-based synchronization. - Keep tests isolated. Prefer setup-project
storageStateor worker-scoped accounts over shared mutable login in every test. - For a shared external resource, declare a named
lockinstead of serializing the whole file. In default/serial mode a lock on one test is held for the whole file. - Mock third-party or uncontrollable network at
context/page.route; startwaitForResponsebefore the triggering action. - Local debug path: UI Mode → Trace Viewer for CI failures →
--debug/ Inspector for step-through. - CI defaults:
forbidOnly, retries,trace: 'on-first-retry',screenshot: 'only-on-failure', install with--with-depsor a version-matched Docker image (mcr.microsoft.com/playwright:v1.63.0-noble), scale with shards not only workers. - Component tests use built-in
mountagainst a story gallery served by the app's own dev server. Do not add@playwright/experimental-ct-*on 1.63+. Stay on 1.62 until those packages are migrated. - For coding agents writing tests in-repo, prefer Playwright CLI when available; use Playwright MCP for live exploratory browser loops. Do not confuse harness browser tools with
@playwright/mcp.
Verification
Prefer the repo's existing checks. For meaningful Playwright work, include the relevant subset:
- Focused
bunx playwright testfor the changed specs/projects (--project, file path, or-gtitle). - UI Mode or headed run when locator/timing behavior is unclear.
- Trace or HTML report review for flake, actionability, or network failures.
- CI-shaped smoke when changing retries, shards, reporters, Docker tags, auth setup, or
webServer. - Snapshot update (
-u) only when visual baselines intentionally change, generated on the same OS/browser as CI when possible. - Typecheck for TypeScript configs, fixtures, and POM helpers when the project typechecks tests.