fix: restore support for slowmo connect option (#9038)

This commit is contained in:
Yury Semikhatsky 2021-09-21 09:12:44 -07:00 committed by GitHub
parent 7ec1035b98
commit 9b0e0c2273
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -131,7 +131,7 @@ export class BrowserType extends ChannelOwner<channels.BrowserTypeChannel, chann
return await this._wrapApiCall(async (channel: channels.BrowserTypeChannel) => {
const deadline = params.timeout ? monotonicTime() + params.timeout : 0;
let browser: Browser;
const { pipe } = await channel.connect({ wsEndpoint, headers: params.headers, timeout: params.timeout });
const { pipe } = await channel.connect({ wsEndpoint, headers: params.headers, slowMo: params.slowMo, timeout: params.timeout });
const closePipe = () => pipe.close().catch(() => {});
const connection = new Connection(closePipe);

View file

@ -149,6 +149,17 @@ test('should send default User-Agent header with connect request', async ({brows
expect(request.headers['foo']).toBe('bar');
});
test('should support slowmo option', async ({browserType, startRemoteServer}) => {
const remoteServer = await startRemoteServer();
const browser1 = await browserType.connect(remoteServer.wsEndpoint(), { slowMo: 200 });
const start = Date.now();
await browser1.newContext();
await browser1.close();
console.log(Date.now() - start);
expect(Date.now() - start).toBeGreaterThan(199);
});
test('disconnected event should be emitted when browser is closed or server is closed', async ({browserType, startRemoteServer}) => {
const remoteServer = await startRemoteServer();