From 4556513c2a5c126dfe2ecb67dac2dc7a92383c5d Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Tue, 3 Mar 2020 16:58:37 -0800 Subject: [PATCH] chore(test): test cleanup (#1198) --- test/browsercontext.spec.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/browsercontext.spec.js b/test/browsercontext.spec.js index 35b5506a76..43ea2999e8 100644 --- a/test/browsercontext.spec.js +++ b/test/browsercontext.spec.js @@ -304,6 +304,14 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, FF expect(allPages).toContain(second); await context.close(); }); + it('should close all belonging pages once closing context', async function({browser}) { + const context = await browser.newContext(); + await context.newPage(); + expect((await context.pages()).length).toBe(1); + + await context.close(); + expect((await context.pages()).length).toBe(0); + }); }); describe('BrowserContext.exposeFunction', () => { @@ -375,7 +383,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, FF expect(allPages).not.toContain(otherPage); await context.close(); }); - it('should not report uninitialized pages', async({browser, server}) => { + it('should report initialized pages', async({browser, server}) => { const context = await browser.newContext(); const pagePromise = new Promise(fulfill => context.once('page', async event => fulfill(await event.page()))); context.newPage(); @@ -390,7 +398,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, FF await evaluatePromise; await context.close(); }); - it('should not crash while redirecting if original request was missed', async({browser, server}) => { + it('should not crash while redirecting of original request was missed', async({browser, server}) => { const context = await browser.newContext(); const page = await context.newPage(); let serverResponse = null; @@ -425,14 +433,6 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, FF expect(await page.opener()).toBe(null); await context.close(); }); - it('should close all belonging targets once closing context', async function({browser}) { - const context = await browser.newContext(); - await context.newPage(); - expect((await context.pages()).length).toBe(1); - - await context.close(); - expect((await context.pages()).length).toBe(0); - }); it('should fire page lifecycle events', async function({browser, server}) { const context = await browser.newContext(); const events = [];