chore(webdriver): don't swallow errors for session.new (#12499)

This commit is contained in:
Nikolay Vitkov 2024-05-29 12:02:06 +02:00 committed by GitHub
parent e2e13eb4f0
commit b3a26f0576
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 25 deletions

View File

@ -7,7 +7,6 @@
import type * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js'; import type * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
import {EventEmitter} from '../../common/EventEmitter.js'; import {EventEmitter} from '../../common/EventEmitter.js';
import {debugError} from '../../common/util.js';
import { import {
bubble, bubble,
inertIfDisposed, inertIfDisposed,
@ -52,29 +51,9 @@ export class Session
// throw new Error(status.message); // throw new Error(status.message);
// } // }
let result; const {result} = await connection.send('session.new', {
try {
result = (
await connection.send('session.new', {
capabilities, 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 session = new Session(connection, result); const session = new Session(connection, result);
await session.#initialize(); await session.#initialize();

View File

@ -1568,6 +1568,13 @@
"expectations": ["SKIP"], "expectations": ["SKIP"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" "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", "testIdPattern": "[frame.spec] Frame specs Frame Management should click elements in a frameset",
"platforms": ["darwin", "linux", "win32"], "platforms": ["darwin", "linux", "win32"],

View File

@ -101,9 +101,10 @@ describe('Fixtures', function () {
wsEndPointCallback(output.substring(0, output.indexOf('\n'))); wsEndPointCallback(output.substring(0, output.indexOf('\n')));
} }
}); });
using browser = await puppeteer.connect({ const connectOptions = Object.assign({}, defaultBrowserOptions, {
browserWSEndpoint: await wsEndPointPromise, browserWSEndpoint: await wsEndPointPromise,
}); });
using browser = await puppeteer.connect(connectOptions);
const promises = [ const promises = [
waitEvent(browser, 'disconnected'), waitEvent(browser, 'disconnected'),
new Promise(resolve => { new Promise(resolve => {