Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
jeffallan avatar

Playwright Expert

  • 3.9k installs
  • 10.8k repo stars
  • Updated May 20, 2026
  • jeffallan/claude-skills

A specialist skill that guides developers in writing, configuring, and debugging Playwright end-to-end browser tests using POM patterns, proper selectors, and CI integration.

About

Playwright Expert is a specialist skill for writing, configuring, and debugging end-to-end browser tests using the Playwright framework. Developers invoke it when setting up test infrastructure, authoring Page Object Model classes, configuring playwright.config.ts, implementing API route mocking, or diagnosing flaky test failures. The core workflow moves from requirement analysis through test authoring, debugging via the trace viewer, and CI/CD pipeline integration. Key constraints enforce role-based selectors over brittle CSS classes, auto-waiting over arbitrary timeouts, and strict test isolation with no shared state. Output templates include Page Object classes, test spec files with assertions, fixture setup, and configuration recommendations for parallel execution with trace and screenshot capture on failure. Enforces Page Object Model pattern with typed Locator properties and reusable goto/action methods Mandates role-based selectors (getByRole, getByLabel) and bans CSS class selectors for resilience

  • Enforces Page Object Model pattern with typed Locator properties and reusable goto/action methods
  • Mandates role-based selectors (getByRole, getByLabel) and bans CSS class selectors for resilience
  • Provides a five-step flaky-test debug workflow: run with trace, open trace viewer, replace waitForTimeout with waitFor s
  • Covers API mocking via route interception and visual regression testing as referenced in the modular reference guide
  • Includes CI/CD integration guidance and parallel execution configuration in playwright.config.ts

Playwright Expert by the numbers

  • 3,925 all-time installs (skills.sh)
  • +96 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #294 of 2,184 Testing & QA skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

playwright-expert capabilities & compatibility

Capabilities
page object model authoring · role based selector enforcement · flaky test debugging · api route mocking · visual regression testing · playwright.config.ts setup · ci/cd integration · parallel test execution
Use cases
testing · debugging · ci cd
Runs
Runs locally
Pricing
Free
npx skills add https://github.com/jeffallan/claude-skills --skill playwright-expert

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs3.9k
repo stars10.8k
Security audit3 / 3 scanners passed
Last updatedMay 20, 2026
Repositoryjeffallan/claude-skills

What it does

Write and debug Playwright E2E tests using Page Object Model, role-based selectors, API mocking, and CI integration for browser automation.

Who is it for?

Developers building or maintaining E2E test suites for web applications using Playwright, especially when addressing flaky tests or setting up test infrastructure from scratch.

Skip if: Unit testing, non-browser automation, or projects not using the Playwright framework.

When should I use this skill?

Writing new Playwright tests, debugging flaky browser tests, setting up playwright.config.ts, implementing API mocking, adding visual regression tests, or integrating Playwright into CI/CD.

What you get

Developers produce stable, maintainable E2E test suites with Page Object classes, role-based selectors, auto-waiting, and trace-enabled debugging integrated into CI pipelines.

  • Page Object class files
  • Playwright test spec files with assertions
  • playwright.config.ts configuration

By the numbers

  • 5 modular reference topics (selectors, POM, API mocking, configuration, debugging)
  • 10 repeat-each runs recommended to verify flaky test fix stability
  • version 1.1.0

Files

SKILL.mdMarkdownGitHub ↗

Playwright Expert

E2E testing specialist with deep expertise in Playwright for robust, maintainable browser automation.

Core Workflow

1. Analyze requirements - Identify user flows to test 2. Setup - Configure Playwright with proper settings 3. Write tests - Use POM pattern, proper selectors, auto-waiting 4. Debug - Run test → check trace → identify issue → fix → verify fix 5. Integrate - Add to CI/CD pipeline

Reference Guide

Load detailed guidance based on context:

TopicReferenceLoad When
Selectorsreferences/selectors-locators.mdWriting selectors, locator priority
Page Objectsreferences/page-object-model.mdPOM patterns, fixtures
API Mockingreferences/api-mocking.mdRoute interception, mocking
Configurationreferences/configuration.mdplaywright.config.ts setup
Debuggingreferences/debugging-flaky.mdFlaky tests, trace viewer

Constraints

MUST DO

  • Use role-based selectors when possible
  • Leverage auto-waiting (don't add arbitrary timeouts)
  • Keep tests independent (no shared state)
  • Use Page Object Model for maintainability
  • Enable traces/screenshots for debugging
  • Run tests in parallel

MUST NOT DO

  • Use waitForTimeout() (use proper waits)
  • Rely on CSS class selectors (brittle)
  • Share state between tests
  • Ignore flaky tests
  • Use first(), nth() without good reason

Code Examples

Selector: Role-based (correct) vs CSS class (brittle)

// ✅ Role-based selector — resilient to styling changes
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByLabel('Email address').fill('user@example.com');

// ❌ CSS class selector — breaks on refactor
await page.locator('.btn-primary.submit-btn').click();
await page.locator('.email-input').fill('user@example.com');

Page Object Model + Test File

// pages/LoginPage.ts
import { type Page, type Locator } from '@playwright/test';

export class LoginPage {
  readonly page: Page;
  readonly emailInput: Locator;
  readonly passwordInput: Locator;
  readonly submitButton: Locator;
  readonly errorMessage: Locator;

  constructor(page: Page) {
    this.page = page;
    this.emailInput = page.getByLabel('Email address');
    this.passwordInput = page.getByLabel('Password');
    this.submitButton = page.getByRole('button', { name: 'Sign in' });
    this.errorMessage = page.getByRole('alert');
  }

  async goto() {
    await this.page.goto('/login');
  }

  async login(email: string, password: string) {
    await this.emailInput.fill(email);
    await this.passwordInput.fill(password);
    await this.submitButton.click();
  }
}
// tests/login.spec.ts
import { test, expect } from '@playwright/test';
import { LoginPage } from '../pages/LoginPage';

test.describe('Login', () => {
  let loginPage: LoginPage;

  test.beforeEach(async ({ page }) => {
    loginPage = new LoginPage(page);
    await loginPage.goto();
  });

  test('successful login redirects to dashboard', async ({ page }) => {
    await loginPage.login('user@example.com', 'correct-password');
    await expect(page).toHaveURL('/dashboard');
  });

  test('invalid credentials shows error', async () => {
    await loginPage.login('user@example.com', 'wrong-password');
    await expect(loginPage.errorMessage).toBeVisible();
    await expect(loginPage.errorMessage).toContainText('Invalid credentials');
  });
});

Debugging Workflow for Flaky Tests

// 1. Run failing test with trace enabled
// playwright.config.ts
use: {
  trace: 'on-first-retry',
  screenshot: 'only-on-failure',
}

// 2. Re-run with retries to capture trace
// npx playwright test --retries=2

// 3. Open trace viewer to inspect timeline
// npx playwright show-trace test-results/.../trace.zip

// 4. Common fix — replace arbitrary timeout with proper wait
// ❌ Flaky
await page.waitForTimeout(2000);
await page.getByRole('button', { name: 'Save' }).click();

// ✅ Reliable — waits for element state
await page.getByRole('button', { name: 'Save' }).waitFor({ state: 'visible' });
await page.getByRole('button', { name: 'Save' }).click();

// 5. Verify fix — run test 10x to confirm stability
// npx playwright test --repeat-each=10

Output Templates

When implementing Playwright tests, provide: 1. Page Object classes 2. Test files with proper assertions 3. Fixture setup if needed 4. Configuration recommendations

Knowledge Reference

Playwright, Page Object Model, auto-waiting, locators, fixtures, API mocking, trace viewer, visual comparisons, parallel execution, CI/CD integration

Documentation

Related skills

FAQ

Why should I avoid waitForTimeout in Playwright tests?

waitForTimeout introduces arbitrary delays that make tests flaky and slow. Use waitFor with a state option like visible instead, so the test waits only as long as the element actually needs.

How does the Page Object Model improve Playwright test maintainability?

POM encapsulates locators and actions in typed classes, so selector changes are updated in one place rather than across every test file.

How do I diagnose a flaky test using the trace viewer?

Set trace: on-first-retry in playwright.config.ts, run with --retries=2 to capture a trace, then run npx playwright show-trace on the resulting trace.zip to inspect the full timeline.

Is Playwright Expert safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Testing & QAtestingfrontendintegrations

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.