Skip to content

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

test: unflake "should work with newBrowserCDPSession" (#16765)

Dmitry Gozman42491ecc0867
diff --git a/tests/library/chromium/session.spec.ts b/tests/library/chromium/session.spec.ts
index 4d3a3dec3f..eb611b8cda 100644
--- a/tests/library/chromium/session.spec.ts
+++ b/tests/library/chromium/session.spec.ts
@@ -141,7 +141,9 @@ browserTest('should work with newBrowserCDPSession', async function({ browser })
let gotEvent = false;
session.on('Target.targetCreated', () => gotEvent = true);
await session.send('Target.setDiscoverTargets', { discover: true });
+ const page = await browser.newPage();
expect(gotEvent).toBe(true);
+ await page.close();
await session.detach();
});