MCPInstall

playwright

Playwright end-to-end tests and flaky-test fixes.

Installs
491
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/pymodel/react-frontend-skills --skill playwright
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads playwright automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Playwright + Next.js Testing Best Practices

Comprehensive testing optimization guide for Playwright with Next.js applications. Contains 45 rules across 8 categories, prioritized by impact to guide reliable, fast, and maintainable E2E tests.

When to Apply

Reference these guidelines when:

  • Writing new Playwright tests for Next.js apps
  • Debugging flaky or failing tests
  • Optimizing test execution speed
  • Setting up authentication state reuse
  • Configuring CI/CD pipelines for testing
  • Testing Server Components and App Router features
  • Reviewing test code for reliability issues

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Test ArchitectureCRITICALarch-
2Selectors & LocatorsCRITICALloc-
3Waiting & AssertionsHIGHwait-
4Authentication & StateHIGHauth-
5Mocking & NetworkMEDIUM-HIGHmock-
6Next.js IntegrationMEDIUMnext-
7Performance & SpeedMEDIUMperf-
8Debugging & CILOW-MEDIUMdebug-

Quick Reference

1. Test Architecture (CRITICAL)

  • arch-test-isolation - Use fresh browser context for each test
  • arch-parallel-execution - Enable parallel test execution
  • arch-page-object-model - Use Page Object Model for complex pages
  • arch-fixtures - Use fixtures for shared setup
  • arch-test-production - Test against production builds
  • arch-cleanup-state - Clean up test state after each test

2. Selectors & Locators (CRITICAL)

  • loc-role-selectors - Use role-based selectors over CSS
  • loc-data-testid - Use data-testid for dynamic elements
  • loc-label-selectors - Use getByLabel for form inputs
  • loc-text-selectors - Use getByText for static content
  • loc-avoid-xpath - Avoid XPath selectors
  • loc-chained-locators - Chain locators for specificity
  • loc-placeholder-selector - Use getByPlaceholder sparingly
  • loc-frame-locator - Locate elements inside iframes with frameLocator

3. Waiting & Assertions (HIGH)

  • wait-web-first-assertions - Use web-first assertions
  • assert-aria-snapshots - Assert accessibility structure with aria snapshots
  • wait-avoid-hard-waits - Avoid hard waits
  • wait-network-idle - Wait for observable readiness, not network idle
  • wait-action-retries - Let actions auto-wait before interacting
  • wait-soft-assertions - Use soft assertions for non-critical checks
  • wait-custom-timeout - Configure timeouts appropriately

4. Authentication & State (HIGH)

  • auth-storage-state - Reuse authentication with storage state
  • auth-multiple-roles - Use separate storage states for different roles
  • auth-session-storage - Handle session storage for auth
  • auth-api-login - Use API login for faster auth setup
  • auth-parallel-workers - Use worker-scoped auth for parallel tests

5. Mocking & Network (MEDIUM-HIGH)

  • mock-api-responses - Mock API responses for deterministic tests
  • mock-intercept-modify - Intercept and modify real responses
  • mock-har-files - Use HAR files for complex mock scenarios
  • mock-abort-requests - Abort unnecessary requests
  • mock-network-conditions - Simulate network conditions

6. Next.js Integration (MEDIUM)

  • next-wait-hydration - Wait for hydration before interacting
  • next-server-components - Test server components correctly
  • next-app-router-navigation - Test App Router navigation patterns
  • next-server-actions - Test server actions end-to-end
  • next-baseurl-config - Configure baseURL for clean navigation

7. Performance & Speed (MEDIUM)

  • perf-sharding - Use sharding for large test suites
  • perf-headless-ci - Use headless mode in CI
  • perf-browser-selection - Select browsers strategically
  • perf-reuse-server - Reuse a matching local server when safe
  • perf-retries - Use retries to detect and diagnose flakiness

8. Debugging & CI (LOW-MEDIUM)

  • debug-trace-viewer - Use trace viewer for failed tests
  • debug-screenshots-videos - Capture screenshots and videos on failure
  • debug-inspector - Use Playwright Inspector for interactive debugging
  • debug-ci-reporters - Configure reporters for CI integration

How to Use

Run in the project root first:

npx -y @pymodel/react-frontend-skills detect                   # installed vs. targeted versions
npx -y @pymodel/react-frontend-skills scan --skill playwright  # deprecated APIs → rule IDs

Read references/<rule-id>.md for each rule above that matches the task and for each scan hit: why it matters, then incorrect vs. correct code.

FAQ

What does the playwright skill do?

Playwright end-to-end tests and flaky-test fixes.

How do I install playwright?

Run npx skills add https://github.com/pymodel/react-frontend-skills --skill playwright in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/playwright/ (personal) or .claude/skills/playwright/ (project).

Which AI agents can use playwright?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is playwright safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains playwright?

It is published by pymodel in pymodel/react-frontend-skills. It has 491 recorded installs.

More from pymodel/react-frontend-skills

View all →

react

pymodel/react-frontend-skills

React 19 components and hooks.

Frontend & Design547 installs

ui-design

pymodel/react-frontend-skills

Accessible, responsive frontend UI and UX design.

Frontend & Design526 installs

typescript

pymodel/react-frontend-skills

TypeScript types, tsconfig and TypeScript 7 migration.

tailwind

pymodel/react-frontend-skills

Tailwind CSS v4 styling and configuration.

Frontend & Design518 installs

vitest

pymodel/react-frontend-skills

Vitest 5 unit tests and mocking.

Testing & QA490 installs

zod

pymodel/react-frontend-skills

Zod 4 schema validation and type inference.

Frontend & Design483 installs

Popular testing & qa skills

View category →

tdd

mattpocock/skills

Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.

Testing & QA1.2M installs

grilling

mattpocock/skills

Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.

Testing & QA996.2K installs

migrate-to-shoehorn

mattpocock/skills

Migrate test files from as type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace as in tests, or needs partial test data.

Testing & QA484.1K installs

run-train

lllllllama/rigorpilot-skills

Rigor Train skill for deep learning research repositories. Use when a documented or selected training command should be run conservatively for startup verification, short-run verification, full kickoff, or resume, with command, config, seed, log, checkpoint, status, and metric evidence written to standardized trainoutputs/. Do not use for environment setup, exploratory sweeps, speculative idea implementation, or end-to-end orchestration.

Testing & QA337.8K installs

test-driven-development

obra/superpowers

Use when implementing any feature or bugfix, before writing implementation code

Testing & QA261.8K installs

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work

Testing & QA216.8K installs