chore(test): test cleanup (#1198)
This commit is contained in:
parent
6c6cdc033b
commit
4556513c2a
|
|
@ -304,6 +304,14 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, FF
|
||||||
expect(allPages).toContain(second);
|
expect(allPages).toContain(second);
|
||||||
await context.close();
|
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', () => {
|
describe('BrowserContext.exposeFunction', () => {
|
||||||
|
|
@ -375,7 +383,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, FF
|
||||||
expect(allPages).not.toContain(otherPage);
|
expect(allPages).not.toContain(otherPage);
|
||||||
await context.close();
|
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 context = await browser.newContext();
|
||||||
const pagePromise = new Promise(fulfill => context.once('page', async event => fulfill(await event.page())));
|
const pagePromise = new Promise(fulfill => context.once('page', async event => fulfill(await event.page())));
|
||||||
context.newPage();
|
context.newPage();
|
||||||
|
|
@ -390,7 +398,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, FF
|
||||||
await evaluatePromise;
|
await evaluatePromise;
|
||||||
await context.close();
|
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 context = await browser.newContext();
|
||||||
const page = await context.newPage();
|
const page = await context.newPage();
|
||||||
let serverResponse = null;
|
let serverResponse = null;
|
||||||
|
|
@ -425,14 +433,6 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, FF
|
||||||
expect(await page.opener()).toBe(null);
|
expect(await page.opener()).toBe(null);
|
||||||
await context.close();
|
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}) {
|
it('should fire page lifecycle events', async function({browser, server}) {
|
||||||
const context = await browser.newContext();
|
const context = await browser.newContext();
|
||||||
const events = [];
|
const events = [];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue