Skip to content

Support remote Playwright server - #307

Open
Propaganistas wants to merge 5 commits into
pestphp:5.xfrom
Propaganistas:support-remote-ws
Open

Propaganistas wants to merge 5 commits into
pestphp:5.xfrom
Propaganistas:support-remote-ws

Conversation

@Propaganistas

@Propaganistas Propaganistas commented Nov 7, 2026 •

Copy link
Copy Markdown

This PR enables the plugin to use remote Playwright servers instead of always spinning up a local one.

On a server / in a Docker container / ... :

npx -y playwright run-server ...

In Pest.php:

pest()->browser()->useWebsocket('ws://127.0.0.1:3000');

OR using CLI

./vendor/bin/pest --ci --ws ws://127.0.0.1:3000

My envisioned use case: leveraging the pre-built mcr.microsoft.com/playwright container and configure it as a service container in a GitHub workflow. This greatly reduces action minutes because browsers don't need to be downloaded in each run anymore. Below is a simplified example:

jobs:
  tests:
    runs-on: ubuntu-latest

    services:
      playwright:
        image: mcr.microsoft.com/playwright:v1.64.1-noble
        ports:
          - 3000:3000
        command: npx -y playwright run-server --port 3000 --host 0.0.0.0

    steps:
        # ...

        - name: Tests
          run: ./vendor/bin/pest --ci --ws ws://127.0.0.1:3000 --...
        

Please review this working POC for the full workflow file: https://github.com/Propaganistas/pest-remote-playwright-poc/blob/master/.github/workflows/test.yml


Disclaimer: this PR was fully coded by AI per explicit instructions. Code quality might be off, but it serves as a proof of concept. Happy to refine the code when interested.

@Propaganistas
Propaganistas marked this pull request as draft November 7, 2026 19:32
@Propaganistas

Copy link
Copy Markdown
Author

Putting in draft; it works for regular remote connections but not yet for containerized servers (the container can't reach the Laravel server yet)

@Propaganistas

Copy link
Copy Markdown
Author

Putting back to ready for review. Working example here:

@Propaganistas
Propaganistas marked this pull request as ready for review November 7, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant