e2e-test-optimizer

Replace waitForTimeout anti-patterns with smart waits in Playwright E2E tests.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/d-oit/do-novelist-ai --skill e2e-test-optimizer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: e2e-test-optimizer
Source: https://github.com/d-oit/do-novelist-ai/tree/main/.claude/skills/e2e-test-optimizer
Command: npx skills add https://github.com/d-oit/do-novelist-ai --skill e2e-test-optimizer

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Optimizes Playwright E2E tests by removing waitForTimeout anti-patterns, implementing smart waits, and enabling test sharding for parallel execution.

Core Features & Use Cases

  • Anti-pattern removal: Replace arbitrary waitForTimeout with smart waits.
  • Test sharding: Enable parallel test execution in CI.
  • Mock optimization: Reduce mock setup overhead.

Quick Start

Replace waits with smart waits in tests and enable CI sharding; example commands and changes are provided in the guidance.

Frequently Asked Questions about e2e-test-optimizer

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

FAQPage Schema
How do I fix flaky Playwright E2E tests caused by waitForTimeout?

Replace arbitrary waitForTimeout calls with smart waits that target specific conditions: navigation waits for page loads, state-transition waits for DOM changes, and network waits for API responses. This eliminates flakiness by waiting only as long as needed for the actual event, not a fixed duration.

Can I run Playwright E2E tests in parallel in CI to speed up test suites?

Yes, test sharding enables parallel execution by distributing tests across CI workers. Configure sharding in your CI pipeline to split tests by shard ID and total shard count, reducing total runtime while maintaining test isolation.

What's the best way to reduce Playwright E2E test runtime in CI?

Combine smart waits to eliminate timeout delays, enable test sharding for parallel execution, and optimize mock setups to reduce overhead. Together, these reduce both flakiness and total runtime.

Why do my Playwright tests timeout in CI even though they pass locally?

Arbitrary waitForTimeout durations often mismatch between local and CI environments due to resource differences. Smart waits adapt to actual state changes, eliminating environment-dependent timeouts and improving reliability across all contexts.

Does Playwright support test sharding natively, or do I need additional tools?

Playwright supports test sharding through configuration, but CI integration requires explicit shard setup. This Skill guides CI sharding configuration to parallelize test execution without additional dependencies.

What anti-patterns should I remove from my Playwright E2E tests?

The primary anti-pattern is waitForTimeout with arbitrary durations. Replace these with targeted waits: use waitForNavigation for page navigation, waitForSelector or waitForFunction for DOM state, and network event handling for API calls.