-
Notifications
You must be signed in to change notification settings - Fork 291
Enable Support for WebDriver-Bidi in Firefox #619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -100,16 +100,41 @@ export const startBrowsers = async ({ | |
| ); | ||
| const wsEndpoints = browsers.map((browser) => browser.wsEndpoint()); | ||
| saveWsEndpoints(wsEndpoints); | ||
| browsers.forEach((browser) => browser.disconnect()); | ||
| return browsers; | ||
| }; | ||
|
|
||
| export const closeBrowsers = async ( | ||
| config: JestPuppeteerConfig, | ||
| browsers: Browser[], | ||
| ) => { | ||
| await Promise.all( | ||
| browsers.map(async (browser) => closeBrowser(config, browser)), | ||
| ); | ||
| if (config.connect) { | ||
| await Promise.all( | ||
| browsers.map(async (browser) => closeBrowser(config, browser)), | ||
| ); | ||
| } | ||
|
|
||
| const closeRequests: Promise<void>[] = []; | ||
| const puppeteer = getPuppeteer(); | ||
| const wsEndpoints = readWsEndpoints(); | ||
| while (wsEndpoints.length) { | ||
| const wsEndpoint = wsEndpoints.pop()!; | ||
| closeRequests.push( | ||
| puppeteer | ||
| .connect({ | ||
|
Comment on lines
+123
to
+124
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we connecting into the |
||
| ...(config.launch?.browser === "firefox" && { | ||
| protocol: "webDriverBiDi", | ||
| }), | ||
|
Comment on lines
+125
to
+127
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we have a hack here? |
||
| ...config.connect, | ||
| ...config.launch, | ||
| browserURL: undefined, | ||
| browserWSEndpoint: wsEndpoint, | ||
| }) | ||
| .then((browser) => browser.close()), | ||
| ); | ||
| } | ||
|
Comment on lines
+120
to
+135
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you just do a map instead of doing a loop like that? |
||
| await Promise.all(closeRequests); | ||
| saveWsEndpoints([]); | ||
| }; | ||
|
|
||
| const getWorkerWsEndpoint = (): string => { | ||
|
|
@@ -128,6 +153,7 @@ export const connectBrowserFromWorker = async ( | |
| const wsEndpoint = getWorkerWsEndpoint(); | ||
| const puppeteer = getPuppeteer(); | ||
| return puppeteer.connect({ | ||
| ...(config.launch?.browser === "firefox" && { protocol: "webDriverBiDi" }), | ||
| ...config.connect, | ||
| ...config.launch, | ||
| browserURL: undefined, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why disconnecting directly?