Skip to content

borghei/Claude-Skills / engineering/playwright-pro

playwright-pro

Verified

End-to-end testing with Playwright: test generation, page objects, locator strategy, flaky- test diagnosis, visual regression, and CI integration. Use when writing E2E tests, fixing flaky tests, or migrating from Cypress/Selenium.

skills/coverage.md

View on GitHub
# Sub-Skill: Test Coverage Analysis

**Parent:** playwright-pro
**Trigger:** "analyze test coverage", "map tests to user flows", "coverage gaps"

## Purpose

Map Playwright tests to user stories and requirements. Identify coverage gaps by comparing what is tested against what should be tested based on critical user flows.

## Workflow

### Step 1: Define User Flows

Enumerate critical user journeys. Each flow has:
- **ID:** Unique identifier (e.g., `AUTH-001`)
- **Name:** Human-readable name (e.g., "User login with email")
- **Priority:** Critical / High / Medium / Low
- **Steps:** Ordered list of user actions

### Step 2: Inventory Tests

Scan the test directory and extract:
- Test file paths and describe block names
- Individual test names
- Page Objects referenced
- URLs navigated to

### Step 3: Map Tests to Flows

Use `coverage_mapper.py` to match tests against flows:
```bash
python scripts/coverage_mapper.py --tests ./tests/e2e/ --flows flows.json
```

Matching heuristics:
- Test name contains flow keywords
- Test navigates to flow-related URLs
- Test uses Page Objects for flow pages
- Test assertions match expected flow outcomes

### Step 4: Identify Gaps

For each critical flow without test coverage:
- Generate a recommended test outline
- Estimate effort to implement
- Prioritize by flow criticality

### Step 5: Report

Output a coverage matrix:

| Flow | Priority | Tests | Status |
|------|----------|-------|--------|
| AUTH-001 Login | Critical | login.spec.ts (3 tests) | Covered |
| AUTH-002 Password reset | Critical | -- | GAP |
| CHECKOUT-001 Purchase | Critical | checkout.spec.ts (5 tests) | Covered |

## Inputs

| Input | Required | Description |
|-------|----------|-------------|
| Test directory | Yes | Path to Playwright test files |
| Flows definition | Yes | JSON file defining critical user flows |

## Outputs

- Coverage matrix (flows vs tests)
- Gap list with recommended test outlines
- Coverage percentage by priority tier
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall