From adf54ee6b3da2736e7be11cca51ce8d9b5ca0a1c Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Wed, 18 Dec 2019 13:28:23 -0700 Subject: [PATCH] tests: move ws-specific browser tests to corrsponding browser suites (#289) --- test/browser.spec.js | 6 ------ test/chromium/browser.spec.js | 17 +++++++++++++++++ test/firefox/browser.spec.js | 17 +++++++++++++++++ test/playwright.spec.js | 8 +++++++- 4 files changed, 41 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..3c07998c08 --- /dev/null +++ b/test/chromium/browser.spec.js @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT 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/firefox/browser.spec.js b/test/firefox/browser.spec.js new file mode 100644 index 0000000000..91c8d2f1f9 --- /dev/null +++ b/test/firefox/browser.spec.js @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT 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.