Skip to main content
skill CX Codex

playwright-testing · laurigates — Claude Code skill: setup and features

The playwright-testing skill guides Playwright E2E work for web apps, including browser coverage, mobile viewports, API checks, and visual snapshots.

MIT 106 installs ★ 60 updated 2026-11-16

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add laurigates/claude-plugins --skill playwright-testing -a claude-code
Open on GitHub

What playwright-testing does

The skill helps an agent build Playwright end-to-end tests for web applications. It covers Chromium, Firefox, and WebKit, locator-based interactions, assertions, network mocking, visual regression, and mobile emulation. Its scope is browser testing rather than unit tests or API-contract checks alone.

The included guidance covers project setup, browser installation, full-suite and single-file runs, headed and debug modes, code generation, reports, and traces. A playwright.config.ts file can define the test directory, baseURL, timeout, browser projects, and trace behavior. The browsers must be installed first with bunx playwright install, or the test run cannot launch them.

What it helps with

  • write an end-to-end login flow
  • check a UI in Chromium, Firefox, and WebKit
  • capture and refresh visual snapshots
  • emulate a mobile viewport
  • inspect a failing run with a trace

Example prompts for the agent

  • Write a Playwright E2E test for the login flow in tests/login.spec.ts and verify the redirect to /dashboard.
  • Set up Playwright for Chromium and add a visual snapshot check for the page.
  • Run bunx playwright test --trace on --reporter=line and diagnose the failing test.

How to install playwright-testing

1Skills CLI (Vercel)

npx skills add laurigates/claude-plugins --skill playwright-testing -a claude-code

2Manually: put the files in place

~/.claude/skills/playwright-testing/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/playwright-testing/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about playwright-testing

How do I install playwright-testing in Claude Code?

Run npx skills add laurigates/claude-plugins --skill playwright-testing -a claude-code. The skill file will be placed at ~/.claude/skills/playwright-testing/SKILL.md.

What does playwright-testing do?

It helps an agent create and run Playwright E2E tests for web applications. The guidance includes cross-browser checks, visual regression, API testing, and mobile emulation.

What must be installed before the tests can run?

The project needs Playwright and its browser binaries. Use bunx playwright install; on Linux, system dependencies can be added with bunx playwright install --with-deps.

Source text

SKILL.md · MIT
---
created: 2025-12-16
modified: 2026-11-14
reviewed: 2025-12-16
name: playwright-testing
description: "Playwright E2E testing — cross-browser, visual regression, API testing, mobile emulation. Use when writing E2E tests or setting up automated UI testing for web apps."
user-invocable: false
allowed-tools: Glob, Grep, Read, Bash(bunx playwright test *), Bash(bunx playwright show-report *), Bash(bunx playwright show-trace *), Edit, Write, TodoWrite, WebFetch, WebSearch
---

# Playwright Testing

Playwright is a modern end-to-end testing framework for web applications. It provides reliable, fast, and cross-browser testing with excellent developer experience.

## When to Use This Skill

| Use this skill when... | Use another skill instead when... |
|------------------------|----------------------------------|
| Writing E2E browser tests | Writing unit tests (use vitest-testing) |
| Testing across Chromium, Firefox, WebKit | Testing Python code (use python-testing) |
| Setting up visual regression testing | Analyzing test quality (use test-quality-analysis) |
| Mocking network requests in E2E tests | Generating property-based tests (use property-based-testing) |
| Testing mobile viewports | Testing API contracts only (use api-testing) |

## Core Expertise

- **Cross-browser**: Test on Chromium, Firefox, WebKit (Safari)
- **Reliable**: Auto-wait, auto-retry, no flaky tests
- **Fast**: Parallel execution, browser context isolation
- **Modern**: TypeScript-first, async/await, auto-complete
- **Multi-platform**: Windows, macOS, Linux

## Installation

```bash
bun create playwright                  # Initialize (recommended)
bun add --dev @playwright/test         # Or install manually
bunx playwright install                # Install browsers
bunx playwright install --with-deps    # With system deps (Linux)
bunx playwright --version              # Verify
```

## Configuration (playwright.config.ts)

```typescript
import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
  testDir: './tests',
  timeout: 30000,
  use: {
    baseURL: 'http://localhost:3000',
    trace: 'on-first-retry',
  },
  projects: [
    {
      name: 'chromium',
      use: { ...devices['Desktop Chrome'] },
    },
  ],
});
```

## Essential Commands

```bash
bunx playwright test                           # Run all tests
bunx playwright test tests/login.spec.ts       # Specific file
bunx playwright test --headed                  # See browser
bunx playwright test --debug                   # Debug mode
bunx playwright test --project=chromium        # Specific browser
bunx playwright test --ui                      # UI mode
bunx playwright codegen http://localhost:3000  # Record tests
bunx playwright show-report                    # Last report
bunx playwright show-trace trace.zip           # Trace viewer
bunx playwright test --update-snapshots        # Update snapshots
```

## Writing Tests

### Basic Test Structure

```typescript
import { test, expect } from '@playwright/test';

test('basic test', async ({ page }) => {
  await page.goto('https://example.com');
  await expect(page).toHaveTitle(/Example/);
});

test.describe('login flow', () => {
  test('should login successfully', async ({ page }) => {
    await page.goto('/login');
    await page.fill('input[name="email"]', '[email protected]');
    await page.fill('input[name="password"]', 'password123');
    await page.click('button[type="submit"]');
    await expect(page).toHaveURL('/dashboard');
  });
});
```

### Selectors and Locators

```typescript
// Text/Role selectors (recommended)
await page.getByText('Sign in').click();
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByLabel('Email').fill('[email protected]');
await page.getByPlaceholder('Enter your name').fill('John');
await page.getByTestId('login-button').click();

// CSS/XPath selectors
await page.locator('.button-primary').click();
await page.locator('xpath=//button[text()="Submit"]').click();

// Chaining
await page.locator('.card').filter({ hasText: 'Product' }).getByRole('button').click();
```

### Key Assertions

| Assertion | Description |
|-----------|-------------|
| `toHaveTitle(title)` | Page title |
| `toHaveURL(url)` | Page URL |
| `toBeVisible()` | Element visible |
| `toBeEnabled()` | Element enabled |
| `toHaveText(text)` | Element text |
| `toContainText(text)` | Partial text |
| `toHaveAttribute(name, value)` | Attribute value |
| `toHaveClass(class)` | CSS class |
| `toHaveValue(value)` | Input value |
| `toBeEmpty()` | Empty input |
| `toHaveCount(n)` | Element count |
| `not.toBeDisabled()` | Negation |

## Agentic Optimizations

| Context | Command |
|---------|---------|
| Quick test | `bunx playwright test --reporter=line --bail` |
| CI test | `bunx playwright test --reporter=github` |
| Single browser | `bunx playwright test --project=chromium --reporter=line` |
| Debug failing | `bunx playwright test --trace on --reporter=line` |
| Headed debug | `bunx playwright test --headed --debug` |

For detailed examples, advanced patterns, and best practices, see [REFERENCE.md](REFERENCE.md).

Testing a WebGL app (CesiumJS, three.js, MapLibre) on a GPU-less CI runner: see [WebGL Apps in GPU-less CI](REFERENCE.md#webgl-apps-in-gpu-less-ci) for the SwiftShader flags, the lhci `chromeFlags` string trap, and frame-rate capping.

## References

- Official docs: https://playwright.dev
- Configuration: https://playwright.dev/docs/test-configuration
- API reference: https://playwright.dev/docs/api/class-test
- Best practices: https://playwright.dev/docs/best-practices
- CI/CD: https://playwright.dev/docs/ci
- Trace viewer: https://playwright.dev/docs/trace-viewer

© laurigates · MIT · laurigates/claude-plugins

Similar skills

All skills for Testing and QA →

playwright-testing by other authors comes first.

playwright-testing alinaqi playwright-testing — a Playwright E2E skill: page objects, a locator order that starts with roles, and a config running chromium, firefox, webkit plus mobile viewports. CX Codex +1 3,400installs e2e-playwright-testing Agent Skills Contributors e2e-playwright-testing is a Claude Code skill for writing and reviewing Playwright end-to-end tests. It activates for browser flows, form checks, and files under tests/e2e/. CX Codex +1 880installs playwright-e2e-testing fugazi playwright-e2e-testing — a skill for writing and maintaining Playwright E2E specs in TypeScript: user flows, forms, auth, API mocking and visual comparisons. CX Codex +1 642installs playwright-blazor-testing Aaronontheweb playwright-blazor-testing — a skill that walks your agent through Playwright end-to-end tests for Blazor Server and WebAssembly: navigation, forms, auth, selectors. CX Codex +1 571installs playwright-expert carlrannaberg playwright-expert — a subagent for end-to-end tests on Playwright: multi-browser runs, page objects, screenshot diffs and mocked requests. CX Codex ★ 763repo stars playwright-visual-testing bradtaylorsf playwright-visual-testing — a skill providing Playwright visual regression testing patterns. Helps agents configure screenshot assertions, mask dynamic elements, and handle responsive snapshots in CI. CX Codex +1 1installs playwright-api-testing-cursorrules-prompt-file PatrickJS playwright-api-testing-cursorrules-prompt-file configures Cursor to generate Playwright API tests using pw-api-plugin. It helps test status codes and validate response schemas with Zod. CX Codex +1 ★ 41,178repo stars

From the same set27

The whole set →
git-commit-workflow The git-commit-workflow Claude Code skill defines commit-message and staging rules. It helps split related edits into focused commits and review staged changes. CX Codex +1 161installs binary-analysis binary-analysis guides your coding agent in inspecting unknown binaries, running hex dumps, and extracting embedded artifacts. CX Codex +1 146installs shell-expert shell-expert is a Claude Code skill for writing Bash, zsh, and POSIX scripts and composing command-line automation. It activates for shell pipelines and portable scripting tasks. CX Codex +1 141installs rust-development A Rust development skill covering Cargo, ownership, async code, and Tokio. It fits coding tasks that mention Rust or its core tooling. CX Codex +1 108installs clippy-advanced clippy-advanced guides Clippy setup for Rust projects: custom lints, clippy.toml thresholds, suppression rules, and CI check commands. CX Codex +1 107installs api-testing api-testing — a skill for writing REST and GraphQL API tests with Supertest (TypeScript) and httpx/pytest (Python). Validates status codes, response schemas, auth flows, and error handling. CX Codex +1 106installs cargo-nextest This Claude Code skill runs and filters Rust tests with cargo-nextest. It comes into play for test runs, CI setup, and investigations into slow or flaky tests. CX Codex +1 101installs bevy-game-engine bevy-game-engine guides AI coding assistants through building Rust games with Bevy, covering ECS setup, rendering, input, and assets. CX Codex +1 3installs

Project sponsors

Companies that keep this analytics open