Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(test): test cleanup #1198

Merged
merged 1 commit into from
Mar 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions test/browsercontext.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('Events.BrowserContext.Page', function() {
Expand Down Expand Up @@ -333,7 +341,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();
Expand All @@ -348,7 +356,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;
Expand Down Expand Up @@ -383,14 +391,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 = [];
Expand Down