Skip to content

laststance/playwright-requirements

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

playwright-requirements

Visualize Playwright tests as product requirements

Transform npx playwright test --list output into a beautiful, readable requirements document.

Features

  • Smart Display - Deduplicates project/file names, shows hierarchical structure
  • Color Coding - skip = gray, fixme = red, active = green
  • Coverage Summary - Shows total/skip/fixme counts and health percentage
  • Multiple Formats - Terminal (ANSI colors), Markdown, JSON

Installation

npm install -g playwright-requirements
# or
pnpm add -g playwright-requirements

Usage

# Basic usage (terminal output)
npx playwright-requirements

# Short alias
npx pw-req

# Markdown output
npx playwright-requirements --format markdown

# Save to file
npx playwright-requirements --format markdown --output requirements.md

# Filter by project
npx playwright-requirements --project chromium

# Filter by tag
npx playwright-requirements --tag @smoke

# JSON output for programmatic use
npx playwright-requirements --format json

Output Examples

Terminal

╭──────────────────────────────────────────────────────────╮
│  📋 REQUIREMENTS          playwright-requirements        │
╰──────────────────────────────────────────────────────────╯

[unauthenticated]                           19 tests
────────────────────────────────────────────────────────────

  📁 landing.spec.ts

    ▸ Landing Page                          (4 tests)
      ✓ should display landing page with hero
      ✓ should have accessible navigation
      ⊘ should handle 2FA flow               [skip]
      ✗ should recover from OAuth timeout    [fixme]

╭──────────────────────────────────────────────────────────╮
│ Total: 171  ✓ 165  ⊘ 4  ✗ 2   Health: 96.5%              │
╰──────────────────────────────────────────────────────────╯

Markdown

# Requirements

## Summary
| Total | Active | Skip | Fixme | Health |
|-------|--------|------|-------|--------|
| 171   | 165    | 4    | 2     | 🟢 96.5% |

## [unauthenticated] (19 tests)

### 📁 landing.spec.ts

#### Landing Page (4 tests)
- ✅ should display landing page with hero
- ✅ should have accessible navigation
- ⏭️ ~~should handle 2FA flow~~ `[skip]`
- 🔴 should recover from OAuth timeout `[fixme]`

CLI Options

Option Alias Description Default
--format -f Output format: terminal, markdown, json terminal
--tag -t Filter by tag (e.g., @smoke) -
--project -p Filter by project name -
--output -o Output file path stdout
--no-color - Disable colored output false
--config -c Path to Playwright config auto-detect

Programmatic Usage

import {
  parsePlaywrightJSON,
  formatTerminal,
  formatMarkdown,
  filterByTag,
} from 'playwright-requirements'

// Parse Playwright JSON output
const requirements = parsePlaywrightJSON(playwrightJson)

// Filter by tag
const smokeTests = filterByTag(requirements, '@smoke')

// Format as terminal output
console.log(formatTerminal(requirements))

// Format as Markdown
console.log(formatMarkdown(requirements))

License

MIT

About

Visualize Playwright tests as product requirements

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published