diff --git a/package-lock.json b/package-lock.json index 534c46733..7d3289f6d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ }, "devDependencies": { "@babel/preset-typescript": "^7.23.2", - "@playwright/test": "1.43.0-beta-1711849714000", + "@playwright/test": "1.43.0-beta-1712173949000", "@types/babel__core": "^7.20.3", "@types/babel__helper-plugin-utils": "^7.10.2", "@types/babel__traverse": "^7.20.3", @@ -857,12 +857,12 @@ } }, "node_modules/@playwright/test": { - "version": "1.43.0-beta-1711849714000", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.43.0-beta-1711849714000.tgz", - "integrity": "sha512-icFamqLUxKkoTEPwN+ZNIFWqUQ0WqfP5x8d6hdxZbpDmsngyPfp+J3iYKDmHbFfrLTI4SjW62TaILf/HKLjMfw==", + "version": "1.43.0-beta-1712173949000", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.43.0-beta-1712173949000.tgz", + "integrity": "sha512-heIKFT6u3XZcMcgGTTg0e7I3SkSePBkacxuyZY+Xmcfjv8xTWXQFOOMp1yRgi+PiECZsuWod6g4+pWKbs+UVSg==", "dev": true, "dependencies": { - "playwright": "1.43.0-beta-1711849714000" + "playwright": "1.43.0-beta-1712173949000" }, "bin": { "playwright": "cli.js" @@ -3749,12 +3749,12 @@ } }, "node_modules/playwright": { - "version": "1.43.0-beta-1711849714000", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.43.0-beta-1711849714000.tgz", - "integrity": "sha512-BWA2VqEca1CwDZmxLmwwKI7OuWJBGi+b4RYF3lWwwN/WW5p79HiL6v/U1uB78PGAkRyn7Y6Rwpuhb0GUAnBIPQ==", + "version": "1.43.0-beta-1712173949000", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.43.0-beta-1712173949000.tgz", + "integrity": "sha512-OEIhrg8Aa8/0DYHFu0CT3JWdiUkyFqPwBBsJS+dtwAq5Fjpmn6aX1XPN+YCD1gWZ4/DmNo+y1JNb0cTnRAymHA==", "dev": true, "dependencies": { - "playwright-core": "1.43.0-beta-1711849714000" + "playwright-core": "1.43.0-beta-1712173949000" }, "bin": { "playwright": "cli.js" @@ -3767,9 +3767,9 @@ } }, "node_modules/playwright-core": { - "version": "1.43.0-beta-1711849714000", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.43.0-beta-1711849714000.tgz", - "integrity": "sha512-5o3VhdBqqgks1lJ70Gjyirx1yJtc6wNd+ZM+T4+m3DWwvyN0Ygh9mGv5qdwf3b5sdP3nd/zLO7emUywY4GkhfA==", + "version": "1.43.0-beta-1712173949000", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.43.0-beta-1712173949000.tgz", + "integrity": "sha512-JlixSmWEpDfnw3obp3iKZAYK3yh9AW1Y15R6kZGgtbIioPg0Qyu08TaupIyZm9raVDUcXXElJdOB4GWIlixWFQ==", "dev": true, "bin": { "playwright-core": "cli.js" @@ -5295,12 +5295,12 @@ "optional": true }, "@playwright/test": { - "version": "1.43.0-beta-1711849714000", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.43.0-beta-1711849714000.tgz", - "integrity": "sha512-icFamqLUxKkoTEPwN+ZNIFWqUQ0WqfP5x8d6hdxZbpDmsngyPfp+J3iYKDmHbFfrLTI4SjW62TaILf/HKLjMfw==", + "version": "1.43.0-beta-1712173949000", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.43.0-beta-1712173949000.tgz", + "integrity": "sha512-heIKFT6u3XZcMcgGTTg0e7I3SkSePBkacxuyZY+Xmcfjv8xTWXQFOOMp1yRgi+PiECZsuWod6g4+pWKbs+UVSg==", "dev": true, "requires": { - "playwright": "1.43.0-beta-1711849714000" + "playwright": "1.43.0-beta-1712173949000" } }, "@types/babel__core": { @@ -7315,19 +7315,19 @@ "dev": true }, "playwright": { - "version": "1.43.0-beta-1711849714000", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.43.0-beta-1711849714000.tgz", - "integrity": "sha512-BWA2VqEca1CwDZmxLmwwKI7OuWJBGi+b4RYF3lWwwN/WW5p79HiL6v/U1uB78PGAkRyn7Y6Rwpuhb0GUAnBIPQ==", + "version": "1.43.0-beta-1712173949000", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.43.0-beta-1712173949000.tgz", + "integrity": "sha512-OEIhrg8Aa8/0DYHFu0CT3JWdiUkyFqPwBBsJS+dtwAq5Fjpmn6aX1XPN+YCD1gWZ4/DmNo+y1JNb0cTnRAymHA==", "dev": true, "requires": { "fsevents": "2.3.2", - "playwright-core": "1.43.0-beta-1711849714000" + "playwright-core": "1.43.0-beta-1712173949000" } }, "playwright-core": { - "version": "1.43.0-beta-1711849714000", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.43.0-beta-1711849714000.tgz", - "integrity": "sha512-5o3VhdBqqgks1lJ70Gjyirx1yJtc6wNd+ZM+T4+m3DWwvyN0Ygh9mGv5qdwf3b5sdP3nd/zLO7emUywY4GkhfA==", + "version": "1.43.0-beta-1712173949000", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.43.0-beta-1712173949000.tgz", + "integrity": "sha512-JlixSmWEpDfnw3obp3iKZAYK3yh9AW1Y15R6kZGgtbIioPg0Qyu08TaupIyZm9raVDUcXXElJdOB4GWIlixWFQ==", "dev": true }, "prebuild-install": { diff --git a/package.json b/package.json index 4b57275c0..c127ad85f 100644 --- a/package.json +++ b/package.json @@ -140,7 +140,7 @@ }, "devDependencies": { "@babel/preset-typescript": "^7.23.2", - "@playwright/test": "1.43.0-beta-1711849714000", + "@playwright/test": "1.43.0-beta-1712173949000", "@types/babel__core": "^7.20.3", "@types/babel__helper-plugin-utils": "^7.10.2", "@types/babel__traverse": "^7.20.3", diff --git a/src/playwrightTestServer.ts b/src/playwrightTestServer.ts index 1c8c148a1..4a2d0c04d 100644 --- a/src/playwrightTestServer.ts +++ b/src/playwrightTestServer.ts @@ -213,8 +213,10 @@ export class PlaywrightTestServer { return; const address = await addressPromise; testServer = new TestServerConnection(address); - await testServer.connect(); - await testServer.setSerializer({ serializer: require.resolve('./oopReporter') }); + await testServer.initialize({ + serializer: require.resolve('./oopReporter'), + closeOnDisconnect: true, + }); if (token?.isCancellationRequested) return; @@ -286,9 +288,11 @@ export class PlaywrightTestServer { if (!wsEndpoint) return null; const testServer = new TestServerConnection(wsEndpoint); - await testServer.connect(); - await testServer.setInterceptStdio({ intercept: true }); - await testServer.setSerializer({ serializer: require.resolve('./oopReporter') }); + await testServer.initialize({ + serializer: require.resolve('./oopReporter'), + interceptStdio: true, + closeOnDisconnect: true, + }); return testServer; } diff --git a/src/upstream/testServerConnection.ts b/src/upstream/testServerConnection.ts index 43fe3f206..b4814e182 100644 --- a/src/upstream/testServerConnection.ts +++ b/src/upstream/testServerConnection.ts @@ -66,10 +66,7 @@ export class TestServerConnection implements TestServerInterface, TestServerInte }); const pingInterval = setInterval(() => this._sendMessage('ping').catch(() => {}), 30000); this._connectedPromise = new Promise((f, r) => { - this._ws.addEventListener('open', () => { - f(); - this._ws.send(JSON.stringify({ id: -1, method: 'ready' })); - }); + this._ws.addEventListener('open', () => f()); this._ws.addEventListener('error', r); }); this._ws.addEventListener('close', () => { @@ -78,10 +75,6 @@ export class TestServerConnection implements TestServerInterface, TestServerInte }); } - connect() { - return this._connectedPromise; - } - private async _sendMessage(method: string, params?: any): Promise { const logForTest = (globalThis as any).__logForTest; logForTest?.({ method, params }); @@ -112,8 +105,8 @@ export class TestServerConnection implements TestServerInterface, TestServerInte this._onLoadTraceRequestedEmitter.fire(params); } - async setSerializer(params: { serializer: string; }): Promise { - await this._sendMessage('setSerializer', params); + async initialize(params: Parameters[0]): ReturnType { + await this._sendMessage('initialize', params); } async ping(params: Parameters[0]): ReturnType { @@ -132,10 +125,6 @@ export class TestServerConnection implements TestServerInterface, TestServerInte this._sendMessageNoReply('watch', params); } - async watchTestDir(params: Parameters[0]): ReturnType { - await this._sendMessage('watchTestDir', params); - } - async open(params: Parameters[0]): ReturnType { await this._sendMessage('open', params); } @@ -192,10 +181,6 @@ export class TestServerConnection implements TestServerInterface, TestServerInte this._sendMessageNoReply('stopTests', params); } - async setInterceptStdio(params: Parameters[0]): ReturnType { - await this._sendMessage('setInterceptStdio', params); - } - async closeGracefully(params: Parameters[0]): ReturnType { await this._sendMessage('closeGracefully', params); } diff --git a/src/upstream/testServerInterface.ts b/src/upstream/testServerInterface.ts index 2112f77fc..8b9f5f1fa 100644 --- a/src/upstream/testServerInterface.ts +++ b/src/upstream/testServerInterface.ts @@ -21,7 +21,12 @@ import { JsonEvent } from './teleReceiver'; export type ReportEntry = JsonEvent; export interface TestServerInterface { - setSerializer(params: { serializer: string }): Promise; + initialize(params: { + serializer?: string, + closeOnDisconnect?: boolean, + interceptStdio?: boolean, + watchTestDirs?: boolean, + }): Promise; ping(params: {}): Promise; @@ -29,8 +34,6 @@ export interface TestServerInterface { fileNames: string[]; }): Promise; - watchTestDir(params: {}): Promise; - open(params: { location: reporterTypes.Location }): Promise; resizeTerminal(params: { cols: number, rows: number }): Promise; @@ -90,8 +93,6 @@ export interface TestServerInterface { stopTests(params: {}): Promise; - setInterceptStdio(params: { intercept: boolean }): Promise; - closeGracefully(params: {}): Promise; }