playwright-best-practices

Guide Playwright testing with best practices for E2E, component, API, and accessibility tests.

Updated Apr 21, 2026
One-click install
npx skills add https://github.com/brandonjjon/astro-starter-cf --skill playwright-best-practices-brandonjjon
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: playwright-best-practices
Source: https://github.com/brandonjjon/astro-starter-cf/tree/main/.agents/skills/playwright-best-practices
Command: npx skills add https://github.com/brandonjjon/astro-starter-cf --skill playwright-best-practices-brandonjjon

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Playwright testing can become brittle and time-consuming without a structured, accessible guidance system. This Skill provides a comprehensive, curated set of best-practices for writing, debugging, and maintaining Playwright tests across E2E, component, API, visual, and accessibility testing, enabling teams to ship faster with fewer flaky failures.

Core Features & Use Cases

  • Activity-based reference mapping that loads the most relevant Playwright best-practices documents based on your current task.
  • Broad coverage across core patterns (test structure, locators, assertions, Page Object Model, fixtures), debugging, CI/CD integration, performance considerations, and accessibility.
  • Guidance for writing new tests, debugging flaky tests, configuring pipelines, mocking APIs, and handling authentication flows.

Quick Start

Instruct me on your current Playwright task and I will apply the best practices to guide you step by step.

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 E2E tests?

Fix flaky Playwright E2E tests by applying guided best practices for debugging failures, improving test structure, and using resilient locators. This skill maps your debugging activity to a curated reference set, loading context-specific guidance to stabilize brittle tests and reduce failures.

What is the best way to mock APIs and handle authentication in Playwright?

The best way to mock APIs and handle authentication in Playwright is by following structured best practices for setting up test fixtures and mocking network requests. This skill provides targeted guidance to securely configure authentication flows and mock APIs for reliable testing.

How do I configure Playwright CI/CD pipelines to run tests efficiently?

Configure Playwright CI/CD pipelines by applying best practices for test execution, performance considerations, and pipeline integration. This skill loads specific reference documents to help you optimize continuous integration workflows and ensure consistent test runs across environments.

Does this provide guidance for Playwright accessibility and component testing?

Yes, it provides comprehensive guidance for Playwright accessibility and component testing. You receive curated best practices covering visual, API, and accessibility tests, ensuring your E2E and component tests meet accessibility standards and maintain high quality across different testing types.

When should I use the Page Object Model in Playwright tests?

Use the Page Object Model in Playwright tests to structure complex test suites and improve maintainability. This skill supplies reference documents on core patterns including Page Object Model and fixtures, helping you decide when to apply them for better test organization.

Why do my Playwright tests fail in CI but pass locally?

Playwright tests often fail in CI but pass locally due to environment differences, timing issues, or missing authentication setups. This skill helps diagnose these discrepancies by loading debugging and CI/CD best practices to align your local and pipeline test environments.