Files
Charon/.github/skills/test-e2e-playwright-coverage.SKILL.md
akanealw eec8c28fb3
Some checks failed
Go Benchmark / Performance Regression Check (push) Has been cancelled
Cerberus Integration / Cerberus Security Stack Integration (push) Has been cancelled
Upload Coverage to Codecov / Backend Codecov Upload (push) Has been cancelled
Upload Coverage to Codecov / Frontend Codecov Upload (push) Has been cancelled
CodeQL - Analyze / CodeQL analysis (go) (push) Has been cancelled
CodeQL - Analyze / CodeQL analysis (javascript-typescript) (push) Has been cancelled
CrowdSec Integration / CrowdSec Bouncer Integration (push) Has been cancelled
Docker Build, Publish & Test / build-and-push (push) Has been cancelled
Quality Checks / Auth Route Protection Contract (push) Has been cancelled
Quality Checks / Codecov Trigger/Comment Parity Guard (push) Has been cancelled
Quality Checks / Backend (Go) (push) Has been cancelled
Quality Checks / Frontend (React) (push) Has been cancelled
Rate Limit integration / Rate Limiting Integration (push) Has been cancelled
Security Scan (PR) / Trivy Binary Scan (push) Has been cancelled
Supply Chain Verification (PR) / Verify Supply Chain (push) Has been cancelled
WAF integration / Coraza WAF Integration (push) Has been cancelled
Docker Build, Publish & Test / Security Scan PR Image (push) Has been cancelled
Repo Health Check / Repo health (push) Has been cancelled
History Rewrite Dry-Run / Dry-run preview for history rewrite (push) Has been cancelled
Prune Renovate Branches / prune (push) Has been cancelled
Renovate / renovate (push) Has been cancelled
Nightly Build & Package / sync-development-to-nightly (push) Has been cancelled
Nightly Build & Package / Trigger Nightly Validation Workflows (push) Has been cancelled
Nightly Build & Package / build-and-push-nightly (push) Has been cancelled
Nightly Build & Package / test-nightly-image (push) Has been cancelled
Nightly Build & Package / verify-nightly-supply-chain (push) Has been cancelled
Update GeoLite2 Checksum / update-checksum (push) Has been cancelled
Container Registry Prune / prune-ghcr (push) Has been cancelled
Container Registry Prune / prune-dockerhub (push) Has been cancelled
Container Registry Prune / summarize (push) Has been cancelled
Supply Chain Verification / Verify SBOM (push) Has been cancelled
Supply Chain Verification / Verify Release Artifacts (push) Has been cancelled
Supply Chain Verification / Verify Docker Image Supply Chain (push) Has been cancelled
Monitor Caddy Major Release / check-caddy-major (push) Has been cancelled
Weekly Nightly to Main Promotion / Verify Nightly Branch Health (push) Has been cancelled
Weekly Nightly to Main Promotion / Create Promotion PR (push) Has been cancelled
Weekly Nightly to Main Promotion / Trigger Missing Required Checks (push) Has been cancelled
Weekly Nightly to Main Promotion / Notify on Failure (push) Has been cancelled
Weekly Nightly to Main Promotion / Workflow Summary (push) Has been cancelled
Weekly Security Rebuild / Security Rebuild & Scan (push) Has been cancelled
changed perms
2026-04-22 18:19:14 +00:00

5.7 KiB
Executable File

name, version, description, author, license, tags, compatibility, requirements, environment_variables, parameters, outputs, metadata
name version description author license tags compatibility requirements environment_variables parameters outputs metadata
test-e2e-playwright-coverage 1.0.0 Run Playwright E2E tests with code coverage collection using @bgotink/playwright-coverage Charon Project MIT
testing
e2e
playwright
coverage
integration
os shells
linux
darwin
bash
name version optional
node >=18.0 false
name version optional
npx >=1.0 false
name description default required
PLAYWRIGHT_BASE_URL Base URL of the Charon application under test http://localhost:8080 false
name description default required
PLAYWRIGHT_HTML_OPEN Controls HTML report auto-open behavior (set to 'never' for CI/non-interactive) never false
name description default required
CI Set to 'true' when running in CI environment false
name type description default required
project string Browser project to run (chromium, firefox, webkit) chromium false
name type description path
coverage-e2e directory E2E coverage output directory with LCOV and HTML reports coverage/e2e/
name type description path
playwright-report directory HTML test report directory playwright-report/
name type description path
test-results directory Test artifacts and traces test-results/
category subcategory execution_time risk_level ci_cd_safe requires_network idempotent
test e2e-coverage medium low true true true

Test E2E Playwright Coverage

Overview

Runs Playwright end-to-end tests with code coverage collection using @bgotink/playwright-coverage. This skill collects V8 coverage data during test execution and generates reports in LCOV, HTML, and JSON formats suitable for upload to Codecov.

IMPORTANT: This skill starts the Vite dev server (not Docker) because V8 coverage requires access to source files. Running coverage against the Docker container will result in 0% coverage.

Mode Base URL Coverage Support
Docker (localhost:8080) No - Shows "Unknown% (0/0)"
Vite Dev (localhost:5173) Yes - Real coverage data

Prerequisites

  • Node.js 18.0 or higher installed and in PATH
  • Playwright browsers installed (npx playwright install)
  • @bgotink/playwright-coverage package installed
  • Charon application running (default: http://localhost:8080, use docker-rebuild-e2e when app/runtime inputs change or the container is not running)
  • Test files in tests/ directory using coverage-enabled imports

Usage

Basic Usage

Run E2E tests with coverage collection:

.github/skills/scripts/skill-runner.sh test-e2e-playwright-coverage

Browser Selection

Run tests in a specific browser:

# Firefox (default)
.github/skills/scripts/skill-runner.sh test-e2e-playwright-coverage --project=firefox

# Firefox
.github/skills/scripts/skill-runner.sh test-e2e-playwright-coverage --project=firefox

CI/CD Integration

For use in GitHub Actions or other CI/CD pipelines:

- name: Run E2E Tests with Coverage
  run: .github/skills/scripts/skill-runner.sh test-e2e-playwright-coverage
  env:
    PLAYWRIGHT_BASE_URL: http://localhost:8080
    CI: true

- name: Upload E2E Coverage to Codecov
  uses: codecov/codecov-action@v5
  with:
    files: ./coverage/e2e/lcov.info
    flags: e2e

Parameters

Parameter Type Required Default Description
project string No firefox Browser project: chromium, firefox, webkit

Environment Variables

Variable Required Default Description
PLAYWRIGHT_BASE_URL No http://localhost:8080 Application URL to test against
PLAYWRIGHT_HTML_OPEN No never HTML report auto-open behavior
CI No "" Set to "true" for CI environment behavior

Outputs

Success Exit Code

  • 0: All tests passed and coverage generated

Error Exit Codes

  • 1: One or more tests failed
  • Non-zero: Configuration or execution error

Output Directories

  • coverage/e2e/: Coverage reports (LCOV, HTML, JSON)
    • lcov.info - LCOV format for Codecov upload
    • coverage.json - JSON format for programmatic access
    • index.html - HTML report for visual inspection
  • playwright-report/: HTML test report with results and traces
  • test-results/: Test artifacts, screenshots, and trace files

Viewing Coverage Reports

Coverage HTML Report

# Open coverage HTML report
open coverage/e2e/index.html

Playwright Test Report

npx playwright show-report --port 9323

Coverage Data Format

The skill generates coverage in multiple formats:

Format File Purpose
LCOV coverage/e2e/lcov.info Codecov upload
HTML coverage/e2e/index.html Visual inspection
JSON coverage/e2e/coverage.json Programmatic access
  • test-e2e-playwright - E2E tests without coverage
  • test-frontend-coverage - Frontend unit test coverage with Vitest
  • test-backend-coverage - Backend unit test coverage with Go

Notes

  • Coverage Source: Uses V8 coverage (native, no instrumentation needed)
  • Performance: ~5-10% overhead compared to tests without coverage
  • Sharding: When running sharded tests in CI, coverage files must be merged
  • LCOV Merge: Use lcov -a file1.info -a file2.info -o merged.info to merge

Last Updated: 2026-01-18 Maintained by: Charon Project Team