playwright-best-practices

Guide Playwright test creation with best practices for reliable suites.

Updated May 28, 2026
One-click install
npx skills add https://github.com/7Lemaitre7/xp-prj --skill playwright-best-practices-7lemaitre7
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: playwright-best-practices
Source: https://github.com/7Lemaitre7/xp-prj/tree/main/.agents/skills/playwright-best-practices
Command: npx skills add https://github.com/7Lemaitre7/xp-prj --skill playwright-best-practices-7lemaitre7

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Playwright tests can be slow, flaky, and hard to maintain; this Skill provides a comprehensive, reference-driven guide to writing robust tests, with best practices across E2E, component, API, and visual testing.

Core Features & Use Cases

  • Activity-based references for writing new tests, debugging failures, refactoring to Page Object Model, and configuring CI/CD.
  • Guidance on robust locators, auto-waiting, fixtures, test data, and test annotations to improve reliability.
  • Real-world decision trees and patterns for CI, performance, accessibility, and security testing with Playwright.

Quick Start

Describe a flaky Playwright test and ask for a robust remediation plan.

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?

Fix flaky Playwright tests by applying robust locators, leveraging auto-waiting, and using custom fixtures. This Skill provides structured remediation plans to stabilize unreliable end-to-end and component test suites.

What is the best way to structure Playwright test data and locators?

The best way to structure Playwright tests is using the Page Object Model alongside robust locators, test annotations, and fixtures. This approach improves maintainability and reliability for complex test suites.

How do I configure Playwright for CI/CD pipelines?

Configure Playwright for CI/CD by following real-world decision trees and patterns for performance, security, and accessibility testing. This Skill provides structured guidance for integrating reliable test runs into continuous integration workflows.

Does Playwright support accessibility and visual testing workflows?

Playwright supports accessibility and visual testing workflows by providing structured guidance for both. This Skill covers how to integrate these checks alongside end-to-end, component, and API testing.

Why should I use a Page Object Model when refactoring Playwright tests?

Use a Page Object Model when refactoring Playwright tests to solve maintainability and readability problems. This Skill provides reference-driven patterns to transition hard-to-maintain test suites into robust, reusable structures.

When should I use component testing instead of end-to-end testing in Playwright?

Use component testing instead of end-to-end testing when validating isolated UI parts rather than full user journeys. This Skill offers decision trees to help choose between E2E, component, API, and visual testing approaches.