test: rework test expectations (#11824)

This commit is contained in:
Alex Rudenko 2024-02-05 12:04:41 +01:00 committed by GitHub
parent 8a6557c94b
commit 8d7d9f1f05
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 974 additions and 87 deletions

View File

@ -98,6 +98,15 @@ export class TestServer {
// Disable this as sometimes the socket will timeout
// We rely on the fact that we will close the server at the end
this.#server.keepAliveTimeout = 0;
this.#server.on('clientError', err => {
if (
'code' in err &&
err.code === 'ERR_SSL_SSLV3_ALERT_CERTIFICATE_UNKNOWN'
) {
return;
}
console.error('test-server client error', err);
});
this.#wsServer = new WebSocketServer({server: this.#server});
this.#wsServer.on('connection', this.#onWebSocketConnection);
}

File diff suppressed because it is too large Load Diff

View File

@ -590,28 +590,6 @@ describe('Launcher specs', function () {
});
expect(error.message).toContain('either pipe or debugging port');
});
it('should launch Chrome properly with --no-startup-window and waitForInitialPage=false', async () => {
const {defaultBrowserOptions} = await getTestState({
skipLaunch: true,
});
const options = {
waitForInitialPage: false,
// This is needed to prevent Puppeteer from adding an initial blank page.
// See also https://github.com/puppeteer/puppeteer/blob/ad6b736039436fcc5c0a262e5b575aa041427be3/src/node/Launcher.ts#L200
ignoreDefaultArgs: true,
...defaultBrowserOptions,
args: ['--no-startup-window'],
};
const {browser, close} = await launch(options, {
createContext: false,
});
try {
const pages = await browser.pages();
expect(pages).toHaveLength(0);
} finally {
await close();
}
});
});
describe('Puppeteer.launch', function () {