[Feature] Please add support for external playwright server
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 11.7k
- Forks
- 538
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 8
Description
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-browsercode, 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 separateplaywrightcontainer 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, theServerManager::playwright()method is hardcoded to always try to spawn a local process:// 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. ThewithHost()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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/ServerManager.php and its playwright() method, which currently creates a local Playwright process. Trace the browser plugin's server configuration and connection flow to determine where a remote WebSocket endpoint could be accepted. Done means Pest Browser can use an external Playwright server without requiring Node.js in the PHP container.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, playwright
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100