playwright

Generate Playwright E2E tests using page objects and selector priority rules.

Updated Mar 15, 2026
One-click install
npx skills add https://github.com/sebasmzg/sebas.dot --skill playwright-sebasmzg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: playwright
Source: https://github.com/sebasmzg/sebas.dot/tree/main/.config/opencode/skill/playwright
Command: npx skills add https://github.com/sebasmzg/sebas.dot --skill playwright-sebasmzg

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides clear, repeatable guidance to reduce flaky end-to-end tests by enforcing consistent Page Object patterns, selector priorities, and an exploratory MCP workflow so teams produce reliable, maintainable Playwright tests.

Core Features & Use Cases

  • Page Object Model guidelines with a shared BasePage and rules for reuse to avoid duplication.
  • Selector priority strategy favoring getByRole and getByLabel, falling back to getByText and getByTestId to minimize fragile locators.
  • MCP exploration workflow to snapshot and verify real DOM structure before authoring tests, plus documentation templates for test cases and tag-based test patterns.
  • Use cases: add a single test to an existing spec, create a full suite for a feature, refactor repeated behaviors into BasePage or helpers.

Quick Start

Create one Playwright test using the page object pattern for the target page after performing MCP exploration when available.

Frequently Asked Questions about playwright

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

FAQPage Schema
How do I reduce flaky Playwright E2E tests using page objects?

Reduce flaky Playwright E2E tests by enforcing consistent Page Object patterns, utilizing a shared BasePage for reuse, and applying strict selector priority rules to produce stable, maintainable tests.

What is the selector priority strategy for Playwright locators?

The Playwright selector priority strategy favors getByRole and getByLabel first, falling back to getByText and getByTestId, minimizing fragile locators and ensuring consistent element targeting across tests.

How do I use MCP snapshot exploration before authoring Playwright tests?

Use MCP snapshot exploration to verify the real DOM structure before authoring Playwright tests, ensuring selectors match the actual application state and improving test reliability when the MCP tool is available.

What is the best way to refactor repeated behaviors in Playwright test suites?

Refactor repeated behaviors in Playwright test suites by extracting them into a shared BasePage or helper files, encouraging reuse to avoid duplication and ensuring consistent end-to-end testing patterns.

When should I use getByTestId instead of getByRole in Playwright tests?

Use getByTestId in Playwright tests only as a fallback when getByRole, getByLabel, and getByText strategies cannot target the element, minimizing fragile locators and maintaining stable test patterns.

Can I add a single test to an existing Playwright spec using these patterns?

Yes, you can add a single test to an existing Playwright spec by applying the page object pattern for the target page and performing MCP exploration when available to verify the DOM structure first.