playwright

Replaces brittle selectors and timing-dependent waits with deterministic Playwright patterns for Next.js tests.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/moughamir/justwaitit-review --skill playwright-moughamir
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: playwright
Source: https://github.com/moughamir/justwaitit-review/tree/main/.agents/skills/playwright
Command: npx skills add https://github.com/moughamir/justwaitit-review --skill playwright-moughamir

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill eliminates slow, flaky, and brittle Playwright end-to-end tests in Next.js by guiding you toward reliable selector strategies, correct waiting/asset handling, and consistent auth/mocking patterns.

Core Features & Use Cases

  • Stable selectors that reduce flakiness: Prefer role-based locators and data-testid for dynamic UI instead of XPath or fragile CSS paths.
  • Deterministic synchronization: Replace hard waits with actionability-friendly interactions, web-first assertions, hydration-aware strategies, and appropriate network-based waiting.
  • Faster, repeatable test setup: Reuse authentication state via storage state, speed up login via API where possible, and isolate parallel runs with the right context/fixtures.
  • Reliable CI debugging: Capture screenshots/videos/trace artifacts and configure reporters so failures can be diagnosed quickly.
  • Next.js-aware coverage: Validate App Router navigation patterns, Server Components, and Server Actions as end-to-end flows.

Quick Start

Use the playwright skill when your Next.js Playwright suite is flaky, slow, or failing intermittently, and ask it to recommend concrete rule changes for selectors, waiting, auth setup, and CI debugging based on the behavior you’re seeing.

Frequently Asked Questions about playwright

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

FAQPage Schema
Why are my Playwright E2E tests flaky in Next.js and how do I fix brittle selectors?

Flaky Playwright tests in Next.js often stem from brittle XPath or fragile CSS selectors. Replace them with role-based locators and data-testid attributes to target dynamic UI elements deterministically and reduce intermittent failures.

How do I handle authentication state reuse in Playwright to speed up test runs?

Speed up Playwright runs by reusing authentication state via storage state files. You can also bypass UI login by authenticating through the API directly, isolating parallel test execution with dedicated browser contexts and fixtures.

What is the best way to wait for Next.js hydration and dynamic UI in Playwright tests?

Replace hard waits with deterministic synchronization by using Playwright web-first assertions and actionability checks. For Next.js hydration and dynamic content, rely on network-based waiting and hydration-aware strategies instead of fixed delays.

How do I debug failing Playwright tests in CI for a Next.js application?

Debug failing Playwright tests in CI by configuring reporters to capture screenshots, videos, and trace artifacts. Reviewing these artifacts alongside Next.js App Router navigation logs allows you to quickly triage and resolve intermittent test failures.

Does this approach work for testing Next.js Server Components and Server Actions?

Yes, this approach validates Next.js App Router navigation patterns, Server Components, and Server Actions as end-to-end flows. It applies deterministic testing patterns to ensure these specific Next.js architectural elements function reliably under test.

How do I stop Playwright tests from timing out during API mocking and interception?

Stop Playwright API mocking timeouts by replacing timing-dependent waits with appropriate network-based waiting. Ensure your test synchronization aligns with intercepted network requests and API responses using web-first assertions.