Skip to main content

Playwright integration

Watcher integrates with Playwright at three levels. Which level a run gets depends on the script and on your project-local Playwright version. You do not need to edit your Playwright configuration for any of them.

LevelWhenWhat you get
GenericThe script is not a supported playwright test invocation, or you chose Run as Generic package scriptLive logs, status, duration, exit code, Stop Run
BasicA Playwright-aware script with Playwright 1.62 or older, or when Watcher's reporter cannot be resolvedEverything in Generic, plus a planned test count and Run options
EnhancedA Playwright-aware script with Playwright 1.63 or newer and Watcher installed in the projectEverything in Basic, plus live progress counters, active tests, per-test results in history, and report and artifact references

Planned test count (Basic and Enhanced)​

Before a Playwright-aware run, Watcher asks the project-local Playwright CLI to list the tests the run would execute. It uses your original config and the script's selection options, writes the listing to a temporary directory outside your project, and removes it afterwards. The result is shown as Planned Tests.

If collection fails or times out, the run can still start; the planned count is shown as unavailable with a reason.

How Enhanced integration works​

For a Playwright-aware run on Playwright 1.63 or newer, Watcher adds one option to the command it starts:

--add-reporter=@elixir-nexus/watcher/reporter

Playwright's --add-reporter option appends a reporter to those already in your configuration, so your HTML, JSON, JUnit, Allure, Monocart or custom reporters keep running exactly as before. Watcher never uses --reporter, which would replace them, and never edits your config or scripts.

During the run, the reporter sends progress events to Watcher over a private connection on 127.0.0.1 that is authenticated for that run only.

Enhanced mode becomes active only once Watcher receives valid events from its reporter during the run.

Outside Watcher, the reporter does nothing​

When you run Playwright yourself, from a terminal or in CI, Watcher's reporter is not added. Even if you list it in your config manually, it stays inactive outside a Watcher-started run.

Before starting: reporter check​

Before adding the reporter, Watcher checks that @elixir-nexus/watcher/reporter can be resolved from your project root. If it cannot, for example because Watcher is installed globally rather than in the project, Watcher skips the reporter and shows Basic fallback with the reason and the install command:

npm install --save-dev @elixir-nexus/watcher

Playwright 1.62 and older​

Older versions stay in Basic mode. Planned tests, live logs, duration, status and Stop Run remain available; automatic structured progress requires Playwright 1.63 or newer.