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(); },