Reporters & Scripts

The package is composed of a core Pytest plugin and a set of CLI scripts for processing and visualizing the collected data.

The Core Plugin

The main logic resides in plugin.py, which integrates with the Pytest lifecycle via standard hooks.

How it Works

  • Hook-Driven: It uses Pytest hooks like pytest_runtest_makereport, pytest_runtest_protocol, and pytest_sessionfinish to track test execution.
  • Data Collection: It captures comprehensive metadata for each test, including status, duration, retries, steps (via pulse_step), errors, console output (stdout/stderr), and tags.
  • Attachment Handling: During test execution, the plugin automatically processes attachments from pytest-playwright. It copies screenshots, videos, and traces into the pulse-report/attachments/ directory.
  • xdist Support: The plugin is fully compatible with pytest-xdist. When running in parallel, workers save partial results to hidden shard files, which the master node automatically merges at the end of the session.
  • JSON Output: At the end of the run, it generates a master playwright-pulse-report.json file that serves as the data source for all reports.

Command-Line Scripts

These scripts transform the raw JSON data into viewable reports. They are available globally after installing the package via pip.

✨ Automatic Path Detection: All CLI scripts automatically read configuration from your pytest.ini file if present.

generate-pulse-report

  • Purpose: Creates a fully self-contained static HTML report with embedded attachments.
  • Basic Command: generate-pulse-report
  • Manual Override: generate-pulse-report --outputDir ./custom-folder
  • Output: [outputDir]/playwright-pulse-static-report.html

generate-report

  • Purpose: Creates a dynamic HTML dashboard that loads attachments from the attachments/ folder (best for local debugging).
  • Basic Command: generate-report
  • Output: [outputDir]/playwright-pulse-report.html

merge-pulse-report

  • Purpose: Manually merges shard results (from different CI machines) into a single master JSON.
  • Basic Command: merge-pulse-report

send-email

  • Purpose: Generates and distributes a lightweight summary report via email.
  • Basic Command: send-email

Optional CLI Scripts

These utilities are often called automatically by the main scripts but can be used standalone.

generate-trend

  • Purpose: Archives the current run's data to enable historical trend analysis.
  • Basic Command: generate-trend

generate-email-report

  • Purpose: Generates the email summary HTML file without actually sending the email.
  • Basic Command: generate-email-report