playwright

Generate Playwright E2E test patterns with Page Object Model and selector prioritization.

Updated Mar 23, 2026
One-click install
npx skills add https://github.com/giruclawbot/giru-backup --skill playwright-giruclawbot
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: playwright
Source: https://github.com/giruclawbot/giru-backup/tree/main/skills/playwright
Command: npx skills add https://github.com/giruclawbot/giru-backup --skill playwright-giruclawbot

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides clear, repeatable patterns and workflows to reduce flakiness and guesswork when writing Playwright end-to-end tests, ensuring tests reflect real user flows and resilient selectors.

Core Features & Use Cases

  • MCP Exploration Workflow: Step-by-step guidance to snapshot, inspect, interact, and document real DOM state before authoring tests to avoid brittle selectors.
  • Selector Priority & Page Object Model: Rules and examples for using getByRole/getByLabel/getByText over fragile locators, and a BasePage/Page Object pattern to centralize common behavior.
  • Test Organization & Documentation: Standardized file structure, single-spec-per-feature guidance, tagging conventions, and a lightweight test-case markdown format for reproducible E2E documentation.
  • Refactoring & Reuse Guidance: When to move helpers to BasePage or utilities, and patterns to avoid duplicating behavior across page objects.

Quick Start

Create a Playwright E2E test using the Page Object pattern for a login flow with selectors verified via MCP snapshots and place the spec, page object, and documentation under the tests/{page-name} folder.

Frequently Asked Questions about playwright

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

FAQPage Schema
How do I write stable Playwright E2E tests that don't flake?

Stable Playwright E2E tests are achieved by prioritizing resilient locators like getByRole, getByLabel, and getByText, and by snapshotting real DOM state through MCP exploration before authoring to avoid brittle selectors.

What is the best way to structure Playwright page objects for web application testing?

Playwright page objects should use a BasePage pattern to centralize common behavior and helpers, keeping spec files structured with a single-spec-per-feature approach under dedicated folders to ensure reproducible test documentation.

Why does my Playwright test fail to find elements in the DOM?

Playwright test failures often stem from fragile locators; you should inspect real DOM state via MCP exploratory snapshots first, and apply selector priority rules using getByRole or getByLabel over brittle CSS or XPath locators.

When do I need to use the Page Object Model for Playwright E2E scenarios?

You need the Page Object Model for Playwright E2E scenarios when centralizing common behavior and reducing duplicated actions across feature pages, moving shared logic to BasePage or utilities for better refactoring and reuse.

How do I document Playwright E2E test cases for feature pages?

Document Playwright E2E test cases using a lightweight markdown format alongside spec and page object files, placing them under dedicated tests/{page-name} folders with standardized tagging conventions for reproducible documentation.

Does this Playwright pattern support TypeScript testing environments?

Yes, these Playwright E2E patterns support TypeScript testing environments, applying typed Page Object Models, BasePage conventions, and MCP exploratory workflows to generate stable UI tests for web applications.