playwright-automation

Author and debug Playwright end-to-end tests with selectors, fixtures, traces, and network mocking.

15|3|Updated Jul 9, 2026
One-click install
npx skills add https://github.com/kiurakku/cursor-kit-for-ai --skill playwright-automation-kiurakku
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: playwright-automation
Source: https://github.com/kiurakku/cursor-kit-for-ai/tree/main/plugins/integrations/skills/playwright-automation
Command: npx skills add https://github.com/kiurakku/cursor-kit-for-ai --skill playwright-automation-kiurakku

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @playwright/test.

What problem does it solve? Writing browser tests that pass locally but flake in CI wastes engineering time. This Skill provides a structured playbook for building stable Playwright E2E suites — from selector strategy and fixtures to trace-based debugging and network mocking — so tests fail only when the app is actually broken. ## Core Features & Use Cases - Selector Strategy: Enforces a stability-first locator priority (getByRole, getByLabel, getByTestId) over brittle CSS/XPath selectors. - Fixtures & Auth Reuse: Patterns for extending base tests, sharing authenticated state via storageState, and per-test resets. - Trace Debugging & Mocking: Diagnose CI failures with trace.zip artifacts, and stub backend APIs with page.route to isolate the UI under test. - Use Case: A checkout flow breaks intermittently in CI. Use this Skill to replace waitForTimeout calls with auto-waiting assertions, mock the payment API, and capture a trace on retry to pinpoint the failing locator. ## Quick Start Ask the AI to write a Playwright test for your login flow using role-based selectors, an authenticated fixture, and trace-on-first-retry configuration.

Frequently Asked Questions about playwright-automation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write stable Playwright selectors?▼

Use Playwright's locator priority: getByRole first, then getByLabel, getByPlaceholder, getByTestId, and getByText. Avoid CSS classes and deep XPath chains, which break when the design system or DOM structure changes.

How to debug a Playwright test that fails only in CI?▼

Enable trace: 'on-first-retry' in playwright.config.ts, download the trace.zip artifact from CI, and open it with npx playwright show-trace. The trace shows the timeline, network calls, DOM snapshots, and console output at the failure point.

How do I mock API responses in Playwright tests?▼

Use page.route with route.fulfill to return stubbed JSON for backend endpoints, isolating the UI from flaky services. Use route.continue to modify live traffic, and waitForResponse to assert the app called an API correctly.

Can Playwright reuse login state across tests?▼

Yes. Save the authenticated session once with page.context().storageState({ path: 'auth.json' }), then set storageState in playwright.config.ts so every test starts logged in without repeating the login flow.

Why are my Playwright visual regression tests flaky?▼

Snapshot diffs usually come from dynamic content like timestamps or animations. Mask dynamic regions with the mask option, fix the viewport size, set reducedMotion: 'reduce', and run snapshot tests in a consistent CI container.

When should I not use network mocking in Playwright?▼

Do not mock the routes of the application under test itself — that defeats the purpose of end-to-end testing. Mock only external third-party dependencies and widgets you do not control.