One-click install
npx skills add https://github.com/testdino-hq/playwright-skill --skill playwright-pom-testdino-hq
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: playwright-pom
Source: https://github.com/testdino-hq/playwright-skill/tree/main/pom
Command: npx skills add https://github.com/testdino-hq/playwright-skill --skill playwright-pom-testdino-hq

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you avoid brittle, hard-to-maintain Playwright tests by showing how to organize UI code using the Page Object Model instead of leaking low-level locators throughout your specs.

Core Features & Use Cases

  • Decision framework: Choose POM vs fixtures vs helpers based on page complexity and reuse across test files.
  • Action-oriented page objects: Design page objects so tests call intent methods (e.g., login, submit, navigate) rather than manipulating raw locators.
  • Good POM structure: Keep assertions in tests, keep page objects stateless, and return destination page objects for navigation-based flows.
  • Scalable patterns: Use fixtures for widely shared page objects, components via Locator-scoped composition, and getters/factories for dynamic or initialization-heavy pages.

Quick Start

Use the pom Skill to refactor a multi-step page interaction into a page object class (or fixtures) where tests call intent methods and assertions remain in the spec files.

Frequently Asked Questions about playwright-pom

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

FAQPage Schema
How do I structure Playwright tests to avoid duplicating locators across multiple spec files?

To reduce locator duplication in Playwright, implement the Page Object Model to encapsulate UI interactions within reusable classes. This approach organizes page and component interactions so tests call intent methods rather than manipulating raw locators directly, improving overall test maintainability.

When should I use fixtures versus page objects in Playwright?

Use Playwright fixtures for widely shared page objects reused in three or more spec files, and standard page objects for less complex interactions. This decision framework balances fixture-based injection with action-oriented page classes based on page complexity and cross-file reuse.

How do I design Playwright page objects for multi-step navigation flows?

Design Playwright page objects for navigation flows by keeping them stateless and returning destination page objects from action methods. This chaining pattern ensures test-owned assertions remain in the spec files while page objects handle navigation and dynamic locators.

Should assertions go inside Playwright page object classes?

Assertions should remain in the spec files, not inside Playwright page object classes. Keeping page objects stateless and action-oriented ensures tests call intent methods like login or submit, while the test files own the assertions, preventing UI logic from leaking into page abstractions.

What is the best way to handle dynamic locators in Playwright page objects?

Handle dynamic locators in Playwright page objects by using getters or factories for initialization-heavy pages. This scalable pattern pairs well with Locator-scoped composition for components, ensuring page objects remain maintainable when dealing with dynamic or asynchronous UI elements.

Can I compose reusable UI components in Playwright tests?

You can compose reusable UI components in Playwright tests using Locator-scoped composition. This technique allows scalable patterns where component interactions are organized efficiently, complementing action-oriented page objects and fixture-based injection for pages shared across multiple specs.