fix(tests): fix test that was leaking a context (#933)

This commit is contained in:
Joel Einbinder 2020-02-11 14:15:30 -08:00 committed by GitHub
parent aae5fca237
commit 6105d8a26a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

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

View File

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