playwright-best-practices

Guide Playwright test writing, debugging, and maintenance across E2E, component, and API scenarios.

2|Updated Feb 16, 2026
One-click install
npx skills add https://github.com/d0whc3r/statsig-browser-extension --skill playwright-best-practices-d0whc3r
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: playwright-best-practices
Source: https://github.com/d0whc3r/statsig-browser-extension/tree/main/.agents/skills/playwright-best-practices
Command: npx skills add https://github.com/d0whc3r/statsig-browser-extension --skill playwright-best-practices-d0whc3r

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the recurring pain of brittle, flaky, slow, and hard-to-debug Playwright test suites by giving you role-specific guidance for building robust tests and fixing failures systematically.

Core Features & Use Cases

  • Playwright test architecture & structure: choose between E2E, component, and API approaches, and apply patterns like Page Object Model and fixtures.
  • Stability & debugging: diagnose flaky tests, locator problems, timeouts, race conditions, and console/JS errors using Playwright-native tooling guidance.
  • Coverage across tricky surfaces: handle auth/OAuth, iFrames, service workers/PWA, mobile/responsive behavior, Electron, browser extensions, canvas/WebGL, and accessibility checks.

Quick Start

Ask the assistant to help you fix a flaky login test and refactor it for reliable locators, correct waiting, and actionable debugging steps.

Frequently Asked Questions about playwright-best-practices

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

FAQPage Schema
How do I fix flaky Playwright tests caused by race conditions and timeouts?

Fix flaky Playwright tests by diagnosing race conditions and timeouts using Playwright-native tooling, applying web-first assertions, and leveraging auto-waiting to ensure deterministic execution.

What's the best way to structure Playwright E2E and component tests?

Structure Playwright E2E and component tests by applying the Page Object Model and using custom fixtures to organize test architecture, ensuring maintainable and scalable test suites.

How do I handle authentication and OAuth flows in Playwright E2E testing?

Handle authentication and OAuth flows in Playwright E2E testing by mapping your testing goal to reference guidance that covers common edge-case domains, producing actionable recommendations for secure login automation.

Why do my Playwright locators fail to find elements, and how can I make them more robust?

Playwright locators fail due to dynamic DOM changes; make them robust by adopting web-first assertion patterns and utilizing locator strategies that align with Playwright's deterministic execution model.

Can I use Playwright to test Electron apps and browser extensions?

Yes, you can test Electron apps and browser extensions using Playwright by applying specific configuration patterns designed for these environments to ensure accurate coverage across tricky surfaces.

Does Playwright support accessibility testing and mobile responsive behavior checks?

Yes, Playwright supports accessibility testing and mobile responsive behavior checks by configuring tests to cover tricky surfaces like service workers, PWA, and mobile viewports for comprehensive validation.