Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

feat(testrunner): implement "dit" command (#312)

Andrey Lushnikova7f3490e4836
diff --git a/test/browser.spec.js b/test/browser.spec.js
index 9ba4999850..862a67b832 100644
--- a/test/browser.spec.js
+++ b/test/browser.spec.js
@@ -17,7 +17,7 @@
module.exports.describe = function({testRunner, expect, headless, playwright, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Browser.process', function() {
diff --git a/test/browsercontext.spec.js b/test/browsercontext.spec.js
index 7541dd2154..949376381e 100644
--- a/test/browsercontext.spec.js
+++ b/test/browsercontext.spec.js
@@ -19,7 +19,7 @@ const utils = require('./utils');
module.exports.describe = function({testRunner, expect, playwright, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('BrowserContext', function() {
diff --git a/test/chromium/browser.spec.js b/test/chromium/browser.spec.js
index 9a11f9e4e3..9065100587 100644
--- a/test/chromium/browser.spec.js
+++ b/test/chromium/browser.spec.js
@@ -3,7 +3,7 @@
module.exports.describe = function({testRunner, expect, headless, playwright, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('CrBrowser', function() {
diff --git a/test/chromium/chromium.spec.js b/test/chromium/chromium.spec.js
index d573e141d0..2203995ffd 100644
--- a/test/chromium/chromium.spec.js
+++ b/test/chromium/chromium.spec.js
@@ -18,7 +18,7 @@ const { waitEvent } = require('../utils');
module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Chromium', function() {
diff --git a/test/chromium/connect.spec.js b/test/chromium/connect.spec.js
index c170cd325f..447b866055 100644
--- a/test/chromium/connect.spec.js
+++ b/test/chromium/connect.spec.js
@@ -19,7 +19,7 @@ const utils = require('../utils');
module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Playwright.connect', function() {
diff --git a/test/chromium/coverage.spec.js b/test/chromium/coverage.spec.js
index 5c69632bf5..c6c7fb0655 100644
--- a/test/chromium/coverage.spec.js
+++ b/test/chromium/coverage.spec.js
@@ -16,7 +16,7 @@
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('JSCoverage', function() {
diff --git a/test/chromium/geolocation.spec.js b/test/chromium/geolocation.spec.js
index 02aaf14c14..eea78a3951 100644
--- a/test/chromium/geolocation.spec.js
+++ b/test/chromium/geolocation.spec.js
@@ -17,7 +17,7 @@
module.exports.describe = function ({ testRunner, expect }) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
// FIXME: not supported in WebKit (as well as Emulation domain in general).
diff --git a/test/chromium/headful.spec.js b/test/chromium/headful.spec.js
index f666ead812..a709654de0 100644
--- a/test/chromium/headful.spec.js
+++ b/test/chromium/headful.spec.js
@@ -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}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
const headfulOptions = Object.assign({}, defaultBrowserOptions, {
diff --git a/test/chromium/launcher.spec.js b/test/chromium/launcher.spec.js
index 6cdce27b77..de3416f1b4 100644
--- a/test/chromium/launcher.spec.js
+++ b/test/chromium/launcher.spec.js
@@ -28,7 +28,7 @@ const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-');
module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, WIN}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('CrPlaywright', function() {
diff --git a/test/chromium/oopif.spec.js b/test/chromium/oopif.spec.js
index ef39ff84c2..58a0ddc1da 100644
--- a/test/chromium/oopif.spec.js
+++ b/test/chromium/oopif.spec.js
@@ -16,7 +16,7 @@
module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('OOPIF', function() {
diff --git a/test/chromium/pdf.spec.js b/test/chromium/pdf.spec.js
index c957acc217..a44e73730e 100644
--- a/test/chromium/pdf.spec.js
+++ b/test/chromium/pdf.spec.js
@@ -19,7 +19,7 @@ const path = require('path');
module.exports.describe = function({testRunner, expect, headless, ASSETS_DIR}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
// Printing to pdf is currently only supported in headless
diff --git a/test/chromium/session.spec.js b/test/chromium/session.spec.js
index 6946504c6d..6809e24dbe 100644
--- a/test/chromium/session.spec.js
+++ b/test/chromium/session.spec.js
@@ -18,7 +18,7 @@ const { waitEvent } = require('../utils');
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Chromium.createCDPSession', function() {
diff --git a/test/chromium/tracing.spec.js b/test/chromium/tracing.spec.js
index 3071593722..288a7c9cac 100644
--- a/test/chromium/tracing.spec.js
+++ b/test/chromium/tracing.spec.js
@@ -19,7 +19,7 @@ const path = require('path');
module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, ASSETS_DIR}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Chromium.startTracing', function() {
diff --git a/test/chromium/workers.spec.js b/test/chromium/workers.spec.js
index bd2264b4fd..252a92c161 100644
--- a/test/chromium/workers.spec.js
+++ b/test/chromium/workers.spec.js
@@ -20,7 +20,7 @@ const { waitEvent } = utils;
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Workers', function() {
diff --git a/test/click.spec.js b/test/click.spec.js
index 3c9ccb635e..c792a791ad 100644
--- a/test/click.spec.js
+++ b/test/click.spec.js
@@ -19,7 +19,7 @@ const utils = require('./utils');
module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Page.click', function() {
diff --git a/test/cookies.spec.js b/test/cookies.spec.js
index 2ed34bc891..27ddfa4975 100644
--- a/test/cookies.spec.js
+++ b/test/cookies.spec.js
@@ -17,7 +17,7 @@
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('BrowserContext.cookies', function() {
diff --git a/test/defaultbrowsercontext.spec.js b/test/defaultbrowsercontext.spec.js
index b6f2d8e5be..ae9559c618 100644
--- a/test/defaultbrowsercontext.spec.js
+++ b/test/defaultbrowsercontext.spec.js
@@ -17,7 +17,7 @@
module.exports.describe = function ({ testRunner, expect, defaultBrowserOptions, playwright }) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('defaultContext()', function() {
diff --git a/test/dialog.spec.js b/test/dialog.spec.js
index b471d9e512..8210edb4a0 100644
--- a/test/dialog.spec.js
+++ b/test/dialog.spec.js
@@ -17,7 +17,7 @@
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Page.Events.Dialog', function() {
diff --git a/test/elementhandle.spec.js b/test/elementhandle.spec.js
index e92ebf7254..5a93cd1583 100644
--- a/test/elementhandle.spec.js
+++ b/test/elementhandle.spec.js
@@ -19,7 +19,7 @@ const utils = require('./utils');
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('ElementHandle.boundingBox', function() {
diff --git a/test/emulation.spec.js b/test/emulation.spec.js
index 122b3e803d..1f9cf759d3 100644
--- a/test/emulation.spec.js
+++ b/test/emulation.spec.js
@@ -17,7 +17,7 @@
module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
const iPhone = playwright.devices['iPhone 6'];
const iPhoneLandscape = playwright.devices['iPhone 6 landscape'];
diff --git a/test/evaluation.spec.js b/test/evaluation.spec.js
index 7f3b96abed..f496853975 100644
--- a/test/evaluation.spec.js
+++ b/test/evaluation.spec.js
@@ -21,7 +21,7 @@ const bigint = typeof BigInt !== 'undefined';
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Page.evaluate', function() {
diff --git a/test/features/accessibility.spec.js b/test/features/accessibility.spec.js
index 15f2a1ff6c..d55282b27a 100644
--- a/test/features/accessibility.spec.js
+++ b/test/features/accessibility.spec.js
@@ -17,7 +17,7 @@
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe.skip(WEBKIT)('Accessibility', function() {
diff --git a/test/features/interception.spec.js b/test/features/interception.spec.js
index 697e5d3e03..9b6650817f 100644
--- a/test/features/interception.spec.js
+++ b/test/features/interception.spec.js
@@ -21,7 +21,7 @@ const utils = require('../utils');
module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Interception.enable', function() {
diff --git a/test/features/permissions.spec.js b/test/features/permissions.spec.js
index 4f80a6ca27..1409173799 100644
--- a/test/features/permissions.spec.js
+++ b/test/features/permissions.spec.js
@@ -20,7 +20,7 @@ const path = require('path');
module.exports.describe = function({testRunner, expect, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = 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)
diff --git a/test/firefox/launcher.spec.js b/test/firefox/launcher.spec.js
index be3358332e..399604abb5 100644
--- a/test/firefox/launcher.spec.js
+++ b/test/firefox/launcher.spec.js
@@ -24,7 +24,7 @@ const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-');
module.exports.describe = function ({ testRunner, expect, defaultBrowserOptions, playwright }) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('FFPlaywright', function() {
diff --git a/test/fixtures.spec.js b/test/fixtures.spec.js
index 674f7b8f8a..2f7a0f1ea0 100644
--- a/test/fixtures.spec.js
+++ b/test/fixtures.spec.js
@@ -19,7 +19,7 @@ const path = require('path');
module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, playwrightPath, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe.skip(WEBKIT)('Fixtures', function() {
diff --git a/test/frame.spec.js b/test/frame.spec.js
index bd1dfe1f4b..ac5eee1eaa 100644
--- a/test/frame.spec.js
+++ b/test/frame.spec.js
@@ -19,7 +19,7 @@ const utils = require('./utils');
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Frame.evaluateHandle', function() {
diff --git a/test/ignorehttpserrors.spec.js b/test/ignorehttpserrors.spec.js
index be76898532..65a7911afa 100644
--- a/test/ignorehttpserrors.spec.js
+++ b/test/ignorehttpserrors.spec.js
@@ -17,7 +17,7 @@
module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('ignoreHTTPSErrors', function() {
it('should work', async({newPage, httpsServer}) => {
diff --git a/test/input.spec.js b/test/input.spec.js
index 0c5c3d98af..80c3334357 100644
--- a/test/input.spec.js
+++ b/test/input.spec.js
@@ -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}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('input', function() {
it('should upload the file', async({page, server}) => {
diff --git a/test/jshandle.spec.js b/test/jshandle.spec.js
index 92e004051f..798c5f90e4 100644
--- a/test/jshandle.spec.js
+++ b/test/jshandle.spec.js
@@ -17,7 +17,7 @@
module.exports.describe = function({testRunner, expect, CHROME, FFOX, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Page.evaluateHandle', function() {
diff --git a/test/keyboard.spec.js b/test/keyboard.spec.js
index 0d77ef3d02..9a3dad33ef 100644
--- a/test/keyboard.spec.js
+++ b/test/keyboard.spec.js
@@ -20,7 +20,7 @@ const os = require('os');
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT, MAC}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Keyboard', function() {
diff --git a/test/launcher.spec.js b/test/launcher.spec.js
index 74f7fe6720..3f9b3235e1 100644
--- a/test/launcher.spec.js
+++ b/test/launcher.spec.js
@@ -25,7 +25,7 @@ const utils = require('./utils');
module.exports.describe = function({testRunner, expect, defaultBrowserOptions, playwright, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Playwright', function() {
diff --git a/test/mouse.spec.js b/test/mouse.spec.js
index 00b78ec1bf..b8f5d1fa34 100644
--- a/test/mouse.spec.js
+++ b/test/mouse.spec.js
@@ -28,7 +28,7 @@ function dimensions() {
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT, MAC}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Mouse', function() {
diff --git a/test/navigation.spec.js b/test/navigation.spec.js
index e2da546793..ab7070f9ef 100644
--- a/test/navigation.spec.js
+++ b/test/navigation.spec.js
@@ -20,7 +20,7 @@ const { performance } = require('perf_hooks');
module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Page.goto', function() {
diff --git a/test/network.spec.js b/test/network.spec.js
index 702578239a..91e1dcee0d 100644
--- a/test/network.spec.js
+++ b/test/network.spec.js
@@ -21,7 +21,7 @@ const utils = require('./utils');
module.exports.describe = function({testRunner, expect, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Page.Events.Request', function() {
diff --git a/test/page.spec.js b/test/page.spec.js
index e95fb96a19..c963484672 100644
--- a/test/page.spec.js
+++ b/test/page.spec.js
@@ -21,7 +21,7 @@ const {waitEvent} = utils;
module.exports.describe = function({testRunner, expect, headless, playwright, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Page.close', function() {
diff --git a/test/playwright.spec.js b/test/playwright.spec.js
index 6471a739ec..40d2f01e8f 100644
--- a/test/playwright.spec.js
+++ b/test/playwright.spec.js
@@ -26,7 +26,7 @@ const RESET_COLOR = '\x1b[0m';
module.exports.describe = ({testRunner, product, playwrightPath}) => {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
const CHROME = product === 'Chromium';
diff --git a/test/queryselector.spec.js b/test/queryselector.spec.js
index 70ff0c1cb4..24908de976 100644
--- a/test/queryselector.spec.js
+++ b/test/queryselector.spec.js
@@ -17,7 +17,7 @@
module.exports.describe = function({testRunner, expect, product, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Page.$eval', function() {
diff --git a/test/screenshot.spec.js b/test/screenshot.spec.js
index 201d4f3cf4..75e37ab85c 100644
--- a/test/screenshot.spec.js
+++ b/test/screenshot.spec.js
@@ -17,7 +17,7 @@
module.exports.describe = function({testRunner, expect, product, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Page.screenshot', function() {
diff --git a/test/waittask.spec.js b/test/waittask.spec.js
index 382a8994c8..d35c5898d6 100644
--- a/test/waittask.spec.js
+++ b/test/waittask.spec.js
@@ -19,7 +19,7 @@ const utils = require('./utils');
module.exports.describe = function({testRunner, expect, product, playwright, FFOX, CHROME, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Page.waitFor', function() {
diff --git a/test/webkit/launcher.spec.js b/test/webkit/launcher.spec.js
index 8b2c437283..b02423c52b 100644
--- a/test/webkit/launcher.spec.js
+++ b/test/webkit/launcher.spec.js
@@ -25,7 +25,7 @@ const utils = require('../utils');
module.exports.describe = function ({ testRunner, expect, playwright }) {
const {describe, xdescribe, fdescribe} = testRunner;
- const {it, fit, xit} = testRunner;
+ const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('WKPlaywright', function() {
diff --git a/utils/testrunner/TestRunner.js b/utils/testrunner/TestRunner.js
index 9f38619328..c9f4589a0c 100644
--- a/utils/testrunner/TestRunner.js
+++ b/utils/testrunner/TestRunner.js
@@ -14,9 +14,17 @@
* limitations under the License.
*/
+const util = require('util');
+const url = require('url');
+const inspector = require('inspector');
const path = require('path');
const EventEmitter = require('events');
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 TerminatedError = new Error('Terminated');
@@ -71,8 +79,8 @@ class UserCallback {
if (!match)
return null;
const filePath = match[1];
- const lineNumber = match[2];
- const columnNumber = match[3];
+ const lineNumber = parseInt(match[2], 10);
+ const columnNumber = parseInt(match[3], 10);
if (filePath === __filename)
continue;
const fileName = filePath.split(path.sep).pop();
@@ -294,18 +302,17 @@ class TestRunner extends EventEmitter {
this._rootSuite = new Suite(null, '', TestMode.Run);
this._currentSuite = this._rootSuite;
this._tests = [];
- this._timeout = timeout === 0 ? 2147483647 : timeout;
+ this._timeout = timeout === 0 ? INFINITE_TIMEOUT : timeout;
this._parallel = parallel;
this._breakOnFailure = breakOnFailure;
this._hasFocusedTestsOrSuites = false;
if (MAJOR_NODEJS_VERSION >= 8 && disableTimeoutWhenInspectorIsEnabled) {
- const inspector = require('inspector');
if (inspector.url()) {
console.log('TestRunner detected inspector; overriding certain properties to be debugger-friendly');
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.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.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.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._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.beforeEach = this._addHook.bind(this, 'beforeEach');
this.afterAll = this._addHook.bind(this, 'afterAll');
@@ -339,15 +355,16 @@ class TestRunner extends EventEmitter {
this._addSuite(TestMode.Skip, '', module.xdescribe, ...args);
}
- _addTest(mode, name, callback) {
+ _addTest(name, callback, mode, timeout) {
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);
+ const test = new Test(this._currentSuite, name, callback, isSkipped ? TestMode.Skip : mode, timeout);
this._currentSuite.children.push(test);
this._tests.push(test);
this._hasFocusedTestsOrSuites = this._hasFocusedTestsOrSuites || mode === TestMode.Focus;
+ return test;
}
_addSuite(mode, name, callback, ...args) {
@@ -367,6 +384,7 @@ class TestRunner extends EventEmitter {
}
async run() {
+ let session = this._debuggerLogBreakpointLines.size ? await setLogBreakpoints(this._debuggerLogBreakpointLines) : null;
const runnableTests = this._runnableTests();
this.emit(TestRunner.Events.Started, runnableTests);
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;
}
this.emit(TestRunner.Events.Finished, result);
+ if (session)
+ session.disconnect();
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 {string=} message
diff --git a/utils/testrunner/test/testrunner.spec.js b/utils/testrunner/test/testrunner.spec.js
index e1d47edac4..1f1af0ae06 100644
--- a/utils/testrunner/test/testrunner.spec.js
+++ b/utils/testrunner/test/testrunner.spec.js
@@ -381,20 +381,6 @@ module.exports.addTests = function({testRunner, expect}) {
await t.run();
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', () => {