Skip to content

Running Tests

Basic Invocation

Run your tests with pytest as usual:

pytest

Screenwright registers itself as a pytest plugin automatically when installed. There is nothing extra to configure.

Report Output

After the test session completes, Screenwright generates two files in the screenwright-report/ directory:

screenwright-report/
  event-stream.json   # Raw event data (every domain event from the session)
  index.html          # Interactive HTML report

Viewing the Report

Open the HTML report in any modern browser:

# macOS
open screenwright-report/index.html

# Linux
xdg-open screenwright-report/index.html

# Windows
start screenwright-report/index.html

The report includes:

  • Feature summary -- pass/fail/skip counts for each feature file
  • Scenario timeline -- a step-by-step narration of each scenario
  • Actor cards -- each Actor's abilities, facts, and actions displayed with persona images
  • Event stream -- the full chronological list of domain events
  • Neon glow aesthetics -- animated transitions and a dark Material Design 3 theme by default

Filtering Tests

You can run a subset of your BDD tests using standard pytest options:

# Run a specific feature
pytest tests/ -k "login"

# Run scenarios with a specific tag
pytest tests/ -m "smoke"

Screenwright will only capture events for the scenarios that actually run.

Disabling the Report

If you want to run tests without generating a report (for example, in a quick feedback loop), you can disable the Screenwright plugin entirely:

pytest -p no:screenwright

Continuous Integration

In CI, you can archive the screenwright-report/ directory as a build artifact. The HTML report is fully self-contained (CSS and JavaScript are inlined), so it works without a web server.

Example for GitHub Actions:

- name: Run tests
  run: pytest

- name: Upload Screenwright report
  uses: actions/upload-artifact@v4
  if: always()
  with:
    name: screenwright-report
    path: screenwright-report/