Description
Does the upstream have similar features?
playwright-go
is just a community-driven client for playwright. For feature requests, please refer to other officially supported clients first. Nodejs / Java / .Net / Python
Upstream doesn't have such feature, but implementing it in playwright-go might be easier due to the golang ecosystem.
Is your feature request related to a problem? Please describe.
When doing development with playwright-go and testing screenshot difference between CI (usually Linux) and local environment (usually Windows and MacOS). Solution to this is to setup a remote browser solution, but this create additional complexity. It is usually assumed that if things render in one OS, they will render close enough on any other OS.
Describe the solution you'd like
Automate the creation of a browser in a docker container locally and proxy all communication to enable local and CI tests to have the same result. I do have the code to do exactly that using testcontainer-go and goproxy, but before starting a PR, knowing if there is interest and how to shape it would be best.
Additional context
So how it work:
- Create a http proxy on a random port using Go standard http server and goproxy
- Wait for service to start
- Create a container that will idle, but can run playwright node service and will have access to the proxy port
- Exec node and serve browser using launchServer using a set of prefixed port to listen on and with the proper proxy setup (note that testcontainer-go does not allow HostAccessPort during the startup of the container, but they are only accessible during Exec).
- Wait for the websocket port to start answering request
- Use pw.Browser.Connect appropriately.
Overall it is maybe around 100 lines of code, but there is a lot of quirks to know about to get this working. It would be better if this is included in playwright-go directly.
Benefit, 100% pixels match between CI and local as they run in exactly the same environment.