Skip to content

Commit

Permalink
fix(tests): fix test that was leaking a context (#933)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelEinbinder authored Feb 11, 2020
1 parent aae5fca commit 6105d8a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/browser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WE
const page = await browser.newPage();
let error;
await page.context().newPage().catch(e => error = e);
await page.close();
expect(error.message).toContain('Please use browser.newContext()');
});
});
Expand Down
1 change: 1 addition & 0 deletions test/playwright.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ module.exports.describe = ({testRunner, product, playwrightPath}) => {

state.tearDown = async () => {
await Promise.all(contexts.map(c => c.close()));
expect((await state.browser.contexts()).length).toBe(0, `"${test.fullName}" leaked a context`);
if (rl) {
rl.removeListener('line', onLine);
rl.close();
Expand Down

0 comments on commit 6105d8a

Please sign in to comment.