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

There could be no targets in a freshly created browser.
This commit is contained in:
Dmitry Gozman 2022-08-23 10:25:28 -07:00 committed by GitHub
parent 4d892475da
commit 42491ecc08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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