From d819f97f40386c9bd31a53525240c6e9997a10f4 Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Tue, 25 Oct 2022 12:03:04 -0400 Subject: [PATCH] test: clean up connect options set for debug controller (#18317) --- tests/config/debugControllerBackend.ts | 4 ++++ tests/library/debug-controller.spec.ts | 3 +++ 2 files changed, 7 insertions(+) diff --git a/tests/config/debugControllerBackend.ts b/tests/config/debugControllerBackend.ts index 7fc51f89e9..a018a295de 100644 --- a/tests/config/debugControllerBackend.ts +++ b/tests/config/debugControllerBackend.ts @@ -137,6 +137,10 @@ export class Backend extends EventEmitter { }; } + async close() { + await this._transport.closeAndWait(); + } + async resetForReuse() { await this._send('resetForReuse'); } diff --git a/tests/library/debug-controller.spec.ts b/tests/library/debug-controller.spec.ts index 22caeb4246..5242380705 100644 --- a/tests/library/debug-controller.spec.ts +++ b/tests/library/debug-controller.spec.ts @@ -38,13 +38,16 @@ const test = baseTest.extend({ const backend = new Backend(); await backend.connect(wsEndpoint); await use(backend); + await backend.close(); }, connectedBrowser: async ({ playwright, wsEndpoint }, use) => { + const oldValue = (playwright.chromium as any)._defaultConnectOptions; (playwright.chromium as any)._defaultConnectOptions = { wsEndpoint, headers: { 'x-playwright-reuse-context': '1', }, }; const browser = await playwright.chromium.launch(); + (playwright.chromium as any)._defaultConnectOptions = oldValue; await use(browser as any); await browser.close(); },