2019-12-18 13:28:23 -07:00
|
|
|
// Copyright (c) Microsoft Corporation.
|
|
|
|
// Licensed under the MIT license.
|
|
|
|
|
2019-12-18 17:11:45 -08:00
|
|
|
module.exports.describe = function({testRunner, expect, headless, playwright, FFOX, CHROME, WEBKIT}) {
|
2019-12-18 13:28:23 -07:00
|
|
|
const {describe, xdescribe, fdescribe} = testRunner;
|
|
|
|
const {it, fit, xit} = testRunner;
|
|
|
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
|
|
|
|
2019-12-18 18:07:11 -08:00
|
|
|
describe('CrBrowser', function() {
|
2019-12-18 13:28:23 -07:00
|
|
|
it('should not return child_process for remote browser', async function({browser}) {
|
|
|
|
const browserWSEndpoint = browser.chromium.wsEndpoint();
|
|
|
|
const remoteBrowser = await playwright.connect({browserWSEndpoint});
|
|
|
|
expect(remoteBrowser.process()).toBe(null);
|
|
|
|
remoteBrowser.disconnect();
|
|
|
|
});
|
2019-12-18 18:07:11 -08:00
|
|
|
it('should close all belonging targets once closing context', async function({browser, newContext}) {
|
|
|
|
const targets = async () => (await browser.chromium.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);
|
|
|
|
});
|
2019-12-18 13:28:23 -07:00
|
|
|
});
|
|
|
|
};
|