This fixes the compatibility on Vercel with Next.js when it's used in
a serverless function.
Next.js uses https://github.com/vercel/nft to trace down the
dependencies which a serverless function is using which
is currently not capable of detecting the browsers.json in our current
setup. Previously we used require to load the browers.json which was
replaced by readFileSync in #5318. Since then it was broken.
Fixes#5862
We await the predicate now. For synchronous predicates,
nothing should change becase the await will finish before
the next protocol message arrives (thanks to `makeWaitForNextTask`).
Since check/uncheck does click under the hood, sometimes it might
need to click at a different position. One example would be a long
label that contains links inside, and clicking in the center happens
to hit the link instead of the label itself.
This changes the root object from RemoteBrowser to Playwright,
similar to local driver connection. This way, any remote connection
gets a Playwright object.
This also starts reusing PlaywrightServer class, and introduces
`cli run-server` hidden command that runs ws server on the
specified port.
Previous structure:
```
RemoteBrowser
- browser (using ConnectedBrowser for remote-specific behavior)
- selectors (special instance for this remote connection)
```
New structure:
```
Playwright
- ...
- selectors (special instance for this remote connection)
- preLaunchedBrowser (using ConnectedBrowser for remote-specific behavior)
```
This adds a firefox-stable application to build on our bots.
This is basically a rebaselined version of 66541552d0
The firefox base revision is bb9bf7e886
Which is taken from `about://buildconfig` of a stable Firefox version
on Mac as of Apr 9, 2021.
References #5993
This makes it much nicer to use `BrowserType` because it no longer has a template.
Technically a breaking change because of the rare edge case where someone used their own non-browser type inside the template, but I don't consider that intended behavior and think this is fine.