playwright-test-helper

Help write, debug, and optimize Playwright E2E tests — generate page objects, fix flaky selectors, improve test reliability, and speed up test execution.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "playwright-test-helper" with this command: npx skills add charlie-morrison/playwright-test-helper

Playwright Test Helper

Help write, debug, and optimize Playwright end-to-end tests. Generate page object models, fix flaky selectors, improve test reliability, debug failing tests, and speed up test execution. Use when E2E tests are slow, flaky, or hard to maintain.

Usage

"Help me write Playwright tests for the login flow"
"Fix flaky Playwright tests"
"Generate page objects from my app"
"Speed up my Playwright test suite"
"Debug why this Playwright test fails in CI"

How It Works

1. Project Analysis

cat playwright.config.ts 2>/dev/null || cat playwright.config.js 2>/dev/null
find . -name "*.spec.ts" -o -name "*.test.ts" | grep -i "e2e\|playwright" | head -20

2. Test Generation

From page analysis, generate:

  • Page Object Model classes with typed locators
  • Test scenarios covering happy paths
  • Error state tests
  • Accessibility assertions using @axe-core/playwright
  • Visual regression snapshots

3. Flaky Test Diagnosis

Common flakiness causes and fixes:

  • Timing: missing await, race conditions → use waitFor, expect().toBeVisible()
  • Selectors: text content changes, dynamic IDs → use data-testid, role selectors
  • State: test order dependency → proper setup/teardown, isolated contexts
  • Network: slow API responses → use route mocking, waitForResponse
  • CI-specific: different viewport, fonts, timing → configure CI-specific settings

4. Performance Optimization

  • Parallel test execution (fullyParallel: true)
  • Browser reuse across test files
  • Storage state for authenticated tests (avoid re-login)
  • Route mocking for slow/flaky external APIs
  • Selective test running with tags/grep

5. Best Practices

  • Use web-first assertions (expect(locator).toBeVisible())
  • Prefer user-facing selectors (role, text, label)
  • Avoid page.waitForTimeout() — use proper waits
  • Keep tests independent (no shared state between tests)
  • Use test fixtures for common setup

Output

## Playwright Test Analysis

**Test files:** 23 | **Total tests:** 89 | **Avg duration:** 4.2s

### 🔴 Flaky Tests (4)
1. checkout.spec.ts:45 — "processes payment"
   Flaky because: `click('Submit')` before button enabled
   Fix: `await expect(submitBtn).toBeEnabled(); await submitBtn.click()`

2. search.spec.ts:12 — "shows results"
   Flaky because: `page.waitForTimeout(2000)` for API
   Fix: `await page.waitForResponse('**/api/search**')`

### ⚡ Speed Improvements
- Enable fullyParallel: ~45% time reduction
- Add storageState for 15 auth-dependent tests: save 30s
- Mock /api/analytics for all tests: remove 800ms/test

### 📊 Projected: 6m 15s → 2m 20s (63% faster)

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Security

Test Master

Use when you need a practical testing playbook for turning product or code changes into a clear test strategy, test cases, and execution checklist.

Registry SourceRecently Updated
1040Profile unavailable
Automation

Playwright Browser Automation

使用 Playwright 库实现快速、可靠的多浏览器页面自动化,支持截图、网络拦截和元素智能等待操作。

Registry SourceRecently Updated
5840Profile unavailable
Automation

AgentGo Cloud Browser

Automates browser interactions using AgentGo's distributed cloud browser cluster via playwright@1.51.0. Use when the user needs to navigate websites, interac...

Registry SourceRecently Updated
3830Profile unavailable
Automation

AutoClaw Browser Automation

Complete browser automation skill with MCP protocol support and Chrome extension

Registry SourceRecently Updated
1.1K0Profile unavailable