Playwright Expert
Use when writing E2E tests with Playwright, setting up test infrastructure, or debugging flaky browser tests.
Before & after
Same prompt, same agent — the only difference is the skill.
Playwright is a powerful tool for end-to-end testing of web applications. You'll want to write tests that simulate real user actions like clicking buttons and filling out forms accurately. Page Object Model is a useful pattern that helps organize and maintain your tests. You should test both happy paths and error scenarios to be thorough. Waiting for elements to appear is important for reliability - avoid hard waits if possible. You can run tests in parallel for speed and efficiency. CI integration is helpful for automating test runs. Would you like me to help set up the test structure, or do you need specific examples? I can guide you through the setup.
// loginPage.ts - Page Object Pattern
import { Page } from '@playwright/test';
export class LoginPage {
constructor(private page: Page) {}
async navigateTo() {
await this.page.goto('/login');
}
async login(email: string, password: string) {
await this.page.getByLabel('Email').fill(email);
await this.page.getByLabel('Password').fill(password);
await this.page.getByRole('button', {name: 'Sign in'}).click();
await this.page.waitForURL('/dashboard');
}
async getErrorMessage() {
return await this.page.getByRole('alert').textContent();
}
}
// checkout.spec.ts - Test Suite
import { test, expect } from '@playwright/test';
import { LoginPage } from './pages/loginPage';
import { CheckoutPage } from './pages/checkoutPage';
test.describe('Checkout Flow', () => {
test('Happy path: complete purchase', async ({page}) => {
const loginPage = new LoginPage(page);
const checkoutPage = new CheckoutPage(page);
await loginPage.navigateTo();
await loginPage.login('user@example.com', 'password123');
await checkoutPage.navigateTo();
await checkoutPage.addItemToCart('Pro Plan');
await checkoutPage.fillShippingInfo('123 Main St');
await checkoutPage.fillPayment('4242424242424242', '12/25', '123');
await checkoutPage.submitOrder();
await expect(page).toHaveURL('/order-confirmed');
await expect(page.getByText('Order Confirmed')).toBeVisible();
});
test('Invalid login: wrong password', async ({page}) => {
const loginPage = new LoginPage(page);
await loginPage.navigateTo();
await loginPage.login('user@example.com', 'wrongpassword');
const error = await loginPage.getErrorMessage();
expect(error).toContain('Invalid credentials');
});
});
CONFIG: playwright.config.ts
webServer: http://localhost:3000
workers: 4 (parallel execution)
timeout: 30000
retries: 2 (flaky-test resilience)
KEY PRACTICES: Page Objects encapsulate selectors. getByRole and getByLabel are accessibility-first. Explicit waits via waitForURL/waitForSelector. No hard sleeps. CI runs headless via GitHub Actions. Screenshot artifacts on failure.About this skill
name: playwright-expert description: Use when Use when writing E2E tests with Playwright, setting up test infrastructure, or debugging flaky browser tests.
Playwright Expert
Use when writing E2E tests with Playwright, setting up test infrastructure, or debugging flaky browser tests. Invoke to write test scripts, create page objects, configure test fixtures, set up reporters, add CI integration, implement API mocking, or perform visual regression testing. Trigger terms: Playwright, E2E test, end-to-end, browser testing, automation, UI testing, visual testing, Page Object Model, test flakiness.
What you get
- Public GitHub repo
- the skills/playwright-expert folder with SKILL.md and references.
Customize your output
- Fork the repo and extend the skill's reference files for your own stack conventions.
Example output
Activates on a matching request (e.g. building or reviewing Playwright Expert code) and can chain with other skills in the pack.
Best for
Full-stack developers and engineering teams using Claude Code.
SKILL.md preview
---
name: playwright-expert
description: Use this skill when writing E2E tests with Playwright, setting up test infrastructure, or debugging flaky browser tests.
version: 1.0.0
category: Development / Testing
author: AgentVolt
license: proprietary
tags:
- development
- testing
---
# Playwright Expert
Writes reliable Playwright end-to-end tests and test infrastructure, with specific attention to eliminating flakiness rather than papering over it with retries.
## When to use
… (sign up to view the full skill)More development skills
View all Development skills →Playwright
Gives Claude autonomous headless browser control — it spins up a browser, clicks through your UI, checks everything works, and fixes broken tests.
Claude TDD Skill
Forces Claude Code to write a failing test before writing any implementation code.
Debugging Wizard
Parses error messages, traces execution flow through stack traces, correlates log entries to identify failure points, and applies systematic hypothesis-driven methodology to isolate and resolve bugs.
Test Master
Generates test files, designs mocking strategies and test architectures, analyzes coverage gaps, and produces test plans and defect reports across functional, performance.