playwright-expert

Implements Playwright end-to-end tests with browser automation, network interception, and visual regression.

3|Updated Jan 15, 2026
One-click install
npx skills add https://github.com/trudyan141/my-antigravity-agents-kit --skill playwright-expert-trudyan141
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: playwright-expert
Source: https://github.com/trudyan141/my-antigravity-agents-kit/tree/main/templates/.agent/skills/playwright-expert
Command: npx skills add https://github.com/trudyan141/my-antigravity-agents-kit --skill playwright-expert-trudyan141

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @playwright/test.

What problem does it solve? Setting up and maintaining reliable end-to-end browser tests is difficult: tests become flaky, selectors break, and CI pipelines fail intermittently. This Skill provides proven Playwright patterns for configuration, test authoring, and debugging so your E2E suite stays stable. ## Core Features & Use Cases - Project Setup & Configuration: Generates playwright.config.ts with cross-browser projects (Chromium, Firefox, WebKit), retries, trace capture, and webServer integration. - Test Authoring Patterns: Provides Page Object Model implementations, data-testid selector strategies, and network interception for mocking API responses. - Flaky Test Remediation: Applies polling assertions, proper wait strategies, and CI retry configuration to stabilize unreliable tests. - Use Case: You need to add E2E coverage for a login flow. The Skill scaffolds a LoginPage page object, writes tests for success and error paths, mocks the auth API, and configures screenshots on failure. ## Quick Start Set up Playwright E2E testing in my project and write a login test using the Page Object Model pattern.

Frequently Asked Questions about playwright-expert

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

FAQPage Schema
How do I set up Playwright for E2E testing in a new project?

Run npm init playwright@latest to scaffold the project, then npx playwright install to download browsers. Configure playwright.config.ts with your testDir, baseURL, browser projects, and a webServer block that starts your dev server automatically.

How to fix flaky Playwright tests in CI?

Replace hardcoded waits with polling assertions like expect().toPass() and waitForLoadState('networkidle'). Enable retries in CI via the config retries option, use test.slow() for long operations, and capture traces on first retry for debugging.

Playwright vs Jest or Vitest for testing, which should I use?

Playwright is for end-to-end browser automation across real browsers, while Jest and Vitest handle unit and integration tests without a browser. Use Playwright for user-flow validation and a unit test runner for isolated logic.

Does Playwright support mocking API responses in tests?

Yes, page.route() intercepts network requests matching a URL pattern and lets you fulfill them with custom status codes and JSON bodies. This isolates frontend tests from backend availability.

Why are my Playwright selectors breaking after UI changes?

Selectors tied to CSS classes or DOM structure break when markup changes. Use data-testid attributes as stable selectors and organize locators in Page Object Model classes so updates happen in one place.

Can Playwright run visual regression tests?

Yes, toHaveScreenshot() captures a page snapshot and compares it against a baseline image, with maxDiffPixelRatio controlling tolerance. Baselines are stored per browser project and updated with the --update-snapshots flag.