mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-15 06:02:57 +03:00
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);
|
||||
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 = [];
|
||||
|
Loading…
Reference in New Issue
Block a user