chore: for Firefox enable only the required protocol (CDP or BiDi) (#12014)

This commit is contained in:
Henrik Skupin 2024-02-28 14:13:12 +01:00 committed by GitHub
parent 7ba5529f8d
commit 1eb6a33aa0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 3 deletions

View File

@ -43,12 +43,17 @@ export class FirefoxLauncher extends ProductLauncher {
return {
...extraPrefsFirefox,
...(protocol === 'webDriverBiDi'
? {}
? {
// Only enable the WebDriver BiDi protocol
'remote.active-protocols': 1,
}
: {
// Do not close the window when the last tab gets closed
'browser.tabs.closeWindowWithLastTab': false,
// Temporarily force disable BFCache in parent (https://bit.ly/bug-1732263)
'fission.bfcacheInParent': false,
// Only enable the CDP protocol
'remote.active-protocols': 2,
}),
// Force all web content to use a single content process. TODO: remove
// this once Firefox supports mouse event dispatch from the main frame

View File

@ -42,7 +42,8 @@ describe('Fixtures', function () {
expect(dumpioData).toContain('message from dumpio');
});
it('should dump browser process stderr', async () => {
const {defaultBrowserOptions, puppeteerPath} = await getTestState();
const {defaultBrowserOptions, isFirefox, puppeteerPath} =
await getTestState();
let dumpioData = '';
const options = Object.assign({}, defaultBrowserOptions, {dumpio: true});
@ -57,7 +58,11 @@ describe('Fixtures', function () {
await new Promise(resolve => {
return res.on('close', resolve);
});
expect(dumpioData).toContain('DevTools listening on ws://');
if (isFirefox && defaultBrowserOptions.protocol === 'webDriverBiDi') {
expect(dumpioData).toContain('WebDriver BiDi listening on ws://');
} else {
expect(dumpioData).toContain('DevTools listening on ws://');
}
});
it('should close the browser when the node process closes', async () => {
const {defaultBrowserOptions, puppeteerPath, puppeteer} =