playwright_testing

Writes and debugs Playwright end-to-end browser tests using Page Object Model and auto-waiting locators.

Updated Jan 14, 2026
One-click install
npx skills add https://github.com/jvsandhu/agentic-skills --skill playwright-testing-jvsandhu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: playwright_testing
Source: https://github.com/jvsandhu/agentic-skills/tree/main/skills/playwright_testing
Command: npx skills add https://github.com/jvsandhu/agentic-skills --skill playwright-testing-jvsandhu

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing reliable end-to-end browser tests is hard: flaky selectors, race conditions, and shared state between tests cause constant CI failures. This Skill provides a structured Playwright workflow covering setup, resilient test authoring, and debugging so tests stay stable in CI/CD pipelines. ## Core Features & Use Cases - Resilient Test Authoring: Enforces role-based locators, web-first assertions, and auto-waiting instead of brittle CSS selectors and hard-coded timeouts. - Page Object Model & Fixtures: Guides implementation of POM architecture, custom fixtures, and shared authentication via storageState. - Debugging & CI Integration: Covers trace viewer, UI mode, API mocking with page.route, sharding, and visual regression testing. - Use Case: A QA engineer needs to automate a checkout flow. The Skill produces Page Object classes, test files with proper assertions, and a playwright.config.ts with trace-on-retry enabled for CI. ## Quick Start Write Playwright E2E tests for the login and checkout flow of my web app using the Page Object Model pattern.

Frequently Asked Questions about playwright_testing

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

FAQPage Schema
How do I write Playwright E2E tests with Page Object Model?

Create Page Object classes encapsulating page locators and actions, then reference them in test files through fixtures. Use role-based locators like page.getByRole and web-first assertions such as expect(locator).toBeVisible() for maintainable tests.

How to fix flaky Playwright tests in CI?

Remove all waitForTimeout calls and rely on auto-waiting and web-first assertions instead. Enable trace: 'on-first-retry' in playwright.config.ts, then inspect failing traces in the trace viewer to find race conditions.

Does Playwright support API mocking in browser tests?

Yes, page.route intercepts network requests to mock or spy on API calls. This isolates tests from backend dependencies and speeds up execution by returning controlled responses.

How do I share login state between Playwright tests?

Use storageState to perform login once and reuse the authenticated session across tests. Combine this with custom fixtures instead of test.beforeEach for repetitive setup like data seeding.

Why are CSS selectors discouraged in Playwright tests?

CSS class selectors break when styling changes, making tests brittle. User-focused locators like getByRole and getByText reflect how users interact with the page and survive refactors.