From 52777c4888551f613c86bf4b9e7d888509cb6c53 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Wed, 18 Dec 2019 12:20:18 -0800 Subject: [PATCH] tests: move ws-specific browser tests to corrsponding browser suites --- test/browser.spec.js | 6 ------ test/chromium/browser.spec.js | 31 +++++++++++++++++++++++++++++++ test/chromium/chromium.spec.js | 9 +++++++++ test/firefox/browser.spec.js | 31 +++++++++++++++++++++++++++++++ test/playwright.spec.js | 8 +++++++- 5 files changed, 78 insertions(+), 7 deletions(-) create mode 100644 test/chromium/browser.spec.js create mode 100644 test/firefox/browser.spec.js diff --git a/test/browser.spec.js b/test/browser.spec.js index c0c2fd0561..8adc0c1dd6 100644 --- a/test/browser.spec.js +++ b/test/browser.spec.js @@ -49,11 +49,5 @@ module.exports.addTests = function({testRunner, expect, headless, playwright, FF const process = await browser.process(); expect(process.pid).toBeGreaterThan(0); }); - it.skip(WEBKIT || FFOX)('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(); - }); }); }; diff --git a/test/chromium/browser.spec.js b/test/chromium/browser.spec.js new file mode 100644 index 0000000000..789c4af65a --- /dev/null +++ b/test/chromium/browser.spec.js @@ -0,0 +1,31 @@ +/** + * Copyright 2018 Google Inc. All rights reserved. + * Modifications copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +module.exports.addTests = function({testRunner, expect, headless, playwright, FFOX, CHROME, WEBKIT}) { + const {describe, xdescribe, fdescribe} = testRunner; + const {it, fit, xit} = testRunner; + const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; + + describe('Browser.process', function() { + 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(); + }); + }); +}; diff --git a/test/chromium/chromium.spec.js b/test/chromium/chromium.spec.js index 0459f583a1..934496a3dd 100644 --- a/test/chromium/chromium.spec.js +++ b/test/chromium/chromium.spec.js @@ -36,6 +36,15 @@ module.exports.addTests = function({testRunner, expect, playwright, FFOX, CHROME }); }); + describe('Browser.process', function() { + fit('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(); + }); + }); + describe('Target', function() { it('Chromium.targets should return all of the targets', async({page, server, browser}) => { // The pages will be the testing page and the original newtab page diff --git a/test/firefox/browser.spec.js b/test/firefox/browser.spec.js new file mode 100644 index 0000000000..e43691385f --- /dev/null +++ b/test/firefox/browser.spec.js @@ -0,0 +1,31 @@ +/** + * Copyright 2018 Google Inc. All rights reserved. + * Modifications copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +module.exports.addTests = function({testRunner, expect, headless, playwright, FFOX, CHROME, WEBKIT}) { + const {describe, xdescribe, fdescribe} = testRunner; + const {it, fit, xit} = testRunner; + const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; + + describe('Browser.process', function() { + it('should not return child_process for remote browser', async function({browser}) { + const browserWSEndpoint = browser.firefox.wsEndpoint(); + const remoteBrowser = await playwright.connect({browserWSEndpoint}); + expect(remoteBrowser.process()).toBe(null); + remoteBrowser.disconnect(); + }); + }); +}; diff --git a/test/playwright.spec.js b/test/playwright.spec.js index 22ee27383d..78b959698e 100644 --- a/test/playwright.spec.js +++ b/test/playwright.spec.js @@ -149,7 +149,6 @@ module.exports.addTests = ({testRunner, product, playwrightPath}) => { // Page-level tests that are given a browser, a context and a page. // Each test is launched in a new browser context. - require('./browser.spec.js').addTests(testOptions); require('./click.spec.js').addTests(testOptions); require('./cookies.spec.js').addTests(testOptions); require('./dialog.spec.js').addTests(testOptions); @@ -186,8 +185,15 @@ module.exports.addTests = ({testRunner, product, playwrightPath}) => { }); // Browser-level tests that are given a browser. + require('./browser.spec.js').addTests(testOptions); require('./browsercontext.spec.js').addTests(testOptions); require('./ignorehttpserrors.spec.js').addTests(testOptions); + if (CHROME) { + require('./chromium/browser.spec.js').addTests(testOptions); + } + if (FFOX) { + require('./firefox/browser.spec.js').addTests(testOptions); + } }); // Top-level tests that launch Browser themselves.