Please revisit this issue. The idea is so elegant, and I really don't want to install Node and 3 browsers
Hello everybody, thanks for all the work on Pest v4!
I'm revisiting this issue because, despite it being closed, it seems the original request ("support for external playwright server") wasn't actually implemented in the pest-plugin-browser code, or perhaps I'm missing something in the documentation.
The Context:
The original request (and many Docker setups) aims to keep the PHP container light by NOT installing Node.js/NPM inside it. Ideally, we would run a separate playwright container and tell Pest to connect to it via WebSocket (e.g., ws://playwright:3000), similar to how Laravel Dusk works with Selenium/ChromeDriver.
The Issue:
Looking at the current source code, the ServerManager::playwright() method is hardcoded to always try to spawn a local process:
https://github.com/pestphp/pest-plugin-browser/blob/d07e6ba8978fb6985e165d668e4ecae374cbaa18/src/ServerManager.php#L65C9-L71C11
// ServerManager.php
$this->playwright ??= PlaywrightNpmServer::create(
PackageJsonDirectory::find(),
.'.DIRECTORY_SEPARATOR.'node_modules'.DIRECTORY_SEPARATOR.'.bin'.DIRECTORY_SEPARATOR.'playwright run-server --host %s --port %d --mode launchServer',
$host,
$port,
'Listening on',
);
There is no configuration option or environment variable (like PEST_BROWSER_SERVER_URL) to bypass this local process creation and connect directly to a remote WS endpoint. The withHost() helper mentioned in the resolution seems to configure the target app host or the binding host of the local server, but it doesn't allow connecting to an upstream Playwright server.
Question:
Is there a planned official way to support remote Playwright instances (avoiding Node.js in the PHP container), or is the official stance that Node.js + PHP in the same container is the required architecture for Pest Browser testing?
Originally posted by @yagodecastro in #1587
Please revisit this issue. The idea is so elegant, and I really don't want to install Node and 3 browsers
Originally posted by @yagodecastro in #1587