@playwright/test 1.35.0-alpha-jun-6-2023 → 1.35.0-beta-1686166896000
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli.js +5 -2
- package/lib/matchers/toMatchSnapshot.js +1 -0
- package/lib/reporters/html.js +3 -9
- package/lib/reporters/internalReporter.js +6 -1
- package/lib/reporters/merge.js +5 -2
- package/lib/runner/runner.js +2 -2
- package/lib/runner/uiMode.js +53 -66
- package/lib/worker/testInfo.js +1 -1
- package/package.json +2 -2
- package/types/test.d.ts +32 -8
package/lib/cli.js
CHANGED
|
@@ -126,7 +126,10 @@ async function runTests(args, opts) {
|
|
|
126
126
|
config.cliPassWithNoTests = !!opts.passWithNoTests;
|
|
127
127
|
const runner = new _runner.Runner(config);
|
|
128
128
|
let status;
|
|
129
|
-
if (opts.ui
|
|
129
|
+
if (opts.ui || opts.uiHost || opts.uiPort) status = await runner.uiAllTests({
|
|
130
|
+
host: opts.uiHost,
|
|
131
|
+
port: opts.uiPort ? +opts.uiPort : undefined
|
|
132
|
+
});else if (process.env.PWTEST_WATCH) status = await runner.watchAllTests();else status = await runner.runAllTests();
|
|
130
133
|
await (0, _utils.stopProfiling)('runner');
|
|
131
134
|
if (status === 'interrupted') process.exit(130);
|
|
132
135
|
process.exit(status === 'passed' ? 0 : 1);
|
|
@@ -262,7 +265,7 @@ function restartWithExperimentalTsEsm(configFile) {
|
|
|
262
265
|
return true;
|
|
263
266
|
}
|
|
264
267
|
const kTraceModes = ['on', 'off', 'on-first-retry', 'on-all-retries', 'retain-on-failure'];
|
|
265
|
-
const testOptions = [['--browser <browser>', `Browser to use for tests, one of "all", "chromium", "firefox" or "webkit" (default: "chromium")`], ['-c, --config <file>', `Configuration file, or a test directory with optional "playwright.config.{m,c}?{js,ts}"`], ['--debug', `Run tests with Playwright Inspector. Shortcut for "PWDEBUG=1" environment variable and "--timeout=0 --max-failures=1 --headed --workers=1" options`], ['--forbid-only', `Fail if test.only is called (default: false)`], ['--fully-parallel', `Run all tests in parallel (default: false)`], ['--global-timeout <timeout>', `Maximum time this test suite can run in milliseconds (default: unlimited)`], ['-g, --grep <grep>', `Only run tests matching this regular expression (default: ".*")`], ['-gv, --grep-invert <grep>', `Only run tests that do not match this regular expression`], ['--headed', `Run tests in headed browsers (default: headless)`], ['--ignore-snapshots', `Ignore screenshot and snapshot expectations`], ['--list', `Collect all the tests and report them, but do not run`], ['--max-failures <N>', `Stop after the first N failures`], ['--no-deps', 'Do not run project dependencies'], ['--output <dir>', `Folder for output artifacts (default: "test-results")`], ['--pass-with-no-tests', `Makes test run succeed even if no tests were found`], ['--project <project-name...>', `Only run tests from the specified list of projects (default: run all projects)`], ['--quiet', `Suppress stdio`], ['--repeat-each <N>', `Run each test N times (default: 1)`], ['--reporter <reporter>', `Reporter to use, comma-separated, can be ${_config.builtInReporters.map(name => `"${name}"`).join(', ')} (default: "${_config.defaultReporter}")`], ['--retries <retries>', `Maximum retry count for flaky tests, zero for no retries (default: no retries)`], ['--shard <shard>', `Shard tests and execute only the selected shard, specify in the form "current/all", 1-based, for example "3/5"`], ['--timeout <timeout>', `Specify test timeout threshold in milliseconds, zero for unlimited (default: ${_config.defaultTimeout})`], ['--trace <mode>', `Force tracing mode, can be ${kTraceModes.map(mode => `"${mode}"`).join(', ')}`], ['--ui', `Run tests in interactive UI mode`], ['-u, --update-snapshots', `Update snapshots with actual results (default: only create missing snapshots)`], ['-j, --workers <workers>', `Number of concurrent workers or percentage of logical CPU cores, use 1 to run in a single worker (default: 50%)`], ['-x', `Stop after the first failure`]];
|
|
268
|
+
const testOptions = [['--browser <browser>', `Browser to use for tests, one of "all", "chromium", "firefox" or "webkit" (default: "chromium")`], ['-c, --config <file>', `Configuration file, or a test directory with optional "playwright.config.{m,c}?{js,ts}"`], ['--debug', `Run tests with Playwright Inspector. Shortcut for "PWDEBUG=1" environment variable and "--timeout=0 --max-failures=1 --headed --workers=1" options`], ['--forbid-only', `Fail if test.only is called (default: false)`], ['--fully-parallel', `Run all tests in parallel (default: false)`], ['--global-timeout <timeout>', `Maximum time this test suite can run in milliseconds (default: unlimited)`], ['-g, --grep <grep>', `Only run tests matching this regular expression (default: ".*")`], ['-gv, --grep-invert <grep>', `Only run tests that do not match this regular expression`], ['--headed', `Run tests in headed browsers (default: headless)`], ['--ignore-snapshots', `Ignore screenshot and snapshot expectations`], ['--list', `Collect all the tests and report them, but do not run`], ['--max-failures <N>', `Stop after the first N failures`], ['--no-deps', 'Do not run project dependencies'], ['--output <dir>', `Folder for output artifacts (default: "test-results")`], ['--pass-with-no-tests', `Makes test run succeed even if no tests were found`], ['--project <project-name...>', `Only run tests from the specified list of projects (default: run all projects)`], ['--quiet', `Suppress stdio`], ['--repeat-each <N>', `Run each test N times (default: 1)`], ['--reporter <reporter>', `Reporter to use, comma-separated, can be ${_config.builtInReporters.map(name => `"${name}"`).join(', ')} (default: "${_config.defaultReporter}")`], ['--retries <retries>', `Maximum retry count for flaky tests, zero for no retries (default: no retries)`], ['--shard <shard>', `Shard tests and execute only the selected shard, specify in the form "current/all", 1-based, for example "3/5"`], ['--timeout <timeout>', `Specify test timeout threshold in milliseconds, zero for unlimited (default: ${_config.defaultTimeout})`], ['--trace <mode>', `Force tracing mode, can be ${kTraceModes.map(mode => `"${mode}"`).join(', ')}`], ['--ui', `Run tests in interactive UI mode`], ['--ui-host <host>', 'Host to serve UI on; specifying this option opens UI in a browser tab'], ['--ui-port <port>', 'Port to serve UI on, 0 for any free port; specifying this option opens UI in a browser tab'], ['-u, --update-snapshots', `Update snapshots with actual results (default: only create missing snapshots)`], ['-j, --workers <workers>', `Number of concurrent workers or percentage of logical CPU cores, use 1 to run in a single worker (default: 50%)`], ['-x', `Stop after the first failure`]];
|
|
266
269
|
addTestCommand(_program.default);
|
|
267
270
|
addShowReportCommand(_program.default);
|
|
268
271
|
addListFilesCommand(_program.default);
|
|
@@ -288,6 +288,7 @@ async function toHaveScreenshot(pageOrLocator, nameOrOptions = {}, optOptions =
|
|
|
288
288
|
caret: (_config$caret = config === null || config === void 0 ? void 0 : config.caret) !== null && _config$caret !== void 0 ? _config$caret : 'hide',
|
|
289
289
|
...helper.allOptions,
|
|
290
290
|
mask: helper.allOptions.mask || [],
|
|
291
|
+
maskColor: helper.allOptions.maskColor,
|
|
291
292
|
name: undefined,
|
|
292
293
|
threshold: undefined,
|
|
293
294
|
maxDiffPixels: undefined,
|
package/lib/reporters/html.js
CHANGED
|
@@ -36,7 +36,6 @@ class HtmlReporter {
|
|
|
36
36
|
constructor(options) {
|
|
37
37
|
this.config = void 0;
|
|
38
38
|
this.suite = void 0;
|
|
39
|
-
this._montonicStartTime = 0;
|
|
40
39
|
this._options = void 0;
|
|
41
40
|
this._outputFolder = void 0;
|
|
42
41
|
this._attachmentsBaseURL = void 0;
|
|
@@ -48,7 +47,6 @@ class HtmlReporter {
|
|
|
48
47
|
return false;
|
|
49
48
|
}
|
|
50
49
|
onBegin(config, suite) {
|
|
51
|
-
this._montonicStartTime = (0, _utils.monotonicTime)();
|
|
52
50
|
this.config = config;
|
|
53
51
|
const {
|
|
54
52
|
outputFolder,
|
|
@@ -88,7 +86,6 @@ class HtmlReporter {
|
|
|
88
86
|
};
|
|
89
87
|
}
|
|
90
88
|
async onEnd() {
|
|
91
|
-
const duration = (0, _utils.monotonicTime)() - this._montonicStartTime;
|
|
92
89
|
const projectSuites = this.suite.suites;
|
|
93
90
|
const reports = projectSuites.map(suite => {
|
|
94
91
|
const rawReporter = new _raw.default();
|
|
@@ -97,10 +94,7 @@ class HtmlReporter {
|
|
|
97
94
|
});
|
|
98
95
|
await (0, _utils.removeFolders)([this._outputFolder]);
|
|
99
96
|
const builder = new HtmlBuilder(this._outputFolder, this._attachmentsBaseURL);
|
|
100
|
-
this._buildResult = await builder.build(
|
|
101
|
-
...this.config.metadata,
|
|
102
|
-
duration
|
|
103
|
-
}, reports);
|
|
97
|
+
this._buildResult = await builder.build(this.config.metadata, reports);
|
|
104
98
|
}
|
|
105
99
|
async onExit() {
|
|
106
100
|
if (process.env.CI || !this._buildResult) return;
|
|
@@ -154,7 +148,7 @@ async function showHTMLReport(reportFolder, host = 'localhost', port, testId) {
|
|
|
154
148
|
if (testId) url += `#?testId=${testId}`;
|
|
155
149
|
await (0, _utilsBundle.open)(url, {
|
|
156
150
|
wait: true
|
|
157
|
-
}).catch(() =>
|
|
151
|
+
}).catch(() => {});
|
|
158
152
|
await new Promise(() => {});
|
|
159
153
|
}
|
|
160
154
|
function startHtmlReportServer(folder) {
|
|
@@ -256,7 +250,7 @@ class HtmlBuilder {
|
|
|
256
250
|
projectNames: rawReports.map(r => r.project.name),
|
|
257
251
|
stats: {
|
|
258
252
|
...[...data.values()].reduce((a, e) => addStats(a, e.testFileSummary.stats), emptyStats()),
|
|
259
|
-
duration: metadata.
|
|
253
|
+
duration: metadata.totalTime
|
|
260
254
|
}
|
|
261
255
|
};
|
|
262
256
|
htmlReport.files.sort((f1, f2) => {
|
|
@@ -10,6 +10,7 @@ var _babelBundle = require("../transform/babelBundle");
|
|
|
10
10
|
var _test = require("../common/test");
|
|
11
11
|
var _multiplexer = require("./multiplexer");
|
|
12
12
|
var _base = require("./base");
|
|
13
|
+
var _utils = require("playwright-core/lib/utils");
|
|
13
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
15
|
/**
|
|
15
16
|
* Copyright (c) Microsoft Corporation.
|
|
@@ -32,12 +33,14 @@ class InternalReporter {
|
|
|
32
33
|
this._multiplexer = void 0;
|
|
33
34
|
this._deferred = [];
|
|
34
35
|
this._config = void 0;
|
|
36
|
+
this._montonicStartTime = 0;
|
|
35
37
|
this._multiplexer = new _multiplexer.Multiplexer(reporters);
|
|
36
38
|
}
|
|
37
39
|
onConfigure(config) {
|
|
38
40
|
this._config = config;
|
|
39
41
|
}
|
|
40
42
|
onBegin(config, suite) {
|
|
43
|
+
this._montonicStartTime = (0, _utils.monotonicTime)();
|
|
41
44
|
this._multiplexer.onBegin(config, suite);
|
|
42
45
|
const deferred = this._deferred;
|
|
43
46
|
this._deferred = null;
|
|
@@ -80,7 +83,9 @@ class InternalReporter {
|
|
|
80
83
|
this._addSnippetToTestErrors(test, result);
|
|
81
84
|
this._multiplexer.onTestEnd(test, result);
|
|
82
85
|
}
|
|
83
|
-
async onEnd() {
|
|
86
|
+
async onEnd() {
|
|
87
|
+
this._config.config.metadata.totalTime = (0, _utils.monotonicTime)() - this._montonicStartTime;
|
|
88
|
+
}
|
|
84
89
|
async onExit(result) {
|
|
85
90
|
if (this._deferred) {
|
|
86
91
|
// onBegin was not reported, emit it.
|
package/lib/reporters/merge.js
CHANGED
|
@@ -70,7 +70,9 @@ function mergeBeginEvents(beginEvents) {
|
|
|
70
70
|
configFile: undefined,
|
|
71
71
|
globalTimeout: 0,
|
|
72
72
|
maxFailures: 0,
|
|
73
|
-
metadata: {
|
|
73
|
+
metadata: {
|
|
74
|
+
totalTime: 0
|
|
75
|
+
},
|
|
74
76
|
rootDir: '',
|
|
75
77
|
version: '',
|
|
76
78
|
workers: 0,
|
|
@@ -98,7 +100,8 @@ function mergeConfigs(to, from) {
|
|
|
98
100
|
...from,
|
|
99
101
|
metadata: {
|
|
100
102
|
...to.metadata,
|
|
101
|
-
...from.metadata
|
|
103
|
+
...from.metadata,
|
|
104
|
+
totalTime: to.metadata.totalTime + from.metadata.totalTime
|
|
102
105
|
},
|
|
103
106
|
workers: to.workers + from.workers
|
|
104
107
|
};
|
package/lib/runner/runner.js
CHANGED
|
@@ -93,12 +93,12 @@ class Runner {
|
|
|
93
93
|
}));
|
|
94
94
|
return await (0, _watchMode.runWatchModeLoop)(config);
|
|
95
95
|
}
|
|
96
|
-
async uiAllTests() {
|
|
96
|
+
async uiAllTests(options) {
|
|
97
97
|
const config = this._config;
|
|
98
98
|
(0, _webServerPlugin.webServerPluginsForConfig)(config).forEach(p => config.plugins.push({
|
|
99
99
|
factory: p
|
|
100
100
|
}));
|
|
101
|
-
return await (0, _uiMode.runUIMode)(config);
|
|
101
|
+
return await (0, _uiMode.runUIMode)(config, options);
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
exports.Runner = Runner;
|
package/lib/runner/uiMode.js
CHANGED
|
@@ -34,7 +34,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
34
34
|
class UIMode {
|
|
35
35
|
constructor(config) {
|
|
36
36
|
this._config = void 0;
|
|
37
|
-
this.
|
|
37
|
+
this._transport = void 0;
|
|
38
38
|
this._testRun = void 0;
|
|
39
39
|
this.globalCleanup = void 0;
|
|
40
40
|
this._globalWatcher = void 0;
|
|
@@ -60,17 +60,12 @@ class UIMode {
|
|
|
60
60
|
};
|
|
61
61
|
this._originalStdoutWrite = process.stdout.write;
|
|
62
62
|
this._originalStderrWrite = process.stderr.write;
|
|
63
|
-
this._globalWatcher = new Watcher('deep', () => this._dispatchEvent({
|
|
64
|
-
method: 'listChanged'
|
|
65
|
-
}));
|
|
63
|
+
this._globalWatcher = new Watcher('deep', () => this._dispatchEvent('listChanged', {}));
|
|
66
64
|
this._testWatcher = new Watcher('flat', events => {
|
|
67
65
|
const collector = new Set();
|
|
68
66
|
events.forEach(f => (0, _compilationCache.collectAffectedTestFiles)(f.file, collector));
|
|
69
|
-
this._dispatchEvent({
|
|
70
|
-
|
|
71
|
-
params: {
|
|
72
|
-
testFileNames: [...collector]
|
|
73
|
-
}
|
|
67
|
+
this._dispatchEvent('testFilesChanged', {
|
|
68
|
+
testFileNames: [...collector]
|
|
74
69
|
});
|
|
75
70
|
});
|
|
76
71
|
}
|
|
@@ -93,61 +88,58 @@ class UIMode {
|
|
|
93
88
|
this.globalCleanup = globalCleanup;
|
|
94
89
|
return status;
|
|
95
90
|
}
|
|
96
|
-
async showUI() {
|
|
97
|
-
|
|
91
|
+
async showUI(options) {
|
|
92
|
+
const exitPromise = new _utils.ManualPromise();
|
|
93
|
+
let queue = Promise.resolve();
|
|
94
|
+
this._transport = {
|
|
95
|
+
dispatch: async (method, params) => {
|
|
96
|
+
if (method === 'ping') return;
|
|
97
|
+
if (method === 'exit') {
|
|
98
|
+
exitPromise.resolve();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (method === 'watch') {
|
|
102
|
+
this._watchFiles(params.fileNames);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (method === 'open' && params.location) {
|
|
106
|
+
(0, _utilsBundle2.open)('vscode://file/' + params.location).catch(e => this._originalStderrWrite.call(process.stderr, String(e)));
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (method === 'resizeTerminal') {
|
|
110
|
+
process.stdout.columns = params.cols;
|
|
111
|
+
process.stdout.rows = params.rows;
|
|
112
|
+
process.stderr.columns = params.cols;
|
|
113
|
+
process.stderr.columns = params.rows;
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (method === 'stop') {
|
|
117
|
+
void this._stopTests();
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
queue = queue.then(() => this._queueListOrRun(method, params));
|
|
121
|
+
await queue;
|
|
122
|
+
},
|
|
123
|
+
onclose: () => exitPromise.resolve()
|
|
124
|
+
};
|
|
125
|
+
await (0, _server.showTraceViewer)([], 'chromium', {
|
|
98
126
|
app: 'uiMode.html',
|
|
99
|
-
headless: (0, _utils.isUnderTest)() && process.env.PWTEST_HEADED_FOR_TEST !== '1'
|
|
127
|
+
headless: (0, _utils.isUnderTest)() && process.env.PWTEST_HEADED_FOR_TEST !== '1',
|
|
128
|
+
transport: this._transport,
|
|
129
|
+
host: options.host,
|
|
130
|
+
port: options.port,
|
|
131
|
+
openInBrowser: options.host !== undefined || options.port !== undefined
|
|
100
132
|
});
|
|
101
133
|
if (!process.env.PWTEST_DEBUG) {
|
|
102
134
|
process.stdout.write = chunk => {
|
|
103
|
-
this._dispatchEvent(
|
|
104
|
-
method: 'stdio',
|
|
105
|
-
params: chunkToPayload('stdout', chunk)
|
|
106
|
-
});
|
|
135
|
+
this._dispatchEvent('stdio', chunkToPayload('stdout', chunk));
|
|
107
136
|
return true;
|
|
108
137
|
};
|
|
109
138
|
process.stderr.write = chunk => {
|
|
110
|
-
this._dispatchEvent(
|
|
111
|
-
method: 'stdio',
|
|
112
|
-
params: chunkToPayload('stderr', chunk)
|
|
113
|
-
});
|
|
139
|
+
this._dispatchEvent('stdio', chunkToPayload('stderr', chunk));
|
|
114
140
|
return true;
|
|
115
141
|
};
|
|
116
142
|
}
|
|
117
|
-
const exitPromise = new _utils.ManualPromise();
|
|
118
|
-
this._page.on('close', () => exitPromise.resolve());
|
|
119
|
-
let queue = Promise.resolve();
|
|
120
|
-
await this._page.exposeBinding('sendMessage', false, async (source, data) => {
|
|
121
|
-
const {
|
|
122
|
-
method,
|
|
123
|
-
params
|
|
124
|
-
} = data;
|
|
125
|
-
if (method === 'exit') {
|
|
126
|
-
exitPromise.resolve();
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
if (method === 'watch') {
|
|
130
|
-
this._watchFiles(params.fileNames);
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
if (method === 'open' && params.location) {
|
|
134
|
-
(0, _utilsBundle2.open)('vscode://file/' + params.location).catch(e => this._originalStderrWrite.call(process.stderr, String(e)));
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
if (method === 'resizeTerminal') {
|
|
138
|
-
process.stdout.columns = params.cols;
|
|
139
|
-
process.stdout.rows = params.rows;
|
|
140
|
-
process.stderr.columns = params.cols;
|
|
141
|
-
process.stderr.columns = params.rows;
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
if (method === 'stop') {
|
|
145
|
-
void this._stopTests();
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
queue = queue.then(() => this._queueListOrRun(method, params));
|
|
149
|
-
await queue;
|
|
150
|
-
});
|
|
151
143
|
await exitPromise;
|
|
152
144
|
if (!process.env.PWTEST_DEBUG) {
|
|
153
145
|
process.stdout.write = this._originalStdoutWrite;
|
|
@@ -158,14 +150,12 @@ class UIMode {
|
|
|
158
150
|
if (method === 'list') await this._listTests();
|
|
159
151
|
if (method === 'run') await this._runTests(params.testIds);
|
|
160
152
|
}
|
|
161
|
-
_dispatchEvent(
|
|
162
|
-
|
|
163
|
-
this.
|
|
164
|
-
isFunction: true
|
|
165
|
-
}, message).catch(e => this._originalStderrWrite.call(process.stderr, String(e)));
|
|
153
|
+
_dispatchEvent(method, params) {
|
|
154
|
+
var _this$_transport$send, _this$_transport;
|
|
155
|
+
(_this$_transport$send = (_this$_transport = this._transport).sendEvent) === null || _this$_transport$send === void 0 ? void 0 : _this$_transport$send.call(_this$_transport, method, params);
|
|
166
156
|
}
|
|
167
157
|
async _listTests() {
|
|
168
|
-
const listReporter = new _teleEmitter.TeleReporterEmitter(e => this._dispatchEvent(e));
|
|
158
|
+
const listReporter = new _teleEmitter.TeleReporterEmitter(e => this._dispatchEvent(e.method, e.params));
|
|
169
159
|
const reporter = new _internalReporter.InternalReporter([listReporter]);
|
|
170
160
|
this._config.cliListOnly = true;
|
|
171
161
|
this._config.testIdMatcher = undefined;
|
|
@@ -189,7 +179,7 @@ class UIMode {
|
|
|
189
179
|
this._config.cliListOnly = false;
|
|
190
180
|
this._config.testIdMatcher = id => !testIdSet || testIdSet.has(id);
|
|
191
181
|
const reporters = await (0, _reporters.createReporters)(this._config, 'ui');
|
|
192
|
-
reporters.push(new _teleEmitter.TeleReporterEmitter(e => this._dispatchEvent(e)));
|
|
182
|
+
reporters.push(new _teleEmitter.TeleReporterEmitter(e => this._dispatchEvent(e.method, e.params)));
|
|
193
183
|
const reporter = new _internalReporter.InternalReporter(reporters);
|
|
194
184
|
const taskRunner = (0, _tasks.createTaskRunnerForWatch)(this._config, reporter);
|
|
195
185
|
const testRun = new _tasks.TestRun(this._config, reporter);
|
|
@@ -224,15 +214,12 @@ class UIMode {
|
|
|
224
214
|
await ((_this$_testRun2 = this._testRun) === null || _this$_testRun2 === void 0 ? void 0 : _this$_testRun2.run);
|
|
225
215
|
}
|
|
226
216
|
}
|
|
227
|
-
|
|
228
|
-
window.dispatch(message);
|
|
229
|
-
});
|
|
230
|
-
async function runUIMode(config) {
|
|
217
|
+
async function runUIMode(config, options) {
|
|
231
218
|
var _uiMode$globalCleanup;
|
|
232
219
|
const uiMode = new UIMode(config);
|
|
233
220
|
const status = await uiMode.runGlobalSetup();
|
|
234
221
|
if (status !== 'passed') return status;
|
|
235
|
-
await uiMode.showUI();
|
|
222
|
+
await uiMode.showUI(options);
|
|
236
223
|
return (await ((_uiMode$globalCleanup = uiMode.globalCleanup) === null || _uiMode$globalCleanup === void 0 ? void 0 : _uiMode$globalCleanup.call(uiMode))) || 'passed';
|
|
237
224
|
}
|
|
238
225
|
function chunkToPayload(type, chunk) {
|
package/lib/worker/testInfo.js
CHANGED
|
@@ -175,7 +175,7 @@ class TestInfoImpl {
|
|
|
175
175
|
}
|
|
176
176
|
_addStep(data, parentStep) {
|
|
177
177
|
var _parentStep;
|
|
178
|
-
const stepId = `${data.category}@${
|
|
178
|
+
const stepId = `${data.category}@${++this._lastStepId}`;
|
|
179
179
|
if (!parentStep) parentStep = _utils.zones.zoneData('stepZone', (0, _utils.captureRawStack)()) || undefined;
|
|
180
180
|
|
|
181
181
|
// For out-of-stack calls, locate the enclosing step.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playwright/test",
|
|
3
|
-
"version": "1.35.0-
|
|
3
|
+
"version": "1.35.0-beta-1686166896000",
|
|
4
4
|
"description": "A high-level API to automate web browsers",
|
|
5
5
|
"repository": "github:Microsoft/playwright",
|
|
6
6
|
"homepage": "https://playwright.dev",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"license": "Apache-2.0",
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@types/node": "*",
|
|
44
|
-
"playwright-core": "1.35.0-
|
|
44
|
+
"playwright-core": "1.35.0-beta-1686166896000"
|
|
45
45
|
},
|
|
46
46
|
"optionalDependencies": {
|
|
47
47
|
"fsevents": "2.3.2"
|
package/types/test.d.ts
CHANGED
|
@@ -570,7 +570,7 @@ interface TestConfig {
|
|
|
570
570
|
*/
|
|
571
571
|
webServer?: TestConfigWebServer | TestConfigWebServer[];
|
|
572
572
|
/**
|
|
573
|
-
*
|
|
573
|
+
* Playwright transpiler configuration.
|
|
574
574
|
*
|
|
575
575
|
* **Usage**
|
|
576
576
|
*
|
|
@@ -580,7 +580,7 @@ interface TestConfig {
|
|
|
580
580
|
*
|
|
581
581
|
* export default defineConfig({
|
|
582
582
|
* build: {
|
|
583
|
-
* external: '**\/*bundle.js',
|
|
583
|
+
* external: ['**\/*bundle.js'],
|
|
584
584
|
* },
|
|
585
585
|
* });
|
|
586
586
|
* ```
|
|
@@ -588,8 +588,8 @@ interface TestConfig {
|
|
|
588
588
|
*/
|
|
589
589
|
build?: {
|
|
590
590
|
/**
|
|
591
|
-
* Paths to exclude from the transpilation expressed as glob patterns. Typically heavy JS bundles your
|
|
592
|
-
*
|
|
591
|
+
* Paths to exclude from the transpilation expressed as a list of glob patterns. Typically heavy JS bundles that your
|
|
592
|
+
* test uses are listed here.
|
|
593
593
|
*/
|
|
594
594
|
external?: Array<string>;
|
|
595
595
|
};
|
|
@@ -5337,10 +5337,16 @@ interface LocatorAssertions {
|
|
|
5337
5337
|
|
|
5338
5338
|
/**
|
|
5339
5339
|
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink
|
|
5340
|
-
* box `#FF00FF` that completely covers its bounding box.
|
|
5340
|
+
* box `#FF00FF` (customized by `maskColor`) that completely covers its bounding box.
|
|
5341
5341
|
*/
|
|
5342
5342
|
mask?: Array<Locator>;
|
|
5343
5343
|
|
|
5344
|
+
/**
|
|
5345
|
+
* Specify the color of the overlay box for masked elements, in
|
|
5346
|
+
* [CSS color format](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value). Default color is pink `#FF00FF`.
|
|
5347
|
+
*/
|
|
5348
|
+
maskColor?: string;
|
|
5349
|
+
|
|
5344
5350
|
/**
|
|
5345
5351
|
* An acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1`. Default is
|
|
5346
5352
|
* configurable with `TestConfig.expect`. Unset by default.
|
|
@@ -5414,10 +5420,16 @@ interface LocatorAssertions {
|
|
|
5414
5420
|
|
|
5415
5421
|
/**
|
|
5416
5422
|
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink
|
|
5417
|
-
* box `#FF00FF` that completely covers its bounding box.
|
|
5423
|
+
* box `#FF00FF` (customized by `maskColor`) that completely covers its bounding box.
|
|
5418
5424
|
*/
|
|
5419
5425
|
mask?: Array<Locator>;
|
|
5420
5426
|
|
|
5427
|
+
/**
|
|
5428
|
+
* Specify the color of the overlay box for masked elements, in
|
|
5429
|
+
* [CSS color format](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value). Default color is pink `#FF00FF`.
|
|
5430
|
+
*/
|
|
5431
|
+
maskColor?: string;
|
|
5432
|
+
|
|
5421
5433
|
/**
|
|
5422
5434
|
* An acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1`. Default is
|
|
5423
5435
|
* configurable with `TestConfig.expect`. Unset by default.
|
|
@@ -5667,10 +5679,16 @@ interface PageAssertions {
|
|
|
5667
5679
|
|
|
5668
5680
|
/**
|
|
5669
5681
|
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink
|
|
5670
|
-
* box `#FF00FF` that completely covers its bounding box.
|
|
5682
|
+
* box `#FF00FF` (customized by `maskColor`) that completely covers its bounding box.
|
|
5671
5683
|
*/
|
|
5672
5684
|
mask?: Array<Locator>;
|
|
5673
5685
|
|
|
5686
|
+
/**
|
|
5687
|
+
* Specify the color of the overlay box for masked elements, in
|
|
5688
|
+
* [CSS color format](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value). Default color is pink `#FF00FF`.
|
|
5689
|
+
*/
|
|
5690
|
+
maskColor?: string;
|
|
5691
|
+
|
|
5674
5692
|
/**
|
|
5675
5693
|
* An acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1`. Default is
|
|
5676
5694
|
* configurable with `TestConfig.expect`. Unset by default.
|
|
@@ -5774,10 +5792,16 @@ interface PageAssertions {
|
|
|
5774
5792
|
|
|
5775
5793
|
/**
|
|
5776
5794
|
* Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink
|
|
5777
|
-
* box `#FF00FF` that completely covers its bounding box.
|
|
5795
|
+
* box `#FF00FF` (customized by `maskColor`) that completely covers its bounding box.
|
|
5778
5796
|
*/
|
|
5779
5797
|
mask?: Array<Locator>;
|
|
5780
5798
|
|
|
5799
|
+
/**
|
|
5800
|
+
* Specify the color of the overlay box for masked elements, in
|
|
5801
|
+
* [CSS color format](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value). Default color is pink `#FF00FF`.
|
|
5802
|
+
*/
|
|
5803
|
+
maskColor?: string;
|
|
5804
|
+
|
|
5781
5805
|
/**
|
|
5782
5806
|
* An acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1`. Default is
|
|
5783
5807
|
* configurable with `TestConfig.expect`. Unset by default.
|