Skip to content

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

test: clean up connect options set for debug controller (#18317)

Pavel Feldmand819f97f4038
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<Fixtures>({
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();
},