- Home
- Skills
- D Oit
- Do Novelist Ai
- E2e Test Optimizer
e2e-test-optimizer_skill
- TypeScript
0
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill d-oit/do-novelist-ai --skill e2e-test-optimizer- SKILL.md5.2 KB
Overview
This skill optimizes Playwright end-to-end tests by removing waitForTimeout anti-patterns, introducing smart waits, and enabling test sharding for parallel CI execution. It reduces flakiness, shortens CI runtime, and standardizes element selection and test structure. The goal is reliable tests that complete within CI time limits.
How this skill works
The tool scans test files for waitForTimeout occurrences, prioritizes files by frequency, and replaces arbitrary sleeps with smart waits (visibility, networkidle, or specific state checks). It provides patterns for navigation, state transitions, and network waits, and offers a recipe to add GitHub Actions matrix-based sharding for parallel execution. A recommended workflow guides per-file fixes, local validation, CI sharding setup, and performance validation.
When to use it
- E2E tests failing or timing out due to arbitrary waits
- CI builds exceed acceptable duration (e.g., >10 minutes)
- High test flakiness caused by race conditions or brittle waits
- Need to parallelize tests to shorten feedback loops
- When mock setup overhead slows test startup
Best practices
- Prefer data-testid for stable selectors; use role+name for accessible selectors
- Replace waitForTimeout with expect(...).toBeVisible / not.toBeVisible or page.waitForLoadState('networkidle')
- Fix highest-occurrence files first and run tests per-file before committing
- Shard tests in CI with a matrix strategy and verify shard balance (±2 minutes)
- Increase per-operation timeouts only when necessary (e.g., expect(...,{timeout:10000}))
Example use cases
- Convert 200+ arbitrary waits to smart waits to eliminate intermittent failures
- Add 3-way test sharding in CI to reduce total E2E time from ~27 to ~9–10 minutes
- Restructure slow mock initialization and implement global browser warm-up to cut setup time
- Prioritize and fix the top 5 files that contain most waitForTimeout instances to rapidly improve reliability
- Use grep detection to generate a remediation plan and track zero waitForTimeout goal
FAQ
No—smart waits explicitly wait for elements, states, or network idle and include adjustable timeouts so tests are resilient across environments.
How do I distribute tests when shards are unbalanced?
Use --grep to move heavy tests manually, or split files with long-running scenarios across different shards to balance execution time.