Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix: restore support for slowmo connect option (#9038)
Yury Semikhatsky9b0e0c22735f
diff --git a/src/client/browserType.ts b/src/client/browserType.tsindex b16ba9d822..49860a6c74 100644--- a/src/client/browserType.ts+++ b/src/client/browserType.ts@@ -131,7 +131,7 @@ export class BrowserType extends ChannelOwner<channels.BrowserTypeChannel, channreturn 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);diff --git a/tests/browsertype-connect.spec.ts b/tests/browsertype-connect.spec.tsindex 301bf28f14..339ef0f54f 100644--- a/tests/browsertype-connect.spec.ts+++ b/tests/browsertype-connect.spec.ts@@ -149,6 +149,17 @@ test('should send default User-Agent header with connect request', async ({browsexpect(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();