mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-13 17:14:02 +03:00
feat(testrunner): allow focusing all tests in a file
With this change, exporting a "fdescribe" function from a file will focus all tests inside the file.
This commit is contained in:
parent
0e3328218d
commit
8cc682c7b8
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user