playwright-tests

Create and review Playwright tests using accessible selectors and web-first assertions.

Updated Jan 12, 2026
One-click install
npx skills add https://github.com/hasparus/claude-skills-dotfiles --skill playwright-tests
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: playwright-tests
Source: https://github.com/hasparus/claude-skills-dotfiles/tree/main/playwright-tests
Command: npx skills add https://github.com/hasparus/claude-skills-dotfiles --skill playwright-tests

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Tests for modern web apps often suffer from brittleness and flakiness when using brittle selectors. This skill promotes accessible selectors (getByRole, getByLabel) and web-first assertions to create robust Playwright end-to-end tests.

Core Features & Use Cases

  • Use accessible selectors in Playwright tests to improve resilience against DOM changes.
  • Follow core patterns like waiting, list counts, hydration, and error handling to reduce flakiness.
  • Apply guidance when creating, debugging, or reviewing test suites to ensure deterministic behavior.

Quick Start

Start by replacing brittle CSS selectors with getByRole and getByLabel in your tests to reduce flakiness.

Frequently Asked Questions about playwright-tests

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

FAQPage Schema
How do I fix flaky Playwright tests caused by brittle CSS selectors?

Fix flaky Playwright tests by replacing brittle CSS selectors with accessible locators like getByRole and getByLabel. This practice targets stable DOM elements, improving test resilience against UI changes and reducing unreliable end-to-end testing outcomes.

What are web-first assertions in Playwright and when should I use them?

Web-first assertions in Playwright are mechanisms that automatically wait for elements to reach an expected state before proceeding. Use them to ensure deterministic behavior and reduce flakiness when testing dynamic web applications.

How to create robust Playwright end-to-end tests using accessible selectors?

Create robust Playwright tests by prioritizing accessible selectors such as getByRole, getByLabel, getByPlaceholder, and getByText. Composing these locators ensures stable outcomes and reduces test brittleness across modern web applications.

Does Playwright testing require a specific JavaScript or TypeScript environment setup?

Playwright testing requires a JavaScript or TypeScript test environment. You must configure this environment and install Playwright to create, debug, and review end-to-end test suites following strict selector priority guidelines.

What is the best way to handle list counts and hydration in Playwright e2e tests?

Handle list counts and hydration in Playwright e2e tests by applying core testing patterns like web-first assertions and waiting mechanisms. Following these patterns ensures elements are fully loaded and reduces flakiness in dynamic web applications.

Why do my Playwright tests fail during DOM changes and how can I prevent it?

Playwright tests fail during DOM changes when relying on brittle selectors. Prevent this by following a strict selector priority using getByRole and getByLabel, which promotes accessible locators that remain stable during UI updates.