Skip to content

Commit

Permalink
fix(release-1.11): fix tests after cherry-pick
Browse files Browse the repository at this point in the history
  • Loading branch information
aslushnikov committed May 18, 2021
1 parent 97aacf3 commit 6f0923b
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions tests/chromium/chromium.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,31 +245,32 @@ playwrightTest.describe('chromium', () => {
expect(request.headers['foo']).toBe('bar');
}
});
});

playwrightTest('should report all pages in an existing browser', async ({ browserType, browserOptions }, testInfo) => {
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}/`,
playwrightTest('should report all pages in an existing browser', async ({ browserType, browserOptions }, testInfo) => {
const port = 9339 + testInfo.workerIndex;
const browserServer = await browserType.launch({
...browserOptions,
args: ['--remote-debugging-port=' + port]
});
const contexts = cdpBrowser.contexts();
expect(contexts.length).toBe(1);
for (let i = 0; i < 3; i++)
await contexts[0].newPage();
await cdpBrowser.close();
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);
const cdpBrowser2 = await browserType.connectOverCDP({
endpointURL: `http://localhost:${port}/`,
});
expect(cdpBrowser2.contexts()[0].pages().length).toBe(3);

await cdpBrowser2.close();
} finally {
await browserServer.close();
}
await cdpBrowser2.close();
} finally {
await browserServer.close();
}
});
});

0 comments on commit 6f0923b

Please sign in to comment.