diff --git a/test/browser.spec.js b/test/browser.spec.js index 8adc0c1dd6..f0f5691181 100644 --- a/test/browser.spec.js +++ b/test/browser.spec.js @@ -15,7 +15,7 @@ * limitations under the License. */ -module.exports.addTests = function({testRunner, expect, headless, playwright, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, headless, playwright, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/browsercontext.spec.js b/test/browsercontext.spec.js index 523c89954d..531ec20ed9 100644 --- a/test/browsercontext.spec.js +++ b/test/browsercontext.spec.js @@ -17,7 +17,7 @@ const utils = require('./utils'); -module.exports.addTests = function({testRunner, expect, playwright, WEBKIT}) { +module.exports.describe = function({testRunner, expect, playwright, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/chromium/browser.spec.js b/test/chromium/browser.spec.js index 3c07998c08..2b331bad74 100644 --- a/test/chromium/browser.spec.js +++ b/test/chromium/browser.spec.js @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -module.exports.addTests = function({testRunner, expect, headless, playwright, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, headless, playwright, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/chromium/chromium.spec.js b/test/chromium/chromium.spec.js index 2c2ce4dc88..d6e95de04d 100644 --- a/test/chromium/chromium.spec.js +++ b/test/chromium/chromium.spec.js @@ -16,7 +16,7 @@ const { waitEvent } = require('../utils'); -module.exports.addTests = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/chromium/connect.spec.js b/test/chromium/connect.spec.js index 7028fe364f..0622a5019b 100644 --- a/test/chromium/connect.spec.js +++ b/test/chromium/connect.spec.js @@ -20,7 +20,7 @@ const path = require('path'); const {helper} = require('../../lib/helper'); const utils = require('../utils'); -module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, playwright, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/chromium/coverage.spec.js b/test/chromium/coverage.spec.js index 33fa891e04..5c69632bf5 100644 --- a/test/chromium/coverage.spec.js +++ b/test/chromium/coverage.spec.js @@ -14,7 +14,7 @@ * limitations under the License. */ -module.exports.addTests = function({testRunner, expect, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/chromium/geolocation.spec.js b/test/chromium/geolocation.spec.js index 21ceb65421..02aaf14c14 100644 --- a/test/chromium/geolocation.spec.js +++ b/test/chromium/geolocation.spec.js @@ -15,7 +15,7 @@ * limitations under the License. */ -module.exports.addTests = function ({ testRunner, expect }) { +module.exports.describe = function ({ testRunner, expect }) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/chromium/headful.spec.js b/test/chromium/headful.spec.js index 71c0b3a725..1f40bf4570 100644 --- a/test/chromium/headful.spec.js +++ b/test/chromium/headful.spec.js @@ -24,7 +24,7 @@ const mkdtempAsync = util.promisify(fs.mkdtemp); const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-'); -module.exports.addTests = function({testRunner, expect, playwright, defaultBrowserOptions, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, playwright, defaultBrowserOptions, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/chromium/launcher.spec.js b/test/chromium/launcher.spec.js index bc4d70ce66..5fd503bc7d 100644 --- a/test/chromium/launcher.spec.js +++ b/test/chromium/launcher.spec.js @@ -26,7 +26,7 @@ const statAsync = util.promisify(fs.stat); const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-'); -module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, playwright, WIN}) { +module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, WIN}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/chromium/oopif.spec.js b/test/chromium/oopif.spec.js index 0061acc5c5..3412695300 100644 --- a/test/chromium/oopif.spec.js +++ b/test/chromium/oopif.spec.js @@ -14,7 +14,7 @@ * limitations under the License. */ -module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, playwright, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/chromium/pdf.spec.js b/test/chromium/pdf.spec.js index fb8119f29a..c957acc217 100644 --- a/test/chromium/pdf.spec.js +++ b/test/chromium/pdf.spec.js @@ -17,7 +17,7 @@ const fs = require('fs'); const path = require('path'); -module.exports.addTests = function({testRunner, expect, headless, ASSETS_DIR}) { +module.exports.describe = function({testRunner, expect, headless, ASSETS_DIR}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/chromium/session.spec.js b/test/chromium/session.spec.js index 9f43e83eaa..5451a27b84 100644 --- a/test/chromium/session.spec.js +++ b/test/chromium/session.spec.js @@ -16,7 +16,7 @@ const { waitEvent } = require('../utils'); -module.exports.addTests = function({testRunner, expect, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/chromium/tracing.spec.js b/test/chromium/tracing.spec.js index 39fc6c02e1..435eef51bc 100644 --- a/test/chromium/tracing.spec.js +++ b/test/chromium/tracing.spec.js @@ -17,7 +17,7 @@ const fs = require('fs'); const path = require('path'); -module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, playwright, ASSETS_DIR}) { +module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, ASSETS_DIR}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/chromium/workers.spec.js b/test/chromium/workers.spec.js index fa7a824035..bd2264b4fd 100644 --- a/test/chromium/workers.spec.js +++ b/test/chromium/workers.spec.js @@ -18,7 +18,7 @@ const utils = require('../utils'); const { waitEvent } = utils; -module.exports.addTests = function({testRunner, expect, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/click.spec.js b/test/click.spec.js index 0ce98ad9e3..65e22a221b 100644 --- a/test/click.spec.js +++ b/test/click.spec.js @@ -17,7 +17,7 @@ const utils = require('./utils'); -module.exports.addTests = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/cookies.spec.js b/test/cookies.spec.js index b2185f0dcc..2ed34bc891 100644 --- a/test/cookies.spec.js +++ b/test/cookies.spec.js @@ -15,7 +15,7 @@ * limitations under the License. */ -module.exports.addTests = function({testRunner, expect, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/defaultbrowsercontext.spec.js b/test/defaultbrowsercontext.spec.js index 615632200b..dd7352df21 100644 --- a/test/defaultbrowsercontext.spec.js +++ b/test/defaultbrowsercontext.spec.js @@ -15,7 +15,7 @@ * limitations under the License. */ -module.exports.addTests = function ({ testRunner, expect, defaultBrowserOptions, playwright }) { +module.exports.describe = function ({ testRunner, expect, defaultBrowserOptions, playwright }) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/dialog.spec.js b/test/dialog.spec.js index d904d063eb..b471d9e512 100644 --- a/test/dialog.spec.js +++ b/test/dialog.spec.js @@ -15,7 +15,7 @@ * limitations under the License. */ -module.exports.addTests = function({testRunner, expect, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/elementhandle.spec.js b/test/elementhandle.spec.js index eb62711245..77b13896b5 100644 --- a/test/elementhandle.spec.js +++ b/test/elementhandle.spec.js @@ -17,7 +17,7 @@ const utils = require('./utils'); -module.exports.addTests = function({testRunner, expect, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/emulation.spec.js b/test/emulation.spec.js index 02c192cd46..122b3e803d 100644 --- a/test/emulation.spec.js +++ b/test/emulation.spec.js @@ -15,7 +15,7 @@ * limitations under the License. */ -module.exports.addTests = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/evaluation.spec.js b/test/evaluation.spec.js index e908c36bc7..3c57878e5a 100644 --- a/test/evaluation.spec.js +++ b/test/evaluation.spec.js @@ -19,7 +19,7 @@ const utils = require('./utils'); const bigint = typeof BigInt !== 'undefined'; -module.exports.addTests = function({testRunner, expect, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/features/accessibility.spec.js b/test/features/accessibility.spec.js index e02034479b..15f2a1ff6c 100644 --- a/test/features/accessibility.spec.js +++ b/test/features/accessibility.spec.js @@ -15,7 +15,7 @@ * limitations under the License. */ -module.exports.addTests = function({testRunner, expect, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/features/interception.spec.js b/test/features/interception.spec.js index e4306f49a9..697e5d3e03 100644 --- a/test/features/interception.spec.js +++ b/test/features/interception.spec.js @@ -19,7 +19,7 @@ const fs = require('fs'); const path = require('path'); const utils = require('../utils'); -module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, playwright, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/features/permissions.spec.js b/test/features/permissions.spec.js index 78a95b804e..4f80a6ca27 100644 --- a/test/features/permissions.spec.js +++ b/test/features/permissions.spec.js @@ -18,7 +18,7 @@ const fs = require('fs'); const path = require('path'); -module.exports.addTests = function({testRunner, expect, WEBKIT}) { +module.exports.describe = function({testRunner, expect, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/firefox/browser.spec.js b/test/firefox/browser.spec.js index 91c8d2f1f9..5a77febb76 100644 --- a/test/firefox/browser.spec.js +++ b/test/firefox/browser.spec.js @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -module.exports.addTests = function({testRunner, expect, headless, playwright, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, headless, playwright, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/firefox/launcher.spec.js b/test/firefox/launcher.spec.js index 44d7d5bc30..ab0b996f24 100644 --- a/test/firefox/launcher.spec.js +++ b/test/firefox/launcher.spec.js @@ -22,7 +22,7 @@ const rmAsync = helper.promisify(require('rimraf')); const mkdtempAsync = helper.promisify(fs.mkdtemp); const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-'); -module.exports.addTests = function ({ testRunner, expect, defaultBrowserOptions, playwright }) { +module.exports.describe = function ({ testRunner, expect, defaultBrowserOptions, playwright }) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/fixtures.spec.js b/test/fixtures.spec.js index e201ff36ae..674f7b8f8a 100644 --- a/test/fixtures.spec.js +++ b/test/fixtures.spec.js @@ -17,7 +17,7 @@ const path = require('path'); -module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, playwright, playwrightPath, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, playwrightPath, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/frame.spec.js b/test/frame.spec.js index 08f533a9e1..bd1dfe1f4b 100644 --- a/test/frame.spec.js +++ b/test/frame.spec.js @@ -17,7 +17,7 @@ const utils = require('./utils'); -module.exports.addTests = function({testRunner, expect, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/ignorehttpserrors.spec.js b/test/ignorehttpserrors.spec.js index 0cb554e5b3..be76898532 100644 --- a/test/ignorehttpserrors.spec.js +++ b/test/ignorehttpserrors.spec.js @@ -15,7 +15,7 @@ * limitations under the License. */ -module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, playwright, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/input.spec.js b/test/input.spec.js index 5cc7ba151c..0c5c3d98af 100644 --- a/test/input.spec.js +++ b/test/input.spec.js @@ -19,7 +19,7 @@ const path = require('path'); const FILE_TO_UPLOAD = path.join(__dirname, '/assets/file-to-upload.txt'); -module.exports.addTests = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/jshandle.spec.js b/test/jshandle.spec.js index ad2ce53dae..92e004051f 100644 --- a/test/jshandle.spec.js +++ b/test/jshandle.spec.js @@ -15,7 +15,7 @@ * limitations under the License. */ -module.exports.addTests = function({testRunner, expect, CHROME, FFOX, WEBKIT}) { +module.exports.describe = function({testRunner, expect, CHROME, FFOX, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/keyboard.spec.js b/test/keyboard.spec.js index 424711ce0c..702f0424bb 100644 --- a/test/keyboard.spec.js +++ b/test/keyboard.spec.js @@ -18,7 +18,7 @@ const utils = require('./utils'); const os = require('os'); -module.exports.addTests = function({testRunner, expect, FFOX, CHROME, WEBKIT, MAC}) { +module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT, MAC}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/launcher.spec.js b/test/launcher.spec.js index bc8f54b6f2..3e8821c3d6 100644 --- a/test/launcher.spec.js +++ b/test/launcher.spec.js @@ -23,7 +23,7 @@ const mkdtempAsync = helper.promisify(fs.mkdtemp); const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-'); const utils = require('./utils'); -module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, playwright, WEBKIT}) { +module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/mouse.spec.js b/test/mouse.spec.js index ff73f11353..00b78ec1bf 100644 --- a/test/mouse.spec.js +++ b/test/mouse.spec.js @@ -26,7 +26,7 @@ function dimensions() { }; } -module.exports.addTests = function({testRunner, expect, FFOX, CHROME, WEBKIT, MAC}) { +module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT, MAC}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/navigation.spec.js b/test/navigation.spec.js index f757951fa4..123db19873 100644 --- a/test/navigation.spec.js +++ b/test/navigation.spec.js @@ -18,7 +18,7 @@ const utils = require('./utils'); const { performance } = require('perf_hooks'); -module.exports.addTests = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/network.spec.js b/test/network.spec.js index 4155b01442..702578239a 100644 --- a/test/network.spec.js +++ b/test/network.spec.js @@ -19,7 +19,7 @@ const fs = require('fs'); const path = require('path'); const utils = require('./utils'); -module.exports.addTests = function({testRunner, expect, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/page.spec.js b/test/page.spec.js index 7d8cd12363..036e9725bc 100644 --- a/test/page.spec.js +++ b/test/page.spec.js @@ -19,7 +19,7 @@ const path = require('path'); const utils = require('./utils'); const {waitEvent} = utils; -module.exports.addTests = function({testRunner, expect, headless, playwright, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, headless, playwright, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/playwright.spec.js b/test/playwright.spec.js index 78b959698e..2d758e791d 100644 --- a/test/playwright.spec.js +++ b/test/playwright.spec.js @@ -24,7 +24,7 @@ const {Matchers} = require('../utils/testrunner/'); const YELLOW_COLOR = '\x1b[33m'; const RESET_COLOR = '\x1b[0m'; -module.exports.addTests = ({testRunner, product, playwrightPath}) => { +module.exports.describe = ({testRunner, product, playwrightPath}) => { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; @@ -149,71 +149,71 @@ 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('./click.spec.js').addTests(testOptions); - require('./cookies.spec.js').addTests(testOptions); - require('./dialog.spec.js').addTests(testOptions); - require('./elementhandle.spec.js').addTests(testOptions); - require('./emulation.spec.js').addTests(testOptions); - require('./evaluation.spec.js').addTests(testOptions); - require('./frame.spec.js').addTests(testOptions); - require('./input.spec.js').addTests(testOptions); - require('./jshandle.spec.js').addTests(testOptions); - require('./keyboard.spec.js').addTests(testOptions); - require('./mouse.spec.js').addTests(testOptions); - require('./navigation.spec.js').addTests(testOptions); - require('./network.spec.js').addTests(testOptions); - require('./page.spec.js').addTests(testOptions); - require('./queryselector.spec.js').addTests(testOptions); - require('./screenshot.spec.js').addTests(testOptions); - require('./waittask.spec.js').addTests(testOptions); + testRunner.loadTests(require('./click.spec.js'), testOptions); + testRunner.loadTests(require('./cookies.spec.js'), testOptions); + testRunner.loadTests(require('./dialog.spec.js'), testOptions); + testRunner.loadTests(require('./elementhandle.spec.js'), testOptions); + testRunner.loadTests(require('./emulation.spec.js'), testOptions); + testRunner.loadTests(require('./evaluation.spec.js'), testOptions); + testRunner.loadTests(require('./frame.spec.js'), testOptions); + testRunner.loadTests(require('./input.spec.js'), testOptions); + testRunner.loadTests(require('./jshandle.spec.js'), testOptions); + testRunner.loadTests(require('./keyboard.spec.js'), testOptions); + testRunner.loadTests(require('./mouse.spec.js'), testOptions); + testRunner.loadTests(require('./navigation.spec.js'), testOptions); + testRunner.loadTests(require('./network.spec.js'), testOptions); + testRunner.loadTests(require('./page.spec.js'), testOptions); + testRunner.loadTests(require('./queryselector.spec.js'), testOptions); + testRunner.loadTests(require('./screenshot.spec.js'), testOptions); + testRunner.loadTests(require('./waittask.spec.js'), testOptions); if (CHROME) { - require('./chromium/chromium.spec.js').addTests(testOptions); - require('./chromium/coverage.spec.js').addTests(testOptions); - require('./chromium/geolocation.spec.js').addTests(testOptions); - require('./chromium/pdf.spec.js').addTests(testOptions); - require('./chromium/session.spec.js').addTests(testOptions); - require('./chromium/workers.spec.js').addTests(testOptions); + testRunner.loadTests(require('./chromium/chromium.spec.js'), testOptions); + testRunner.loadTests(require('./chromium/coverage.spec.js'), testOptions); + testRunner.loadTests(require('./chromium/geolocation.spec.js'), testOptions); + testRunner.loadTests(require('./chromium/pdf.spec.js'), testOptions); + testRunner.loadTests(require('./chromium/session.spec.js'), testOptions); + testRunner.loadTests(require('./chromium/workers.spec.js'), testOptions); } if (CHROME || FFOX) { - require('./features/accessibility.spec.js').addTests(testOptions); - require('./features/permissions.spec.js').addTests(testOptions); - require('./features/interception.spec.js').addTests(testOptions); + testRunner.loadTests(require('./features/accessibility.spec.js'), testOptions); + testRunner.loadTests(require('./features/permissions.spec.js'), testOptions); + testRunner.loadTests(require('./features/interception.spec.js'), testOptions); } }); // 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); + testRunner.loadTests(require('./browser.spec.js'), testOptions); + testRunner.loadTests(require('./browsercontext.spec.js'), testOptions); + testRunner.loadTests(require('./ignorehttpserrors.spec.js'), testOptions); if (CHROME) { - require('./chromium/browser.spec.js').addTests(testOptions); + testRunner.loadTests(require('./chromium/browser.spec.js'), testOptions); } if (FFOX) { - require('./firefox/browser.spec.js').addTests(testOptions); + testRunner.loadTests(require('./firefox/browser.spec.js'), testOptions); } }); // Top-level tests that launch Browser themselves. - require('./defaultbrowsercontext.spec.js').addTests(testOptions); - require('./fixtures.spec.js').addTests(testOptions); - require('./launcher.spec.js').addTests(testOptions); + testRunner.loadTests(require('./defaultbrowsercontext.spec.js'), testOptions); + testRunner.loadTests(require('./fixtures.spec.js'), testOptions); + testRunner.loadTests(require('./launcher.spec.js'), testOptions); if (CHROME) { - require('./chromium/connect.spec.js').addTests(testOptions); - require('./chromium/launcher.spec.js').addTests(testOptions); - require('./chromium/headful.spec.js').addTests(testOptions); - require('./chromium/oopif.spec.js').addTests(testOptions); - require('./chromium/tracing.spec.js').addTests(testOptions); + testRunner.loadTests(require('./chromium/connect.spec.js'), testOptions); + testRunner.loadTests(require('./chromium/launcher.spec.js'), testOptions); + testRunner.loadTests(require('./chromium/headful.spec.js'), testOptions); + testRunner.loadTests(require('./chromium/oopif.spec.js'), testOptions); + testRunner.loadTests(require('./chromium/tracing.spec.js'), testOptions); } if (FFOX) { - require('./firefox/launcher.spec.js').addTests(testOptions); + testRunner.loadTests(require('./firefox/launcher.spec.js'), testOptions); } if (WEBKIT) { - require('./webkit/launcher.spec.js').addTests(testOptions); + testRunner.loadTests(require('./webkit/launcher.spec.js'), testOptions); } }; diff --git a/test/queryselector.spec.js b/test/queryselector.spec.js index 0b9e91bcc8..70ff0c1cb4 100644 --- a/test/queryselector.spec.js +++ b/test/queryselector.spec.js @@ -15,7 +15,7 @@ * limitations under the License. */ -module.exports.addTests = function({testRunner, expect, product, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, product, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/screenshot.spec.js b/test/screenshot.spec.js index c86a4c3069..201d4f3cf4 100644 --- a/test/screenshot.spec.js +++ b/test/screenshot.spec.js @@ -15,7 +15,7 @@ * limitations under the License. */ -module.exports.addTests = function({testRunner, expect, product, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, product, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/test.js b/test/test.js index 603705d241..a5c592d369 100644 --- a/test/test.js +++ b/test/test.js @@ -75,7 +75,7 @@ beforeEach(async({server, httpsServer}) => { if (process.env.BROWSER === 'firefox') { describe('Firefox', () => { - require('./playwright.spec.js').addTests({ + testRunner.loadTests(require('./playwright.spec.js'), { product: 'Firefox', playwrightPath: path.join(utils.projectRoot(), 'firefox.js'), testRunner, @@ -83,7 +83,7 @@ if (process.env.BROWSER === 'firefox') { }); } else if (process.env.BROWSER === 'webkit') { describe('WebKit', () => { - require('./playwright.spec.js').addTests({ + testRunner.loadTests(require('./playwright.spec.js'), { product: 'WebKit', playwrightPath: path.join(utils.projectRoot(), 'webkit.js'), testRunner, @@ -91,7 +91,7 @@ if (process.env.BROWSER === 'firefox') { }); } else { describe('Chromium', () => { - require('./playwright.spec.js').addTests({ + testRunner.loadTests(require('./playwright.spec.js'), { product: 'Chromium', playwrightPath: path.join(utils.projectRoot(), 'chromium.js'), testRunner, diff --git a/test/waittask.spec.js b/test/waittask.spec.js index ae019bdb73..929b0e597e 100644 --- a/test/waittask.spec.js +++ b/test/waittask.spec.js @@ -17,7 +17,7 @@ const utils = require('./utils'); -module.exports.addTests = function({testRunner, expect, product, playwright, FFOX, CHROME, WEBKIT}) { +module.exports.describe = function({testRunner, expect, product, playwright, FFOX, CHROME, WEBKIT}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/test/webkit/launcher.spec.js b/test/webkit/launcher.spec.js index 9b306b2c89..8b2c437283 100644 --- a/test/webkit/launcher.spec.js +++ b/test/webkit/launcher.spec.js @@ -23,7 +23,7 @@ const mkdtempAsync = helper.promisify(fs.mkdtemp); const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-'); const utils = require('../utils'); -module.exports.addTests = function ({ testRunner, expect, playwright }) { +module.exports.describe = function ({ testRunner, expect, playwright }) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; diff --git a/utils/testrunner/TestRunner.js b/utils/testrunner/TestRunner.js index d664812a3e..3ead206864 100644 --- a/utils/testrunner/TestRunner.js +++ b/utils/testrunner/TestRunner.js @@ -102,14 +102,13 @@ const TestResult = { }; class Test { - constructor(suite, name, callback, declaredMode, timeout, comment) { + constructor(suite, name, callback, declaredMode, timeout) { this.suite = suite; this.name = name; this.fullName = (suite.fullName + ' ' + name).trim(); this.declaredMode = declaredMode; this._userCallback = new UserCallback(callback, timeout); this.location = this._userCallback.location; - this.comment = comment; // Test results this.result = null; @@ -120,12 +119,11 @@ class Test { } class Suite { - constructor(parentSuite, name, declaredMode, comment) { + constructor(parentSuite, name, declaredMode) { this.parentSuite = parentSuite; this.name = name; this.fullName = (parentSuite ? parentSuite.fullName + ' ' + name : name).trim(); this.declaredMode = declaredMode; - this.comment = comment; /** @type {!Array<(!Test|!Suite)>} */ this.children = []; @@ -312,45 +310,52 @@ class TestRunner extends EventEmitter { } // bind methods so that they can be used as a DSL. - this.addSuiteDSL('describe', TestMode.Run, ''); - this.addSuiteDSL('fdescribe', TestMode.Focus, ''); - this.addSuiteDSL('xdescribe', TestMode.Skip, ''); - this.addTestDSL('it', TestMode.Run, ''); - this.addTestDSL('fit', TestMode.Focus, ''); - this.addTestDSL('xit', TestMode.Skip, ''); + this.describe = this._addSuite.bind(this, TestMode.Run); + this.describe.skip = condition => condition ? this.xdescribe : this.describe; + this.fdescribe = this._addSuite.bind(this, TestMode.Focus); + this.fdescribe.skip = () => this.fdescribe; // no-op + this.xdescribe = this._addSuite.bind(this, TestMode.Skip); + this.xdescribe.skip = () => this.fdescribe; // no-op + + this.it = this._addTest.bind(this, TestMode.Run); + this.it.skip = condition => condition ? this.xit : this.it; + this.fit = this._addTest.bind(this, TestMode.Focus); + this.fit.skip = () => this.fit; // no-op + this.xit = this._addTest.bind(this, TestMode.Skip); + this.xit.skip = () => this.xit; // no-op + this.beforeAll = this._addHook.bind(this, 'beforeAll'); this.beforeEach = this._addHook.bind(this, 'beforeEach'); this.afterAll = this._addHook.bind(this, 'afterAll'); this.afterEach = this._addHook.bind(this, 'afterEach'); } - addTestDSL(dslName, mode, comment) { - this[dslName] = this._addTest.bind(this, mode, comment); - this[dslName].skip = condition => this._addTest.bind(this, condition ? TestMode.Skip : mode, comment); + loadTests(module, ...args) { + if (typeof module.describe === 'function') + this._addSuite(TestMode.Run, '', module.describe, ...args); + if (typeof module.fdescribe === 'function') + this._addSuite(TestMode.Focus, '', module.fdescribe, ...args); + if (typeof module.xdescribe === 'function') + this._addSuite(TestMode.Skip, '', module.xdescribe, ...args); } - addSuiteDSL(dslName, mode, comment) { - this[dslName] = this._addSuite.bind(this, mode, comment); - this[dslName].skip = condition => this._addSuite.bind(this, condition ? TestMode.Skip : mode, comment); - } - - _addTest(mode, comment, name, callback) { + _addTest(mode, name, callback) { let suite = this._currentSuite; let isSkipped = suite.declaredMode === TestMode.Skip; while ((suite = suite.parentSuite)) isSkipped |= suite.declaredMode === TestMode.Skip; - const test = new Test(this._currentSuite, name, callback, isSkipped ? TestMode.Skip : mode, this._timeout, comment); + const test = new Test(this._currentSuite, name, callback, isSkipped ? TestMode.Skip : mode, this._timeout); this._currentSuite.children.push(test); this._tests.push(test); this._hasFocusedTestsOrSuites = this._hasFocusedTestsOrSuites || mode === TestMode.Focus; } - _addSuite(mode, comment, name, callback) { + _addSuite(mode, name, callback, ...args) { const oldSuite = this._currentSuite; - const suite = new Suite(this._currentSuite, name, mode, comment); + const suite = new Suite(this._currentSuite, name, mode); this._currentSuite.children.push(suite); this._currentSuite = suite; - const result = callback(); + const result = callback(...args); this._currentSuite = oldSuite; this._hasFocusedTestsOrSuites = this._hasFocusedTestsOrSuites || mode === TestMode.Focus; }