playwright

Improve Playwright E2E test reliability for Next.js applications.

Updated Apr 9, 2026
One-click install
npx skills add https://github.com/remiconnesson/insights-garden --skill playwright-remiconnesson
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: playwright
Source: https://github.com/remiconnesson/insights-garden/tree/main/.agents/skills/playwright
Command: npx skills add https://github.com/remiconnesson/insights-garden --skill playwright-remiconnesson

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve?

This Skill reduces flaky, slow, and hard-to-maintain end-to-end testing work for Next.js applications by giving you practical Playwright best practices that improve reliability, speed, and debugging clarity.

Core Features & Use Cases

  • Selector Strategy: Choose stable locators such as roles, labels, text, and test IDs instead of brittle CSS or XPath.
  • Test Reliability: Replace hard waits with web-first assertions, proper navigation waits, and isolation patterns that reduce flakiness.
  • Auth and State Management: Reuse storage state, handle session storage, and scope credentials for roles and parallel workers.
  • Network and Performance Control: Mock APIs, intercept responses, replay HAR files, and tune retries, sharding, and browser selection.
  • Next.js-Specific Coverage: Validate App Router navigation, hydration, server components, and server actions through realistic E2E flows.
  • Use Case: If your login tests are unstable and slow in CI, this Skill helps you refactor them into isolated, production-like Playwright checks with reusable auth and better selectors.

Quick Start

Ask the assistant to review your Next.js Playwright tests and suggest concrete improvements for selectors, waiting, authentication, mocking, and CI stability.

Frequently Asked Questions about playwright

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

FAQPage Schema
How do I fix flaky Playwright tests in my Next.js CI pipeline?

Fix flaky Playwright tests by replacing hard waits with web-first assertions, using role-based locators, and isolating test state. This Skill guides refactoring unstable E2E checks into reliable, production-like flows with proper navigation waits and trace-based failure analysis.

What are the best selectors to use for Playwright E2E testing?

The best Playwright selectors are stable locators like roles, labels, text, and data-testid attributes. This approach avoids brittle CSS or XPath selectors, ensuring your E2E tests remain maintainable and resistant to UI changes.

How do I reuse authentication state across parallel Playwright workers?

Reuse authentication in Playwright by saving and loading storage state, handling session storage, and scoping credentials for different roles. This Skill provides patterns to isolate auth flows and speed up parallel execution without redundant logins.

How do I test Next.js App Router hydration and server components with Playwright?

Test Next.js App Router hydration and server components by writing realistic E2E flows that validate navigation and hydration states. This Skill covers specific patterns for checking server actions and ensuring proper hydration behavior during automated testing.

Can I mock API responses and replay network traffic in Playwright?

Yes, you can mock APIs, intercept network responses, and replay HAR files in Playwright. This Skill explains how to control network and performance conditions to stabilize your E2E test environment and simulate various backend scenarios.

Why should I use web-first assertions instead of hard waits in Playwright?

Web-first assertions automatically retry until the condition is met, eliminating race conditions that cause flaky tests. This Skill shows how replacing hard waits with web-first assertions and proper isolation patterns significantly improves Playwright test reliability.