feat(testrunner): implement "dit" command (#312)
This commit is contained in:
parent
12ac458614
commit
a7f3490e48
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
module.exports.describe = 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 {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Browser.process', function() {
|
describe('Browser.process', function() {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ const utils = require('./utils');
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, playwright, CHROME, WEBKIT}) {
|
module.exports.describe = function({testRunner, expect, playwright, CHROME, WEBKIT}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('BrowserContext', function() {
|
describe('BrowserContext', function() {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
module.exports.describe = 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 {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('CrBrowser', function() {
|
describe('CrBrowser', function() {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ const { waitEvent } = require('../utils');
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) {
|
module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Chromium', function() {
|
describe('Chromium', function() {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ const utils = require('../utils');
|
||||||
|
|
||||||
module.exports.describe = 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 {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Playwright.connect', function() {
|
describe('Playwright.connect', function() {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('JSCoverage', function() {
|
describe('JSCoverage', function() {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
module.exports.describe = function ({ testRunner, expect }) {
|
module.exports.describe = function ({ testRunner, expect }) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
// FIXME: not supported in WebKit (as well as Emulation domain in general).
|
// FIXME: not supported in WebKit (as well as Emulation domain in general).
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-');
|
||||||
|
|
||||||
module.exports.describe = 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 {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
const headfulOptions = Object.assign({}, defaultBrowserOptions, {
|
const headfulOptions = Object.assign({}, defaultBrowserOptions, {
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-');
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, WIN}) {
|
module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, WIN}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('CrPlaywright', function() {
|
describe('CrPlaywright', function() {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
module.exports.describe = 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 {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('OOPIF', function() {
|
describe('OOPIF', function() {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ const path = require('path');
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, headless, ASSETS_DIR}) {
|
module.exports.describe = function({testRunner, expect, headless, ASSETS_DIR}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
// Printing to pdf is currently only supported in headless
|
// Printing to pdf is currently only supported in headless
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ const { waitEvent } = require('../utils');
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Chromium.createCDPSession', function() {
|
describe('Chromium.createCDPSession', function() {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ const path = require('path');
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, ASSETS_DIR}) {
|
module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, ASSETS_DIR}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Chromium.startTracing', function() {
|
describe('Chromium.startTracing', function() {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ const { waitEvent } = utils;
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Workers', function() {
|
describe('Workers', function() {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ const utils = require('./utils');
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) {
|
module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Page.click', function() {
|
describe('Page.click', function() {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('BrowserContext.cookies', function() {
|
describe('BrowserContext.cookies', function() {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
module.exports.describe = function ({ testRunner, expect, defaultBrowserOptions, playwright }) {
|
module.exports.describe = function ({ testRunner, expect, defaultBrowserOptions, playwright }) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('defaultContext()', function() {
|
describe('defaultContext()', function() {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Page.Events.Dialog', function() {
|
describe('Page.Events.Dialog', function() {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ const utils = require('./utils');
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('ElementHandle.boundingBox', function() {
|
describe('ElementHandle.boundingBox', function() {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) {
|
module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
const iPhone = playwright.devices['iPhone 6'];
|
const iPhone = playwright.devices['iPhone 6'];
|
||||||
const iPhoneLandscape = playwright.devices['iPhone 6 landscape'];
|
const iPhoneLandscape = playwright.devices['iPhone 6 landscape'];
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ const bigint = typeof BigInt !== 'undefined';
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Page.evaluate', function() {
|
describe('Page.evaluate', function() {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe.skip(WEBKIT)('Accessibility', function() {
|
describe.skip(WEBKIT)('Accessibility', function() {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ const utils = require('../utils');
|
||||||
|
|
||||||
module.exports.describe = 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 {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Interception.enable', function() {
|
describe('Interception.enable', function() {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ const path = require('path');
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, WEBKIT}) {
|
module.exports.describe = function({testRunner, expect, WEBKIT}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
// Permissions API is not implemented in WebKit (see https://developer.mozilla.org/en-US/docs/Web/API/Permissions_API)
|
// Permissions API is not implemented in WebKit (see https://developer.mozilla.org/en-US/docs/Web/API/Permissions_API)
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-');
|
||||||
|
|
||||||
module.exports.describe = function ({ testRunner, expect, defaultBrowserOptions, playwright }) {
|
module.exports.describe = function ({ testRunner, expect, defaultBrowserOptions, playwright }) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('FFPlaywright', function() {
|
describe('FFPlaywright', function() {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ const path = require('path');
|
||||||
|
|
||||||
module.exports.describe = 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 {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe.skip(WEBKIT)('Fixtures', function() {
|
describe.skip(WEBKIT)('Fixtures', function() {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ const utils = require('./utils');
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Frame.evaluateHandle', function() {
|
describe('Frame.evaluateHandle', function() {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
module.exports.describe = 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 {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
describe('ignoreHTTPSErrors', function() {
|
describe('ignoreHTTPSErrors', function() {
|
||||||
it('should work', async({newPage, httpsServer}) => {
|
it('should work', async({newPage, httpsServer}) => {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ const FILE_TO_UPLOAD = path.join(__dirname, '/assets/file-to-upload.txt');
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) {
|
module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
describe('input', function() {
|
describe('input', function() {
|
||||||
it('should upload the file', async({page, server}) => {
|
it('should upload the file', async({page, server}) => {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, CHROME, FFOX, WEBKIT}) {
|
module.exports.describe = function({testRunner, expect, CHROME, FFOX, WEBKIT}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Page.evaluateHandle', function() {
|
describe('Page.evaluateHandle', function() {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ const os = require('os');
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT, MAC}) {
|
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT, MAC}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Keyboard', function() {
|
describe('Keyboard', function() {
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ const utils = require('./utils');
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, WEBKIT}) {
|
module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, WEBKIT}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Playwright', function() {
|
describe('Playwright', function() {
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ function dimensions() {
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT, MAC}) {
|
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT, MAC}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Mouse', function() {
|
describe('Mouse', function() {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ const { performance } = require('perf_hooks');
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) {
|
module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Page.goto', function() {
|
describe('Page.goto', function() {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ const utils = require('./utils');
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Page.Events.Request', function() {
|
describe('Page.Events.Request', function() {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ const {waitEvent} = utils;
|
||||||
|
|
||||||
module.exports.describe = 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 {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Page.close', function() {
|
describe('Page.close', function() {
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ const RESET_COLOR = '\x1b[0m';
|
||||||
|
|
||||||
module.exports.describe = ({testRunner, product, playwrightPath}) => {
|
module.exports.describe = ({testRunner, product, playwrightPath}) => {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
const CHROME = product === 'Chromium';
|
const CHROME = product === 'Chromium';
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, product, FFOX, CHROME, WEBKIT}) {
|
module.exports.describe = function({testRunner, expect, product, FFOX, CHROME, WEBKIT}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Page.$eval', function() {
|
describe('Page.$eval', function() {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
module.exports.describe = function({testRunner, expect, product, FFOX, CHROME, WEBKIT}) {
|
module.exports.describe = function({testRunner, expect, product, FFOX, CHROME, WEBKIT}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Page.screenshot', function() {
|
describe('Page.screenshot', function() {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ const utils = require('./utils');
|
||||||
|
|
||||||
module.exports.describe = 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 {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Page.waitFor', function() {
|
describe('Page.waitFor', function() {
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ const utils = require('../utils');
|
||||||
|
|
||||||
module.exports.describe = function ({ testRunner, expect, playwright }) {
|
module.exports.describe = function ({ testRunner, expect, playwright }) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, dit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('WKPlaywright', function() {
|
describe('WKPlaywright', function() {
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,17 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const util = require('util');
|
||||||
|
const url = require('url');
|
||||||
|
const inspector = require('inspector');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const EventEmitter = require('events');
|
const EventEmitter = require('events');
|
||||||
const Multimap = require('./Multimap');
|
const Multimap = require('./Multimap');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
const INFINITE_TIMEOUT = 2147483647;
|
||||||
|
|
||||||
|
const readFileAsync = util.promisify(fs.readFile.bind(fs));
|
||||||
|
|
||||||
const TimeoutError = new Error('Timeout');
|
const TimeoutError = new Error('Timeout');
|
||||||
const TerminatedError = new Error('Terminated');
|
const TerminatedError = new Error('Terminated');
|
||||||
|
|
@ -71,8 +79,8 @@ class UserCallback {
|
||||||
if (!match)
|
if (!match)
|
||||||
return null;
|
return null;
|
||||||
const filePath = match[1];
|
const filePath = match[1];
|
||||||
const lineNumber = match[2];
|
const lineNumber = parseInt(match[2], 10);
|
||||||
const columnNumber = match[3];
|
const columnNumber = parseInt(match[3], 10);
|
||||||
if (filePath === __filename)
|
if (filePath === __filename)
|
||||||
continue;
|
continue;
|
||||||
const fileName = filePath.split(path.sep).pop();
|
const fileName = filePath.split(path.sep).pop();
|
||||||
|
|
@ -294,18 +302,17 @@ class TestRunner extends EventEmitter {
|
||||||
this._rootSuite = new Suite(null, '', TestMode.Run);
|
this._rootSuite = new Suite(null, '', TestMode.Run);
|
||||||
this._currentSuite = this._rootSuite;
|
this._currentSuite = this._rootSuite;
|
||||||
this._tests = [];
|
this._tests = [];
|
||||||
this._timeout = timeout === 0 ? 2147483647 : timeout;
|
this._timeout = timeout === 0 ? INFINITE_TIMEOUT : timeout;
|
||||||
this._parallel = parallel;
|
this._parallel = parallel;
|
||||||
this._breakOnFailure = breakOnFailure;
|
this._breakOnFailure = breakOnFailure;
|
||||||
|
|
||||||
this._hasFocusedTestsOrSuites = false;
|
this._hasFocusedTestsOrSuites = false;
|
||||||
|
|
||||||
if (MAJOR_NODEJS_VERSION >= 8 && disableTimeoutWhenInspectorIsEnabled) {
|
if (MAJOR_NODEJS_VERSION >= 8 && disableTimeoutWhenInspectorIsEnabled) {
|
||||||
const inspector = require('inspector');
|
|
||||||
if (inspector.url()) {
|
if (inspector.url()) {
|
||||||
console.log('TestRunner detected inspector; overriding certain properties to be debugger-friendly');
|
console.log('TestRunner detected inspector; overriding certain properties to be debugger-friendly');
|
||||||
console.log(' - timeout = 0 (Infinite)');
|
console.log(' - timeout = 0 (Infinite)');
|
||||||
this._timeout = 2147483647;
|
this._timeout = INFINITE_TIMEOUT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -317,13 +324,22 @@ class TestRunner extends EventEmitter {
|
||||||
this.xdescribe = this._addSuite.bind(this, TestMode.Skip);
|
this.xdescribe = this._addSuite.bind(this, TestMode.Skip);
|
||||||
this.xdescribe.skip = () => this.xdescribe; // no-op
|
this.xdescribe.skip = () => this.xdescribe; // no-op
|
||||||
|
|
||||||
this.it = this._addTest.bind(this, TestMode.Run);
|
this.it = (name, callback) => void this._addTest(name, callback, TestMode.Run, this._timeout);
|
||||||
this.it.skip = condition => condition ? this.xit : this.it;
|
this.it.skip = condition => condition ? this.xit : this.it;
|
||||||
this.fit = this._addTest.bind(this, TestMode.Focus);
|
this.fit = (name, callback) => void this._addTest(name, callback, TestMode.Focus, this._timeout);
|
||||||
this.fit.skip = () => this.fit; // no-op
|
this.fit.skip = () => this.fit; // no-op
|
||||||
this.xit = this._addTest.bind(this, TestMode.Skip);
|
this.xit = (name, callback) => void this._addTest(name, callback, TestMode.Skip, this._timeout);
|
||||||
this.xit.skip = () => this.xit; // no-op
|
this.xit.skip = () => this.xit; // no-op
|
||||||
|
|
||||||
|
this._debuggerLogBreakpointLines = new Multimap();
|
||||||
|
this.dit = (name, callback) => {
|
||||||
|
const test = this._addTest(name, callback, TestMode.Focus, INFINITE_TIMEOUT);
|
||||||
|
const N = callback.toString().split('\n').length;
|
||||||
|
for (let i = 0; i < N; ++i)
|
||||||
|
this._debuggerLogBreakpointLines.set(test.location.filePath, i + test.location.lineNumber);
|
||||||
|
};
|
||||||
|
this.dit.skip = () => this.dit; // no-op;
|
||||||
|
|
||||||
this.beforeAll = this._addHook.bind(this, 'beforeAll');
|
this.beforeAll = this._addHook.bind(this, 'beforeAll');
|
||||||
this.beforeEach = this._addHook.bind(this, 'beforeEach');
|
this.beforeEach = this._addHook.bind(this, 'beforeEach');
|
||||||
this.afterAll = this._addHook.bind(this, 'afterAll');
|
this.afterAll = this._addHook.bind(this, 'afterAll');
|
||||||
|
|
@ -339,15 +355,16 @@ class TestRunner extends EventEmitter {
|
||||||
this._addSuite(TestMode.Skip, '', module.xdescribe, ...args);
|
this._addSuite(TestMode.Skip, '', module.xdescribe, ...args);
|
||||||
}
|
}
|
||||||
|
|
||||||
_addTest(mode, name, callback) {
|
_addTest(name, callback, mode, timeout) {
|
||||||
let suite = this._currentSuite;
|
let suite = this._currentSuite;
|
||||||
let isSkipped = suite.declaredMode === TestMode.Skip;
|
let isSkipped = suite.declaredMode === TestMode.Skip;
|
||||||
while ((suite = suite.parentSuite))
|
while ((suite = suite.parentSuite))
|
||||||
isSkipped |= suite.declaredMode === TestMode.Skip;
|
isSkipped |= suite.declaredMode === TestMode.Skip;
|
||||||
const test = new Test(this._currentSuite, name, callback, isSkipped ? TestMode.Skip : mode, this._timeout);
|
const test = new Test(this._currentSuite, name, callback, isSkipped ? TestMode.Skip : mode, timeout);
|
||||||
this._currentSuite.children.push(test);
|
this._currentSuite.children.push(test);
|
||||||
this._tests.push(test);
|
this._tests.push(test);
|
||||||
this._hasFocusedTestsOrSuites = this._hasFocusedTestsOrSuites || mode === TestMode.Focus;
|
this._hasFocusedTestsOrSuites = this._hasFocusedTestsOrSuites || mode === TestMode.Focus;
|
||||||
|
return test;
|
||||||
}
|
}
|
||||||
|
|
||||||
_addSuite(mode, name, callback, ...args) {
|
_addSuite(mode, name, callback, ...args) {
|
||||||
|
|
@ -367,6 +384,7 @@ class TestRunner extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
async run() {
|
async run() {
|
||||||
|
let session = this._debuggerLogBreakpointLines.size ? await setLogBreakpoints(this._debuggerLogBreakpointLines) : null;
|
||||||
const runnableTests = this._runnableTests();
|
const runnableTests = this._runnableTests();
|
||||||
this.emit(TestRunner.Events.Started, runnableTests);
|
this.emit(TestRunner.Events.Started, runnableTests);
|
||||||
this._runningPass = new TestPass(this, this._rootSuite, runnableTests, this._parallel, this._breakOnFailure);
|
this._runningPass = new TestPass(this, this._rootSuite, runnableTests, this._parallel, this._breakOnFailure);
|
||||||
|
|
@ -381,6 +399,8 @@ class TestRunner extends EventEmitter {
|
||||||
result.result = this.failedTests().length ? TestResult.Failed : TestResult.Ok;
|
result.result = this.failedTests().length ? TestResult.Failed : TestResult.Ok;
|
||||||
}
|
}
|
||||||
this.emit(TestRunner.Events.Finished, result);
|
this.emit(TestRunner.Events.Finished, result);
|
||||||
|
if (session)
|
||||||
|
session.disconnect();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -458,6 +478,27 @@ class TestRunner extends EventEmitter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function setLogBreakpoints(debuggerLogBreakpoints) {
|
||||||
|
const session = new inspector.Session();
|
||||||
|
session.connect();
|
||||||
|
const postAsync = util.promisify(session.post.bind(session));
|
||||||
|
await postAsync('Debugger.enable');
|
||||||
|
const setBreakpointCommands = [];
|
||||||
|
for (const filePath of debuggerLogBreakpoints.keysArray()) {
|
||||||
|
const lineNumbers = debuggerLogBreakpoints.get(filePath);
|
||||||
|
const lines = (await readFileAsync(filePath, 'utf8')).split('\n');
|
||||||
|
for (const lineNumber of lineNumbers) {
|
||||||
|
setBreakpointCommands.push(postAsync('Debugger.setBreakpointByUrl', {
|
||||||
|
url: url.pathToFileURL(filePath),
|
||||||
|
lineNumber,
|
||||||
|
condition: `console.log('${String(lineNumber + 1).padStart(6, ' ')} | ' + ${JSON.stringify(lines[lineNumber])})`,
|
||||||
|
}).catch(e => {}));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
await Promise.all(setBreakpointCommands);
|
||||||
|
return session;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {*} value
|
* @param {*} value
|
||||||
* @param {string=} message
|
* @param {string=} message
|
||||||
|
|
|
||||||
|
|
@ -381,20 +381,6 @@ module.exports.addTests = function({testRunner, expect}) {
|
||||||
await t.run();
|
await t.run();
|
||||||
expect(log.join()).toBe('1,2,3,4');
|
expect(log.join()).toBe('1,2,3,4');
|
||||||
});
|
});
|
||||||
it('should support async test suites', async() => {
|
|
||||||
const log = [];
|
|
||||||
const t = new TestRunner();
|
|
||||||
t.it('uno', () => log.push(1));
|
|
||||||
await t.describe('suite1', async() => {
|
|
||||||
await Promise.resolve();
|
|
||||||
t.it('dos', () => log.push(2));
|
|
||||||
await Promise.resolve();
|
|
||||||
t.it('tres', () => log.push(3));
|
|
||||||
});
|
|
||||||
t.it('cuatro', () => log.push(4));
|
|
||||||
await t.run();
|
|
||||||
expect(log.join()).toBe('1,2,3,4');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('TestRunner.run result', () => {
|
describe('TestRunner.run result', () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue