web icon indicating copy to clipboard operation
web copied to clipboard

[test-runner] Browserless launcher

Open ruud opened this issue 5 years ago • 5 comments

It would be great to be able to use a service like browserless, which uses connect(..) instead of launch(..) for Puppeteer.

const browser = await puppeteer.connect({ browserWSEndpoint: 'ws://localhost:3000' });

ruud avatar Dec 21 '20 14:12 ruud

Playwright can also be used, which used connect(..) instead of launch(..) also:

const browser = await pw.chromium.connect({ browserWSEndpoint: 'ws://localhost:3000', });

ruud avatar Dec 21 '20 14:12 ruud

That's cool, I didn't know about browserless. We should be able to support for headless testing, although opening the browser wouldn't work with this.

LarsDenBakker avatar Dec 22 '20 21:12 LarsDenBakker

I think this would also be useful for running browsers in docker, generally. WTR seems to assume it will always be launching the browser. For consistency in our visual tests, across environments and platforms, we want to run tests in docker. I have a setup working right now where i run everything - WTR, browser, npm etc - in docker. But things would be a simpler if I could instead tell WTR connect to a remote browser instance over a web socket, then i only need a container with chrome, nothing else.

@LarsDenBakker if i were to attempt this, should i be writing a custom BrowserLauncher (but not really a "launcher") that calls puppeteer.connect instead of launch? I could maybe even extend ChromeLauncher, overriding its launchBrowser (again, not really launching)?

WickyNilliams avatar Apr 21 '22 13:04 WickyNilliams

I think this would also be useful for running browsers in docker, generally. WTR seems to assume it will always be launching the browser. For consistency in our visual tests, across environments and platforms, we want to run tests in docker. I have a setup working right now where i run everything - WTR, browser, npm etc - in docker. But things would be a simpler if I could instead tell WTR connect to a remote browser instance over a web socket, then i only need a container with chrome, nothing else.

@LarsDenBakker if i were to attempt this, should i be writing a custom BrowserLauncher (but not really a "launcher") that calls puppeteer.connect instead of launch? I could maybe even extend ChromeLauncher, overriding its launchBrowser (again, not really launching)?

Hey, could you detail how you set up WTR with Docker please ? Thanks!

shainaBk avatar Jan 23 '24 15:01 shainaBk