Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: restore support for slowmo connect option #9038

Merged
merged 1 commit into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/client/browserType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
11 changes: 11 additions & 0 deletions tests/browsertype-connect.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down