test(chromium): add failing test for connecting to a browser with pages (#6502)

This commit is contained in:
Joel Einbinder 2021-05-11 13:04:21 -07:00 committed by GitHub
parent e0aaef5eab
commit 2ea465bc82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -238,3 +238,31 @@ playwrightTest('should send extra headers with connect request', async ({browser
expect(request.headers['foo']).toBe('bar');
}
});
playwrightTest('should report all pages in an existing browser', async ({ browserType, browserOptions }, testInfo) => {
playwrightTest.fail();
const port = 9339 + testInfo.workerIndex;
const browserServer = await browserType.launch({
...browserOptions,
args: ['--remote-debugging-port=' + port]
});
try {
const cdpBrowser = await browserType.connectOverCDP({
endpointURL: `http://localhost:${port}/`,
});
const contexts = cdpBrowser.contexts();
expect(contexts.length).toBe(1);
for (let i = 0; i < 3; i++)
await contexts[0].newPage();
await cdpBrowser.close();
const cdpBrowser2 = await browserType.connectOverCDP({
endpointURL: `http://localhost:${port}/`,
});
expect(cdpBrowser2.contexts()[0].pages().length).toBe(3);
await cdpBrowser2.close();
} finally {
await browserServer.close();
}
});