Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(windows): wait for pipe available again (#993)

Pavel Feldmanf7fb35bdbf40
diff --git a/src/server/webkit.ts b/src/server/webkit.ts
index 28b5fc2b9e..c94ae57ef1 100644
--- a/src/server/webkit.ts
+++ b/src/server/webkit.ts
@@ -22,7 +22,7 @@ import * as types from '../types';
import { WKBrowser } from '../webkit/wkBrowser';
import { execSync } from 'child_process';
import { PipeTransport } from './pipeTransport';
-import { launchProcess } from './processLauncher';
+import { launchProcess, waitForLine } from './processLauncher';
import * as fs from 'fs';
import * as path from 'path';
import * as platform from '../platform';
@@ -97,6 +97,7 @@ export class WebKit implements BrowserType {
handleSIGINT = true,
handleSIGTERM = true,
handleSIGHUP = true,
+ timeout = 30000
} = options;
let temporaryUserDataDir: string | null = null;
@@ -148,6 +149,8 @@ export class WebKit implements BrowserType {
},
});
+ const timeoutError = new TimeoutError(`Timed out after ${timeout} ms while trying to connect to WebKit! The only WebKit revision guaranteed to work is r${this._revision}`);
+ await waitForLine(launchedProcess, launchedProcess.stdout, /^Web Inspector is reading from pipe #3$/, timeout, timeoutError);
transport = new PipeTransport(launchedProcess.stdio[3] as NodeJS.WritableStream, launchedProcess.stdio[4] as NodeJS.ReadableStream);
browserServer = new BrowserServer(launchedProcess, gracefullyClose, launchType === 'server' ? await wrapTransportWithWebSocket(transport, port || 0) : null);
return { browserServer, transport };