diff --git a/packages/puppeteer-core/src/bidi/core/Session.ts b/packages/puppeteer-core/src/bidi/core/Session.ts index 3957556c698..4c62004d90c 100644 --- a/packages/puppeteer-core/src/bidi/core/Session.ts +++ b/packages/puppeteer-core/src/bidi/core/Session.ts @@ -7,7 +7,6 @@ import type * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js'; import {EventEmitter} from '../../common/EventEmitter.js'; -import {debugError} from '../../common/util.js'; import { bubble, inertIfDisposed, @@ -52,29 +51,9 @@ export class Session // throw new Error(status.message); // } - let result; - try { - result = ( - await connection.send('session.new', { - capabilities, - }) - ).result; - } catch (err) { - // Chrome does not support session.new. - debugError(err); - result = { - sessionId: '', - capabilities: { - acceptInsecureCerts: false, - browserName: '', - browserVersion: '', - platformName: '', - setWindowRect: false, - webSocketUrl: '', - userAgent: '', - }, - } satisfies Bidi.Session.NewResult; - } + const {result} = await connection.send('session.new', { + capabilities, + }); const session = new Session(connection, result); await session.#initialize(); diff --git a/test/TestExpectations.json b/test/TestExpectations.json index 25fc6571f93..bf06b1e7d2a 100644 --- a/test/TestExpectations.json +++ b/test/TestExpectations.json @@ -1568,6 +1568,13 @@ "expectations": ["SKIP"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, + { + "testIdPattern": "[fixtures.spec] Fixtures should close the browser when the node process closes", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["chrome", "webDriverBiDi"], + "expectations": ["FAIL"], + "comment": "The browser `disconnect` event is not emitted" + }, { "testIdPattern": "[frame.spec] Frame specs Frame Management should click elements in a frameset", "platforms": ["darwin", "linux", "win32"], diff --git a/test/src/fixtures.spec.ts b/test/src/fixtures.spec.ts index 919ffbb5c5a..c8527164e3b 100644 --- a/test/src/fixtures.spec.ts +++ b/test/src/fixtures.spec.ts @@ -101,9 +101,10 @@ describe('Fixtures', function () { wsEndPointCallback(output.substring(0, output.indexOf('\n'))); } }); - using browser = await puppeteer.connect({ + const connectOptions = Object.assign({}, defaultBrowserOptions, { browserWSEndpoint: await wsEndPointPromise, }); + using browser = await puppeteer.connect(connectOptions); const promises = [ waitEvent(browser, 'disconnected'), new Promise(resolve => {