playwright/test/chromium/browser.spec.js

24 lines
900 B
JavaScript
Raw Normal View History

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
module.exports.describe = function({testRunner, expect, headless, playwright, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('CrBrowser', function() {
it('should close all belonging targets once closing context', async function({browser, newContext}) {
2019-12-19 14:51:49 -08:00
const targets = async () => (await browser.targets()).filter(t => t.type() === 'page');
expect((await targets()).length).toBe(1);
const context = await newContext();
await context.newPage();
expect((await targets()).length).toBe(2);
expect((await context.pages()).length).toBe(1);
await context.close();
expect((await targets()).length).toBe(1);
});
});
};