playwright 1.55.0-alpha-2025-08-13 → 1.55.0-alpha-2025-08-14
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.
Potentially problematic release.
This version of playwright might be problematic. Click here for more details.
- package/lib/index.js +5 -0
- package/lib/isomorphic/testServerConnection.js +7 -0
- package/lib/matchers/expect.js +21 -8
- package/lib/reporters/markdown.js +3 -3
- package/lib/runner/dispatcher.js +22 -1
- package/lib/runner/failureTracker.js +14 -0
- package/lib/runner/testRunner.js +372 -0
- package/lib/runner/testServer.js +53 -271
- package/lib/runner/watchMode.js +57 -1
- package/lib/runner/workerHost.js +6 -2
- package/lib/worker/testInfo.js +24 -1
- package/lib/worker/workerMain.js +5 -0
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -258,6 +258,11 @@ const playwrightFixtures = {
|
|
|
258
258
|
if (data.apiName === "tracing.group")
|
|
259
259
|
tracingGroupSteps.push(step);
|
|
260
260
|
},
|
|
261
|
+
onApiCallRecovery: (data, error, recoveryHandlers) => {
|
|
262
|
+
const step = data.userData;
|
|
263
|
+
if (step)
|
|
264
|
+
recoveryHandlers.push(() => step.recoverFromStepError(error));
|
|
265
|
+
},
|
|
261
266
|
onApiCallEnd: (data) => {
|
|
262
267
|
if (data.apiName === "tracing.group")
|
|
263
268
|
return;
|
|
@@ -63,6 +63,7 @@ class TestServerConnection {
|
|
|
63
63
|
this._onStdioEmitter = new events.EventEmitter();
|
|
64
64
|
this._onTestFilesChangedEmitter = new events.EventEmitter();
|
|
65
65
|
this._onLoadTraceRequestedEmitter = new events.EventEmitter();
|
|
66
|
+
this._onRecoverFromStepErrorEmitter = new events.EventEmitter();
|
|
66
67
|
this._lastId = 0;
|
|
67
68
|
this._callbacks = /* @__PURE__ */ new Map();
|
|
68
69
|
this._isClosed = false;
|
|
@@ -71,6 +72,7 @@ class TestServerConnection {
|
|
|
71
72
|
this.onStdio = this._onStdioEmitter.event;
|
|
72
73
|
this.onTestFilesChanged = this._onTestFilesChangedEmitter.event;
|
|
73
74
|
this.onLoadTraceRequested = this._onLoadTraceRequestedEmitter.event;
|
|
75
|
+
this.onRecoverFromStepError = this._onRecoverFromStepErrorEmitter.event;
|
|
74
76
|
this._transport = transport;
|
|
75
77
|
this._transport.onmessage((data) => {
|
|
76
78
|
const message = JSON.parse(data);
|
|
@@ -127,6 +129,8 @@ class TestServerConnection {
|
|
|
127
129
|
this._onTestFilesChangedEmitter.fire(params);
|
|
128
130
|
else if (method === "loadTraceRequested")
|
|
129
131
|
this._onLoadTraceRequestedEmitter.fire(params);
|
|
132
|
+
else if (method === "recoverFromStepError")
|
|
133
|
+
this._onRecoverFromStepErrorEmitter.fire(params);
|
|
130
134
|
}
|
|
131
135
|
async initialize(params) {
|
|
132
136
|
await this._sendMessage("initialize", params);
|
|
@@ -197,6 +201,9 @@ class TestServerConnection {
|
|
|
197
201
|
async closeGracefully(params) {
|
|
198
202
|
await this._sendMessage("closeGracefully", params);
|
|
199
203
|
}
|
|
204
|
+
async resumeAfterStepError(params) {
|
|
205
|
+
await this._sendMessage("resumeAfterStepError", params);
|
|
206
|
+
}
|
|
200
207
|
close() {
|
|
201
208
|
try {
|
|
202
209
|
this._transport.close();
|
package/lib/matchers/expect.js
CHANGED
|
@@ -234,18 +234,31 @@ class ExpectMetaInfoProxyHandler {
|
|
|
234
234
|
infectParentStepsWithError: this._info.isSoft
|
|
235
235
|
};
|
|
236
236
|
const step = testInfo._addStep(stepInfo);
|
|
237
|
-
const reportStepError = (e) => {
|
|
237
|
+
const reportStepError = (isAsync, e) => {
|
|
238
238
|
const jestError = (0, import_matcherHint.isJestError)(e) ? e : null;
|
|
239
|
-
const
|
|
239
|
+
const expectError = jestError ? new import_matcherHint.ExpectError(jestError, customMessage, stackFrames) : void 0;
|
|
240
240
|
if (jestError?.matcherResult.suggestedRebaseline) {
|
|
241
241
|
step.complete({ suggestedRebaseline: jestError?.matcherResult.suggestedRebaseline });
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
|
+
const error = expectError ?? e;
|
|
244
245
|
step.complete({ error });
|
|
245
|
-
if (
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
246
|
+
if (!isAsync || !expectError) {
|
|
247
|
+
if (this._info.isSoft)
|
|
248
|
+
testInfo._failWithError(error);
|
|
249
|
+
else
|
|
250
|
+
throw error;
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
return (async () => {
|
|
254
|
+
const recoveryResult = await step.recoverFromStepError(expectError);
|
|
255
|
+
if (recoveryResult.status === "recovered")
|
|
256
|
+
return recoveryResult.value;
|
|
257
|
+
if (this._info.isSoft)
|
|
258
|
+
testInfo._failWithError(expectError);
|
|
259
|
+
else
|
|
260
|
+
throw expectError;
|
|
261
|
+
})();
|
|
249
262
|
};
|
|
250
263
|
const finalizer = () => {
|
|
251
264
|
step.complete({});
|
|
@@ -255,11 +268,11 @@ class ExpectMetaInfoProxyHandler {
|
|
|
255
268
|
const callback = () => matcher.call(target, ...args);
|
|
256
269
|
const result = (0, import_utils.currentZone)().with("stepZone", step).run(callback);
|
|
257
270
|
if (result instanceof Promise)
|
|
258
|
-
return result.then(finalizer).catch(reportStepError);
|
|
271
|
+
return result.then(finalizer).catch(reportStepError.bind(null, true));
|
|
259
272
|
finalizer();
|
|
260
273
|
return result;
|
|
261
274
|
} catch (e) {
|
|
262
|
-
reportStepError(e);
|
|
275
|
+
void reportStepError(false, e);
|
|
263
276
|
}
|
|
264
277
|
};
|
|
265
278
|
}
|
|
@@ -74,7 +74,6 @@ class MarkdownReporter {
|
|
|
74
74
|
const skipped = summary.skipped ? `, ${summary.skipped} skipped` : "";
|
|
75
75
|
const didNotRun = summary.didNotRun ? `, ${summary.didNotRun} did not run` : "";
|
|
76
76
|
lines.push(`**${summary.expected} passed${skipped}${didNotRun}**`);
|
|
77
|
-
lines.push(`:heavy_check_mark::heavy_check_mark::heavy_check_mark:`);
|
|
78
77
|
lines.push(``);
|
|
79
78
|
await this.publishReport(lines.join("\n"));
|
|
80
79
|
}
|
|
@@ -135,10 +134,11 @@ class MarkdownReporter {
|
|
|
135
134
|
function formatTestTitle(rootDir, test) {
|
|
136
135
|
const [, projectName, , ...titles] = test.titlePath();
|
|
137
136
|
const relativeTestPath = import_path.default.relative(rootDir, test.location.file);
|
|
138
|
-
const location = `${relativeTestPath}
|
|
137
|
+
const location = `${relativeTestPath}:\u200B${test.location.line}:${test.location.column}`;
|
|
139
138
|
const projectTitle = projectName ? `[${projectName}] \u203A ` : "";
|
|
140
139
|
const testTitle = `${projectTitle}${location} \u203A ${titles.join(" \u203A ")}`;
|
|
141
140
|
const extraTags = test.tags.filter((t) => !testTitle.includes(t));
|
|
142
|
-
|
|
141
|
+
const formattedTags = extraTags.map((t) => `\`${t}\``).join(" ");
|
|
142
|
+
return `${testTitle}${extraTags.length ? " " + formattedTags : ""}`;
|
|
143
143
|
}
|
|
144
144
|
var markdown_default = MarkdownReporter;
|
package/lib/runner/dispatcher.js
CHANGED
|
@@ -158,7 +158,8 @@ class Dispatcher {
|
|
|
158
158
|
_createWorker(testGroup, parallelIndex, loaderData) {
|
|
159
159
|
const projectConfig = this._config.projects.find((p) => p.id === testGroup.projectId);
|
|
160
160
|
const outputDir = projectConfig.project.outputDir;
|
|
161
|
-
const
|
|
161
|
+
const recoverFromStepErrors = this._failureTracker.canRecoverFromStepError();
|
|
162
|
+
const worker = new import_workerHost.WorkerHost(testGroup, parallelIndex, loaderData, recoverFromStepErrors, this._extraEnvByProjectId.get(testGroup.projectId) || {}, outputDir);
|
|
162
163
|
const handleOutput = (params) => {
|
|
163
164
|
const chunk = chunkFromParams(params);
|
|
164
165
|
if (worker.didFail()) {
|
|
@@ -311,6 +312,24 @@ class JobDispatcher {
|
|
|
311
312
|
steps.delete(params.stepId);
|
|
312
313
|
this._reporter.onStepEnd?.(test, result, step);
|
|
313
314
|
}
|
|
315
|
+
_onStepRecoverFromError(resumeAfterStepError, params) {
|
|
316
|
+
const data = this._dataByTestId.get(params.testId);
|
|
317
|
+
if (!data) {
|
|
318
|
+
resumeAfterStepError({ stepId: params.stepId, status: "failed" });
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
const { steps } = data;
|
|
322
|
+
const step = steps.get(params.stepId);
|
|
323
|
+
if (!step) {
|
|
324
|
+
resumeAfterStepError({ stepId: params.stepId, status: "failed" });
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
const testError = {
|
|
328
|
+
...params.error,
|
|
329
|
+
location: step.location
|
|
330
|
+
};
|
|
331
|
+
this._failureTracker.recoverFromStepError(params.stepId, testError, resumeAfterStepError);
|
|
332
|
+
}
|
|
314
333
|
_onAttach(params) {
|
|
315
334
|
const data = this._dataByTestId.get(params.testId);
|
|
316
335
|
if (!data) {
|
|
@@ -436,11 +455,13 @@ class JobDispatcher {
|
|
|
436
455
|
})
|
|
437
456
|
};
|
|
438
457
|
worker.runTestGroup(runPayload);
|
|
458
|
+
const resumeAfterStepError = worker.resumeAfterStepError.bind(worker);
|
|
439
459
|
this._listeners = [
|
|
440
460
|
import_utils.eventsHelper.addEventListener(worker, "testBegin", this._onTestBegin.bind(this)),
|
|
441
461
|
import_utils.eventsHelper.addEventListener(worker, "testEnd", this._onTestEnd.bind(this)),
|
|
442
462
|
import_utils.eventsHelper.addEventListener(worker, "stepBegin", this._onStepBegin.bind(this)),
|
|
443
463
|
import_utils.eventsHelper.addEventListener(worker, "stepEnd", this._onStepEnd.bind(this)),
|
|
464
|
+
import_utils.eventsHelper.addEventListener(worker, "stepRecoverFromError", this._onStepRecoverFromError.bind(this, resumeAfterStepError)),
|
|
444
465
|
import_utils.eventsHelper.addEventListener(worker, "attach", this._onAttach.bind(this)),
|
|
445
466
|
import_utils.eventsHelper.addEventListener(worker, "done", this._onDone.bind(this)),
|
|
446
467
|
import_utils.eventsHelper.addEventListener(worker, "exit", this.onExit.bind(this))
|
|
@@ -27,6 +27,12 @@ class FailureTracker {
|
|
|
27
27
|
this._failureCount = 0;
|
|
28
28
|
this._hasWorkerErrors = false;
|
|
29
29
|
}
|
|
30
|
+
canRecoverFromStepError() {
|
|
31
|
+
return !!this._recoverFromStepErrorHandler;
|
|
32
|
+
}
|
|
33
|
+
setRecoverFromStepErrorHandler(recoverFromStepErrorHandler) {
|
|
34
|
+
this._recoverFromStepErrorHandler = recoverFromStepErrorHandler;
|
|
35
|
+
}
|
|
30
36
|
onRootSuite(rootSuite) {
|
|
31
37
|
this._rootSuite = rootSuite;
|
|
32
38
|
}
|
|
@@ -34,6 +40,14 @@ class FailureTracker {
|
|
|
34
40
|
if (test.outcome() === "unexpected" && test.results.length > test.retries)
|
|
35
41
|
++this._failureCount;
|
|
36
42
|
}
|
|
43
|
+
recoverFromStepError(stepId, error, resumeAfterStepError) {
|
|
44
|
+
if (!this._recoverFromStepErrorHandler) {
|
|
45
|
+
resumeAfterStepError({ stepId, status: "failed" });
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
void this._recoverFromStepErrorHandler(stepId, error).then(resumeAfterStepError).catch(() => {
|
|
49
|
+
});
|
|
50
|
+
}
|
|
37
51
|
onWorkerError() {
|
|
38
52
|
this._hasWorkerErrors = true;
|
|
39
53
|
}
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var testRunner_exports = {};
|
|
30
|
+
__export(testRunner_exports, {
|
|
31
|
+
TestRunner: () => TestRunner,
|
|
32
|
+
TestRunnerEvent: () => TestRunnerEvent
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(testRunner_exports);
|
|
35
|
+
var import_events = __toESM(require("events"));
|
|
36
|
+
var import_fs = __toESM(require("fs"));
|
|
37
|
+
var import_path = __toESM(require("path"));
|
|
38
|
+
var import_server = require("playwright-core/lib/server");
|
|
39
|
+
var import_utils = require("playwright-core/lib/utils");
|
|
40
|
+
var import_configLoader = require("../common/configLoader");
|
|
41
|
+
var import_fsWatcher = require("../fsWatcher");
|
|
42
|
+
var import_teleReceiver = require("../isomorphic/teleReceiver");
|
|
43
|
+
var import_gitCommitInfoPlugin = require("../plugins/gitCommitInfoPlugin");
|
|
44
|
+
var import_webServerPlugin = require("../plugins/webServerPlugin");
|
|
45
|
+
var import_base = require("../reporters/base");
|
|
46
|
+
var import_internalReporter = require("../reporters/internalReporter");
|
|
47
|
+
var import_compilationCache = require("../transform/compilationCache");
|
|
48
|
+
var import_util = require("../util");
|
|
49
|
+
var import_reporters = require("./reporters");
|
|
50
|
+
var import_tasks = require("./tasks");
|
|
51
|
+
const TestRunnerEvent = {
|
|
52
|
+
TestFilesChanged: "testFilesChanged",
|
|
53
|
+
RecoverFromStepError: "recoverFromStepError"
|
|
54
|
+
};
|
|
55
|
+
class TestRunner extends import_events.default {
|
|
56
|
+
constructor(configLocation, configCLIOverrides) {
|
|
57
|
+
super();
|
|
58
|
+
this._watchedProjectDirs = /* @__PURE__ */ new Set();
|
|
59
|
+
this._ignoredProjectOutputs = /* @__PURE__ */ new Set();
|
|
60
|
+
this._watchedTestDependencies = /* @__PURE__ */ new Set();
|
|
61
|
+
this._queue = Promise.resolve();
|
|
62
|
+
this._watchTestDirs = false;
|
|
63
|
+
this._populateDependenciesOnList = false;
|
|
64
|
+
this._recoverFromStepErrors = false;
|
|
65
|
+
this._resumeAfterStepErrors = /* @__PURE__ */ new Map();
|
|
66
|
+
this._configLocation = configLocation;
|
|
67
|
+
this._configCLIOverrides = configCLIOverrides;
|
|
68
|
+
this._watcher = new import_fsWatcher.Watcher((events) => {
|
|
69
|
+
const collector = /* @__PURE__ */ new Set();
|
|
70
|
+
events.forEach((f) => (0, import_compilationCache.collectAffectedTestFiles)(f.file, collector));
|
|
71
|
+
this.emit(TestRunnerEvent.TestFilesChanged, [...collector]);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
async initialize(params) {
|
|
75
|
+
this._watchTestDirs = !!params.watchTestDirs;
|
|
76
|
+
this._populateDependenciesOnList = !!params.populateDependenciesOnList;
|
|
77
|
+
this._recoverFromStepErrors = !!params.recoverFromStepErrors;
|
|
78
|
+
}
|
|
79
|
+
resizeTerminal(params) {
|
|
80
|
+
process.stdout.columns = params.cols;
|
|
81
|
+
process.stdout.rows = params.rows;
|
|
82
|
+
process.stderr.columns = params.cols;
|
|
83
|
+
process.stderr.rows = params.rows;
|
|
84
|
+
}
|
|
85
|
+
hasSomeBrowsers() {
|
|
86
|
+
for (const browserName of ["chromium", "webkit", "firefox"]) {
|
|
87
|
+
try {
|
|
88
|
+
import_server.registry.findExecutable(browserName).executablePathOrDie("javascript");
|
|
89
|
+
return true;
|
|
90
|
+
} catch {
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
async installBrowsers() {
|
|
96
|
+
const executables = import_server.registry.defaultExecutables();
|
|
97
|
+
await import_server.registry.install(executables, false);
|
|
98
|
+
}
|
|
99
|
+
async runGlobalSetup(userReporters) {
|
|
100
|
+
await this.runGlobalTeardown();
|
|
101
|
+
const reporter = new import_internalReporter.InternalReporter(userReporters);
|
|
102
|
+
const config = await this._loadConfigOrReportError(reporter, this._configCLIOverrides);
|
|
103
|
+
if (!config)
|
|
104
|
+
return { status: "failed" };
|
|
105
|
+
const { status, cleanup } = await (0, import_tasks.runTasksDeferCleanup)(new import_tasks.TestRun(config, reporter), [
|
|
106
|
+
...(0, import_tasks.createGlobalSetupTasks)(config)
|
|
107
|
+
]);
|
|
108
|
+
if (status !== "passed")
|
|
109
|
+
await cleanup();
|
|
110
|
+
else
|
|
111
|
+
this._globalSetup = { cleanup };
|
|
112
|
+
return { status };
|
|
113
|
+
}
|
|
114
|
+
async runGlobalTeardown() {
|
|
115
|
+
const globalSetup = this._globalSetup;
|
|
116
|
+
const status = await globalSetup?.cleanup();
|
|
117
|
+
this._globalSetup = void 0;
|
|
118
|
+
return { status };
|
|
119
|
+
}
|
|
120
|
+
async startDevServer(userReporters) {
|
|
121
|
+
await this.stopDevServer();
|
|
122
|
+
const reporter = new import_internalReporter.InternalReporter(userReporters);
|
|
123
|
+
const config = await this._loadConfigOrReportError(reporter);
|
|
124
|
+
if (!config)
|
|
125
|
+
return { status: "failed" };
|
|
126
|
+
const { status, cleanup } = await (0, import_tasks.runTasksDeferCleanup)(new import_tasks.TestRun(config, reporter), [
|
|
127
|
+
(0, import_tasks.createLoadTask)("out-of-process", { failOnLoadErrors: true, filterOnly: false }),
|
|
128
|
+
(0, import_tasks.createStartDevServerTask)()
|
|
129
|
+
]);
|
|
130
|
+
if (status !== "passed")
|
|
131
|
+
await cleanup();
|
|
132
|
+
else
|
|
133
|
+
this._devServer = { cleanup };
|
|
134
|
+
return { status };
|
|
135
|
+
}
|
|
136
|
+
async stopDevServer() {
|
|
137
|
+
const devServer = this._devServer;
|
|
138
|
+
const status = await devServer?.cleanup();
|
|
139
|
+
this._devServer = void 0;
|
|
140
|
+
return { status };
|
|
141
|
+
}
|
|
142
|
+
async clearCache() {
|
|
143
|
+
const reporter = new import_internalReporter.InternalReporter([]);
|
|
144
|
+
const config = await this._loadConfigOrReportError(reporter);
|
|
145
|
+
if (!config)
|
|
146
|
+
return;
|
|
147
|
+
await (0, import_tasks.runTasks)(new import_tasks.TestRun(config, reporter), [
|
|
148
|
+
(0, import_tasks.createClearCacheTask)(config)
|
|
149
|
+
]);
|
|
150
|
+
}
|
|
151
|
+
async listFiles(userReporters, params) {
|
|
152
|
+
const reporter = new import_internalReporter.InternalReporter(userReporters);
|
|
153
|
+
const config = await this._loadConfigOrReportError(reporter);
|
|
154
|
+
if (!config)
|
|
155
|
+
return { status: "failed" };
|
|
156
|
+
config.cliProjectFilter = params.projects?.length ? params.projects : void 0;
|
|
157
|
+
const status = await (0, import_tasks.runTasks)(new import_tasks.TestRun(config, reporter), [
|
|
158
|
+
(0, import_tasks.createListFilesTask)(),
|
|
159
|
+
(0, import_tasks.createReportBeginTask)()
|
|
160
|
+
]);
|
|
161
|
+
return { status };
|
|
162
|
+
}
|
|
163
|
+
async listTests(userReporters, params) {
|
|
164
|
+
let result;
|
|
165
|
+
this._queue = this._queue.then(async () => {
|
|
166
|
+
const { config, status } = await this._innerListTests(userReporters, params);
|
|
167
|
+
if (config)
|
|
168
|
+
await this._updateWatchedDirs(config);
|
|
169
|
+
result = { status };
|
|
170
|
+
}).catch(printInternalError);
|
|
171
|
+
await this._queue;
|
|
172
|
+
return result;
|
|
173
|
+
}
|
|
174
|
+
async _innerListTests(userReporters, params) {
|
|
175
|
+
const overrides = {
|
|
176
|
+
...this._configCLIOverrides,
|
|
177
|
+
repeatEach: 1,
|
|
178
|
+
retries: 0
|
|
179
|
+
};
|
|
180
|
+
const reporter = new import_internalReporter.InternalReporter(userReporters);
|
|
181
|
+
const config = await this._loadConfigOrReportError(reporter, overrides);
|
|
182
|
+
if (!config)
|
|
183
|
+
return { status: "failed" };
|
|
184
|
+
config.cliArgs = params.locations || [];
|
|
185
|
+
config.cliGrep = params.grep;
|
|
186
|
+
config.cliGrepInvert = params.grepInvert;
|
|
187
|
+
config.cliProjectFilter = params.projects?.length ? params.projects : void 0;
|
|
188
|
+
config.cliListOnly = true;
|
|
189
|
+
const status = await (0, import_tasks.runTasks)(new import_tasks.TestRun(config, reporter), [
|
|
190
|
+
(0, import_tasks.createLoadTask)("out-of-process", { failOnLoadErrors: false, filterOnly: false, populateDependencies: this._populateDependenciesOnList }),
|
|
191
|
+
(0, import_tasks.createReportBeginTask)()
|
|
192
|
+
]);
|
|
193
|
+
return { config, status };
|
|
194
|
+
}
|
|
195
|
+
async _updateWatchedDirs(config) {
|
|
196
|
+
this._watchedProjectDirs = /* @__PURE__ */ new Set();
|
|
197
|
+
this._ignoredProjectOutputs = /* @__PURE__ */ new Set();
|
|
198
|
+
for (const p of config.projects) {
|
|
199
|
+
this._watchedProjectDirs.add(p.project.testDir);
|
|
200
|
+
this._ignoredProjectOutputs.add(p.project.outputDir);
|
|
201
|
+
}
|
|
202
|
+
const result = await resolveCtDirs(config);
|
|
203
|
+
if (result) {
|
|
204
|
+
this._watchedProjectDirs.add(result.templateDir);
|
|
205
|
+
this._ignoredProjectOutputs.add(result.outDir);
|
|
206
|
+
}
|
|
207
|
+
if (this._watchTestDirs)
|
|
208
|
+
await this._updateWatcher(false);
|
|
209
|
+
}
|
|
210
|
+
async _updateWatcher(reportPending) {
|
|
211
|
+
await this._watcher.update([...this._watchedProjectDirs, ...this._watchedTestDependencies], [...this._ignoredProjectOutputs], reportPending);
|
|
212
|
+
}
|
|
213
|
+
async runTests(userReporters, params) {
|
|
214
|
+
let result = { status: "passed" };
|
|
215
|
+
this._queue = this._queue.then(async () => {
|
|
216
|
+
result = await this._innerRunTests(userReporters, params).catch((e) => {
|
|
217
|
+
printInternalError(e);
|
|
218
|
+
return { status: "failed" };
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
await this._queue;
|
|
222
|
+
return result;
|
|
223
|
+
}
|
|
224
|
+
async _innerRunTests(userReporters, params) {
|
|
225
|
+
await this.stopTests();
|
|
226
|
+
const overrides = {
|
|
227
|
+
...this._configCLIOverrides,
|
|
228
|
+
repeatEach: 1,
|
|
229
|
+
retries: 0,
|
|
230
|
+
preserveOutputDir: true,
|
|
231
|
+
reporter: params.reporters ? params.reporters.map((r) => [r]) : void 0,
|
|
232
|
+
use: {
|
|
233
|
+
...this._configCLIOverrides.use,
|
|
234
|
+
...params.trace === "on" ? { trace: { mode: "on", sources: false, _live: true } } : {},
|
|
235
|
+
...params.trace === "off" ? { trace: "off" } : {},
|
|
236
|
+
...params.video === "on" || params.video === "off" ? { video: params.video } : {},
|
|
237
|
+
...params.headed !== void 0 ? { headless: !params.headed } : {},
|
|
238
|
+
_optionContextReuseMode: params.reuseContext ? "when-possible" : void 0,
|
|
239
|
+
_optionConnectOptions: params.connectWsEndpoint ? { wsEndpoint: params.connectWsEndpoint } : void 0
|
|
240
|
+
},
|
|
241
|
+
...params.updateSnapshots ? { updateSnapshots: params.updateSnapshots } : {},
|
|
242
|
+
...params.updateSourceMethod ? { updateSourceMethod: params.updateSourceMethod } : {},
|
|
243
|
+
...params.workers ? { workers: params.workers } : {}
|
|
244
|
+
};
|
|
245
|
+
if (params.trace === "on")
|
|
246
|
+
process.env.PW_LIVE_TRACE_STACKS = "1";
|
|
247
|
+
else
|
|
248
|
+
process.env.PW_LIVE_TRACE_STACKS = void 0;
|
|
249
|
+
const config = await this._loadConfigOrReportError(new import_internalReporter.InternalReporter(userReporters), overrides);
|
|
250
|
+
if (!config)
|
|
251
|
+
return { status: "failed" };
|
|
252
|
+
config.cliListOnly = false;
|
|
253
|
+
config.cliPassWithNoTests = true;
|
|
254
|
+
config.cliArgs = params.locations || [];
|
|
255
|
+
config.cliGrep = params.grep;
|
|
256
|
+
config.cliGrepInvert = params.grepInvert;
|
|
257
|
+
config.cliProjectFilter = params.projects?.length ? params.projects : void 0;
|
|
258
|
+
config.preOnlyTestFilters = [];
|
|
259
|
+
if (params.testIds) {
|
|
260
|
+
const testIdSet = new Set(params.testIds);
|
|
261
|
+
config.preOnlyTestFilters.push((test) => testIdSet.has(test.id));
|
|
262
|
+
}
|
|
263
|
+
const configReporters = await (0, import_reporters.createReporters)(config, "test", true);
|
|
264
|
+
const reporter = new import_internalReporter.InternalReporter([...configReporters, ...userReporters]);
|
|
265
|
+
const stop = new import_utils.ManualPromise();
|
|
266
|
+
const tasks = [
|
|
267
|
+
(0, import_tasks.createApplyRebaselinesTask)(),
|
|
268
|
+
(0, import_tasks.createLoadTask)("out-of-process", { filterOnly: true, failOnLoadErrors: false, doNotRunDepsOutsideProjectFilter: true }),
|
|
269
|
+
...(0, import_tasks.createRunTestsTasks)(config)
|
|
270
|
+
];
|
|
271
|
+
const testRun = new import_tasks.TestRun(config, reporter);
|
|
272
|
+
testRun.failureTracker.setRecoverFromStepErrorHandler(this._recoverFromStepError.bind(this));
|
|
273
|
+
const run = (0, import_tasks.runTasks)(testRun, tasks, 0, stop).then(async (status) => {
|
|
274
|
+
this._testRun = void 0;
|
|
275
|
+
return status;
|
|
276
|
+
});
|
|
277
|
+
this._testRun = { run, stop };
|
|
278
|
+
return { status: await run };
|
|
279
|
+
}
|
|
280
|
+
async _recoverFromStepError(stepId, error) {
|
|
281
|
+
if (!this._recoverFromStepErrors)
|
|
282
|
+
return { stepId, status: "failed" };
|
|
283
|
+
const recoveryPromise = new import_utils.ManualPromise();
|
|
284
|
+
this._resumeAfterStepErrors.set(stepId, recoveryPromise);
|
|
285
|
+
if (!error?.message || !error?.location)
|
|
286
|
+
return { stepId, status: "failed" };
|
|
287
|
+
this.emit(TestRunnerEvent.RecoverFromStepError, stepId, error.message, error.location);
|
|
288
|
+
const recoveredResult = await recoveryPromise;
|
|
289
|
+
if (recoveredResult.stepId !== stepId)
|
|
290
|
+
return { stepId, status: "failed" };
|
|
291
|
+
return recoveredResult;
|
|
292
|
+
}
|
|
293
|
+
async resumeAfterStepError(params) {
|
|
294
|
+
const recoveryPromise = this._resumeAfterStepErrors.get(params.stepId);
|
|
295
|
+
if (recoveryPromise)
|
|
296
|
+
recoveryPromise.resolve(params);
|
|
297
|
+
}
|
|
298
|
+
async watch(params) {
|
|
299
|
+
this._watchedTestDependencies = /* @__PURE__ */ new Set();
|
|
300
|
+
for (const fileName of params.fileNames) {
|
|
301
|
+
this._watchedTestDependencies.add(fileName);
|
|
302
|
+
(0, import_compilationCache.dependenciesForTestFile)(fileName).forEach((file) => this._watchedTestDependencies.add(file));
|
|
303
|
+
}
|
|
304
|
+
await this._updateWatcher(true);
|
|
305
|
+
}
|
|
306
|
+
async findRelatedTestFiles(params) {
|
|
307
|
+
const errorReporter = (0, import_reporters.createErrorCollectingReporter)(import_base.internalScreen);
|
|
308
|
+
const reporter = new import_internalReporter.InternalReporter([errorReporter]);
|
|
309
|
+
const config = await this._loadConfigOrReportError(reporter);
|
|
310
|
+
if (!config)
|
|
311
|
+
return { errors: errorReporter.errors(), testFiles: [] };
|
|
312
|
+
const status = await (0, import_tasks.runTasks)(new import_tasks.TestRun(config, reporter), [
|
|
313
|
+
(0, import_tasks.createLoadTask)("out-of-process", { failOnLoadErrors: true, filterOnly: false, populateDependencies: true })
|
|
314
|
+
]);
|
|
315
|
+
if (status !== "passed")
|
|
316
|
+
return { errors: errorReporter.errors(), testFiles: [] };
|
|
317
|
+
return { testFiles: (0, import_compilationCache.affectedTestFiles)(params.files) };
|
|
318
|
+
}
|
|
319
|
+
async stopTests() {
|
|
320
|
+
this._testRun?.stop?.resolve();
|
|
321
|
+
await this._testRun?.run;
|
|
322
|
+
this._resumeAfterStepErrors.clear();
|
|
323
|
+
}
|
|
324
|
+
async closeGracefully() {
|
|
325
|
+
(0, import_utils.gracefullyProcessExitDoNotHang)(0);
|
|
326
|
+
}
|
|
327
|
+
async _loadConfig(overrides) {
|
|
328
|
+
try {
|
|
329
|
+
const config = await (0, import_configLoader.loadConfig)(this._configLocation, overrides);
|
|
330
|
+
if (!this._plugins) {
|
|
331
|
+
(0, import_webServerPlugin.webServerPluginsForConfig)(config).forEach((p) => config.plugins.push({ factory: p }));
|
|
332
|
+
(0, import_gitCommitInfoPlugin.addGitCommitInfoPlugin)(config);
|
|
333
|
+
this._plugins = config.plugins || [];
|
|
334
|
+
} else {
|
|
335
|
+
config.plugins.splice(0, config.plugins.length, ...this._plugins);
|
|
336
|
+
}
|
|
337
|
+
return { config };
|
|
338
|
+
} catch (e) {
|
|
339
|
+
return { config: null, error: (0, import_util.serializeError)(e) };
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
async _loadConfigOrReportError(reporter, overrides) {
|
|
343
|
+
const { config, error } = await this._loadConfig(overrides);
|
|
344
|
+
if (config)
|
|
345
|
+
return config;
|
|
346
|
+
reporter.onConfigure(import_teleReceiver.baseFullConfig);
|
|
347
|
+
reporter.onError(error);
|
|
348
|
+
await reporter.onEnd({ status: "failed" });
|
|
349
|
+
await reporter.onExit();
|
|
350
|
+
return null;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
function printInternalError(e) {
|
|
354
|
+
console.error("Internal error:", e);
|
|
355
|
+
}
|
|
356
|
+
async function resolveCtDirs(config) {
|
|
357
|
+
const use = config.config.projects[0].use;
|
|
358
|
+
const relativeTemplateDir = use.ctTemplateDir || "playwright";
|
|
359
|
+
const templateDir = await import_fs.default.promises.realpath(import_path.default.normalize(import_path.default.join(config.configDir, relativeTemplateDir))).catch(() => void 0);
|
|
360
|
+
if (!templateDir)
|
|
361
|
+
return null;
|
|
362
|
+
const outDir = use.ctCacheDir ? import_path.default.resolve(config.configDir, use.ctCacheDir) : import_path.default.resolve(templateDir, ".cache");
|
|
363
|
+
return {
|
|
364
|
+
outDir,
|
|
365
|
+
templateDir
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
369
|
+
0 && (module.exports = {
|
|
370
|
+
TestRunner,
|
|
371
|
+
TestRunnerEvent
|
|
372
|
+
});
|
package/lib/runner/testServer.js
CHANGED
|
@@ -28,31 +28,21 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var testServer_exports = {};
|
|
30
30
|
__export(testServer_exports, {
|
|
31
|
+
TestRunnerEvent: () => TestRunnerEvent,
|
|
31
32
|
TestServerDispatcher: () => TestServerDispatcher,
|
|
32
|
-
resolveCtDirs: () => resolveCtDirs,
|
|
33
33
|
runTestServer: () => runTestServer,
|
|
34
34
|
runUIMode: () => runUIMode
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(testServer_exports);
|
|
37
|
-
var import_fs = __toESM(require("fs"));
|
|
38
|
-
var import_path = __toESM(require("path"));
|
|
39
37
|
var import_util = __toESM(require("util"));
|
|
40
38
|
var import_server = require("playwright-core/lib/server");
|
|
41
39
|
var import_utils = require("playwright-core/lib/utils");
|
|
42
40
|
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
|
|
43
|
-
var import_reporters = require("./reporters");
|
|
44
|
-
var import_sigIntWatcher = require("./sigIntWatcher");
|
|
45
|
-
var import_tasks = require("./tasks");
|
|
46
41
|
var import_configLoader = require("../common/configLoader");
|
|
47
|
-
var import_fsWatcher = require("../fsWatcher");
|
|
48
|
-
var import_teleReceiver = require("../isomorphic/teleReceiver");
|
|
49
|
-
var import_gitCommitInfoPlugin = require("../plugins/gitCommitInfoPlugin");
|
|
50
|
-
var import_webServerPlugin = require("../plugins/webServerPlugin");
|
|
51
|
-
var import_base = require("../reporters/base");
|
|
52
|
-
var import_internalReporter = require("../reporters/internalReporter");
|
|
53
42
|
var import_list = __toESM(require("../reporters/list"));
|
|
54
|
-
var
|
|
55
|
-
var
|
|
43
|
+
var import_reporters = require("./reporters");
|
|
44
|
+
var import_sigIntWatcher = require("./sigIntWatcher");
|
|
45
|
+
var import_testRunner = require("./testRunner");
|
|
56
46
|
const originalDebugLog = import_utilsBundle.debug.log;
|
|
57
47
|
const originalStdoutWrite = process.stdout.write;
|
|
58
48
|
const originalStderrWrite = process.stderr.write;
|
|
@@ -70,18 +60,15 @@ class TestServer {
|
|
|
70
60
|
await this._dispatcher?.runGlobalTeardown();
|
|
71
61
|
}
|
|
72
62
|
}
|
|
63
|
+
const TestRunnerEvent = {
|
|
64
|
+
TestFilesChanged: "testFilesChanged",
|
|
65
|
+
RecoverFromStepError: "recoverFromStepError"
|
|
66
|
+
};
|
|
73
67
|
class TestServerDispatcher {
|
|
74
68
|
constructor(configLocation, configCLIOverrides) {
|
|
75
|
-
this._watchedProjectDirs = /* @__PURE__ */ new Set();
|
|
76
|
-
this._ignoredProjectOutputs = /* @__PURE__ */ new Set();
|
|
77
|
-
this._watchedTestDependencies = /* @__PURE__ */ new Set();
|
|
78
|
-
this._queue = Promise.resolve();
|
|
79
69
|
this._serializer = require.resolve("./uiModeReporter");
|
|
80
|
-
this._watchTestDirs = false;
|
|
81
70
|
this._closeOnDisconnect = false;
|
|
82
|
-
this.
|
|
83
|
-
this._configLocation = configLocation;
|
|
84
|
-
this._configCLIOverrides = configCLIOverrides;
|
|
71
|
+
this._testRunner = new import_testRunner.TestRunner(configLocation, configCLIOverrides);
|
|
85
72
|
this.transport = {
|
|
86
73
|
onconnect: () => {
|
|
87
74
|
},
|
|
@@ -91,27 +78,29 @@ class TestServerDispatcher {
|
|
|
91
78
|
(0, import_utils.gracefullyProcessExitDoNotHang)(0);
|
|
92
79
|
}
|
|
93
80
|
};
|
|
94
|
-
this._watcher = new import_fsWatcher.Watcher((events) => {
|
|
95
|
-
const collector = /* @__PURE__ */ new Set();
|
|
96
|
-
events.forEach((f) => (0, import_compilationCache.collectAffectedTestFiles)(f.file, collector));
|
|
97
|
-
this._dispatchEvent("testFilesChanged", { testFiles: [...collector] });
|
|
98
|
-
});
|
|
99
81
|
this._dispatchEvent = (method, params) => this.transport.sendEvent?.(method, params);
|
|
82
|
+
this._testRunner.on(TestRunnerEvent.TestFilesChanged, (testFiles) => this._dispatchEvent("testFilesChanged", { testFiles }));
|
|
83
|
+
this._testRunner.on(TestRunnerEvent.RecoverFromStepError, (stepId, message, location) => this._dispatchEvent("recoverFromStepError", { stepId, message, location }));
|
|
100
84
|
}
|
|
101
85
|
async _wireReporter(messageSink) {
|
|
102
86
|
return await (0, import_reporters.createReporterForTestServer)(this._serializer, messageSink);
|
|
103
87
|
}
|
|
104
|
-
async
|
|
88
|
+
async _collectingReporter() {
|
|
105
89
|
const report = [];
|
|
106
|
-
|
|
107
|
-
|
|
90
|
+
return {
|
|
91
|
+
reporter: await (0, import_reporters.createReporterForTestServer)(this._serializer, (e) => report.push(e)),
|
|
92
|
+
report
|
|
93
|
+
};
|
|
108
94
|
}
|
|
109
95
|
async initialize(params) {
|
|
110
96
|
this._serializer = params.serializer || require.resolve("./uiModeReporter");
|
|
111
97
|
this._closeOnDisconnect = !!params.closeOnDisconnect;
|
|
112
98
|
await this._setInterceptStdio(!!params.interceptStdio);
|
|
113
|
-
this.
|
|
114
|
-
|
|
99
|
+
await this._testRunner.initialize({
|
|
100
|
+
watchTestDirs: !!params.watchTestDirs,
|
|
101
|
+
populateDependenciesOnList: !!params.populateDependenciesOnList,
|
|
102
|
+
recoverFromStepErrors: !!params.recoverFromStepErrors
|
|
103
|
+
});
|
|
115
104
|
}
|
|
116
105
|
async ping() {
|
|
117
106
|
}
|
|
@@ -121,221 +110,68 @@ class TestServerDispatcher {
|
|
|
121
110
|
(0, import_utilsBundle.open)("vscode://file/" + params.location.file + ":" + params.location.line).catch((e) => console.error(e));
|
|
122
111
|
}
|
|
123
112
|
async resizeTerminal(params) {
|
|
124
|
-
|
|
125
|
-
process.stdout.rows = params.rows;
|
|
126
|
-
process.stderr.columns = params.cols;
|
|
127
|
-
process.stderr.rows = params.rows;
|
|
113
|
+
this._testRunner.resizeTerminal(params);
|
|
128
114
|
}
|
|
129
115
|
async checkBrowsers() {
|
|
130
|
-
return { hasBrowsers: hasSomeBrowsers() };
|
|
116
|
+
return { hasBrowsers: this._testRunner.hasSomeBrowsers() };
|
|
131
117
|
}
|
|
132
118
|
async installBrowsers() {
|
|
133
|
-
await installBrowsers();
|
|
119
|
+
await this._testRunner.installBrowsers();
|
|
134
120
|
}
|
|
135
121
|
async runGlobalSetup(params) {
|
|
136
122
|
await this.runGlobalTeardown();
|
|
137
|
-
const { reporter, report } = await this.
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
return { status: "failed", report };
|
|
141
|
-
const { status, cleanup } = await (0, import_tasks.runTasksDeferCleanup)(new import_tasks.TestRun(config, reporter), [
|
|
142
|
-
...(0, import_tasks.createGlobalSetupTasks)(config)
|
|
143
|
-
]);
|
|
144
|
-
if (status !== "passed")
|
|
145
|
-
await cleanup();
|
|
146
|
-
else
|
|
147
|
-
this._globalSetup = { cleanup, report };
|
|
123
|
+
const { reporter, report } = await this._collectingReporter();
|
|
124
|
+
this._globalSetupReport = report;
|
|
125
|
+
const { status } = await this._testRunner.runGlobalSetup([reporter, new import_list.default()]);
|
|
148
126
|
return { report, status };
|
|
149
127
|
}
|
|
150
128
|
async runGlobalTeardown() {
|
|
151
|
-
const
|
|
152
|
-
const
|
|
153
|
-
this.
|
|
154
|
-
return { status, report
|
|
129
|
+
const { status } = await this._testRunner.runGlobalTeardown();
|
|
130
|
+
const report = this._globalSetupReport || [];
|
|
131
|
+
this._globalSetupReport = void 0;
|
|
132
|
+
return { status, report };
|
|
155
133
|
}
|
|
156
134
|
async startDevServer(params) {
|
|
157
135
|
await this.stopDevServer({});
|
|
158
|
-
const { reporter, report } = await this.
|
|
159
|
-
const
|
|
160
|
-
if (!config)
|
|
161
|
-
return { report, status: "failed" };
|
|
162
|
-
const { status, cleanup } = await (0, import_tasks.runTasksDeferCleanup)(new import_tasks.TestRun(config, reporter), [
|
|
163
|
-
(0, import_tasks.createLoadTask)("out-of-process", { failOnLoadErrors: true, filterOnly: false }),
|
|
164
|
-
(0, import_tasks.createStartDevServerTask)()
|
|
165
|
-
]);
|
|
166
|
-
if (status !== "passed")
|
|
167
|
-
await cleanup();
|
|
168
|
-
else
|
|
169
|
-
this._devServer = { cleanup, report };
|
|
136
|
+
const { reporter, report } = await this._collectingReporter();
|
|
137
|
+
const { status } = await this._testRunner.startDevServer([reporter]);
|
|
170
138
|
return { report, status };
|
|
171
139
|
}
|
|
172
140
|
async stopDevServer(params) {
|
|
173
|
-
const
|
|
174
|
-
const
|
|
175
|
-
this.
|
|
176
|
-
return { status, report
|
|
141
|
+
const { status } = await this._testRunner.stopDevServer();
|
|
142
|
+
const report = this._devServerReport || [];
|
|
143
|
+
this._devServerReport = void 0;
|
|
144
|
+
return { status, report };
|
|
177
145
|
}
|
|
178
146
|
async clearCache(params) {
|
|
179
|
-
|
|
180
|
-
const config = await this._loadConfigOrReportError(reporter);
|
|
181
|
-
if (!config)
|
|
182
|
-
return;
|
|
183
|
-
await (0, import_tasks.runTasks)(new import_tasks.TestRun(config, reporter), [
|
|
184
|
-
(0, import_tasks.createClearCacheTask)(config)
|
|
185
|
-
]);
|
|
147
|
+
await this._testRunner.clearCache();
|
|
186
148
|
}
|
|
187
149
|
async listFiles(params) {
|
|
188
|
-
const { reporter, report } = await this.
|
|
189
|
-
const
|
|
190
|
-
if (!config)
|
|
191
|
-
return { status: "failed", report };
|
|
192
|
-
config.cliProjectFilter = params.projects?.length ? params.projects : void 0;
|
|
193
|
-
const status = await (0, import_tasks.runTasks)(new import_tasks.TestRun(config, reporter), [
|
|
194
|
-
(0, import_tasks.createListFilesTask)(),
|
|
195
|
-
(0, import_tasks.createReportBeginTask)()
|
|
196
|
-
]);
|
|
150
|
+
const { reporter, report } = await this._collectingReporter();
|
|
151
|
+
const { status } = await this._testRunner.listFiles([reporter], params);
|
|
197
152
|
return { report, status };
|
|
198
153
|
}
|
|
199
154
|
async listTests(params) {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
if (config)
|
|
204
|
-
await this._updateWatchedDirs(config);
|
|
205
|
-
result = { report, status };
|
|
206
|
-
}).catch(printInternalError);
|
|
207
|
-
await this._queue;
|
|
208
|
-
return result;
|
|
209
|
-
}
|
|
210
|
-
async _innerListTests(params) {
|
|
211
|
-
const overrides = {
|
|
212
|
-
...this._configCLIOverrides,
|
|
213
|
-
repeatEach: 1,
|
|
214
|
-
retries: 0
|
|
215
|
-
};
|
|
216
|
-
const { reporter, report } = await this._collectingInternalReporter();
|
|
217
|
-
const config = await this._loadConfigOrReportError(reporter, overrides);
|
|
218
|
-
if (!config)
|
|
219
|
-
return { report, reporter, status: "failed" };
|
|
220
|
-
config.cliArgs = params.locations || [];
|
|
221
|
-
config.cliGrep = params.grep;
|
|
222
|
-
config.cliGrepInvert = params.grepInvert;
|
|
223
|
-
config.cliProjectFilter = params.projects?.length ? params.projects : void 0;
|
|
224
|
-
config.cliListOnly = true;
|
|
225
|
-
const status = await (0, import_tasks.runTasks)(new import_tasks.TestRun(config, reporter), [
|
|
226
|
-
(0, import_tasks.createLoadTask)("out-of-process", { failOnLoadErrors: false, filterOnly: false, populateDependencies: this._populateDependenciesOnList }),
|
|
227
|
-
(0, import_tasks.createReportBeginTask)()
|
|
228
|
-
]);
|
|
229
|
-
return { config, report, reporter, status };
|
|
230
|
-
}
|
|
231
|
-
async _updateWatchedDirs(config) {
|
|
232
|
-
this._watchedProjectDirs = /* @__PURE__ */ new Set();
|
|
233
|
-
this._ignoredProjectOutputs = /* @__PURE__ */ new Set();
|
|
234
|
-
for (const p of config.projects) {
|
|
235
|
-
this._watchedProjectDirs.add(p.project.testDir);
|
|
236
|
-
this._ignoredProjectOutputs.add(p.project.outputDir);
|
|
237
|
-
}
|
|
238
|
-
const result = await resolveCtDirs(config);
|
|
239
|
-
if (result) {
|
|
240
|
-
this._watchedProjectDirs.add(result.templateDir);
|
|
241
|
-
this._ignoredProjectOutputs.add(result.outDir);
|
|
242
|
-
}
|
|
243
|
-
if (this._watchTestDirs)
|
|
244
|
-
await this._updateWatcher(false);
|
|
245
|
-
}
|
|
246
|
-
async _updateWatcher(reportPending) {
|
|
247
|
-
await this._watcher.update([...this._watchedProjectDirs, ...this._watchedTestDependencies], [...this._ignoredProjectOutputs], reportPending);
|
|
155
|
+
const { reporter, report } = await this._collectingReporter();
|
|
156
|
+
const { status } = await this._testRunner.listTests([reporter], params);
|
|
157
|
+
return { report, status };
|
|
248
158
|
}
|
|
249
159
|
async runTests(params) {
|
|
250
|
-
let result = { status: "passed" };
|
|
251
|
-
this._queue = this._queue.then(async () => {
|
|
252
|
-
result = await this._innerRunTests(params).catch((e) => {
|
|
253
|
-
printInternalError(e);
|
|
254
|
-
return { status: "failed" };
|
|
255
|
-
});
|
|
256
|
-
});
|
|
257
|
-
await this._queue;
|
|
258
|
-
return result;
|
|
259
|
-
}
|
|
260
|
-
async _innerRunTests(params) {
|
|
261
|
-
await this.stopTests();
|
|
262
|
-
const overrides = {
|
|
263
|
-
...this._configCLIOverrides,
|
|
264
|
-
repeatEach: 1,
|
|
265
|
-
retries: 0,
|
|
266
|
-
preserveOutputDir: true,
|
|
267
|
-
reporter: params.reporters ? params.reporters.map((r) => [r]) : void 0,
|
|
268
|
-
use: {
|
|
269
|
-
...this._configCLIOverrides.use,
|
|
270
|
-
...params.trace === "on" ? { trace: { mode: "on", sources: false, _live: true } } : {},
|
|
271
|
-
...params.trace === "off" ? { trace: "off" } : {},
|
|
272
|
-
...params.video === "on" || params.video === "off" ? { video: params.video } : {},
|
|
273
|
-
...params.headed !== void 0 ? { headless: !params.headed } : {},
|
|
274
|
-
_optionContextReuseMode: params.reuseContext ? "when-possible" : void 0,
|
|
275
|
-
_optionConnectOptions: params.connectWsEndpoint ? { wsEndpoint: params.connectWsEndpoint } : void 0
|
|
276
|
-
},
|
|
277
|
-
...params.updateSnapshots ? { updateSnapshots: params.updateSnapshots } : {},
|
|
278
|
-
...params.updateSourceMethod ? { updateSourceMethod: params.updateSourceMethod } : {},
|
|
279
|
-
...params.workers ? { workers: params.workers } : {}
|
|
280
|
-
};
|
|
281
|
-
if (params.trace === "on")
|
|
282
|
-
process.env.PW_LIVE_TRACE_STACKS = "1";
|
|
283
|
-
else
|
|
284
|
-
process.env.PW_LIVE_TRACE_STACKS = void 0;
|
|
285
160
|
const wireReporter = await this._wireReporter((e) => this._dispatchEvent("report", e));
|
|
286
|
-
const
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
config.cliArgs = params.locations || [];
|
|
292
|
-
config.cliGrep = params.grep;
|
|
293
|
-
config.cliGrepInvert = params.grepInvert;
|
|
294
|
-
config.cliProjectFilter = params.projects?.length ? params.projects : void 0;
|
|
295
|
-
config.preOnlyTestFilters = [];
|
|
296
|
-
if (params.testIds) {
|
|
297
|
-
const testIdSet = new Set(params.testIds);
|
|
298
|
-
config.preOnlyTestFilters.push((test) => testIdSet.has(test.id));
|
|
299
|
-
}
|
|
300
|
-
const configReporters = await (0, import_reporters.createReporters)(config, "test", true);
|
|
301
|
-
const reporter = new import_internalReporter.InternalReporter([...configReporters, wireReporter]);
|
|
302
|
-
const stop = new import_utils.ManualPromise();
|
|
303
|
-
const tasks = [
|
|
304
|
-
(0, import_tasks.createApplyRebaselinesTask)(),
|
|
305
|
-
(0, import_tasks.createLoadTask)("out-of-process", { filterOnly: true, failOnLoadErrors: false, doNotRunDepsOutsideProjectFilter: true }),
|
|
306
|
-
...(0, import_tasks.createRunTestsTasks)(config)
|
|
307
|
-
];
|
|
308
|
-
const run = (0, import_tasks.runTasks)(new import_tasks.TestRun(config, reporter), tasks, 0, stop).then(async (status) => {
|
|
309
|
-
this._testRun = void 0;
|
|
310
|
-
return status;
|
|
311
|
-
});
|
|
312
|
-
this._testRun = { run, stop };
|
|
313
|
-
return { status: await run };
|
|
161
|
+
const { status } = await this._testRunner.runTests([wireReporter], params);
|
|
162
|
+
return { status };
|
|
163
|
+
}
|
|
164
|
+
async resumeAfterStepError(params) {
|
|
165
|
+
await this._testRunner.resumeAfterStepError(params);
|
|
314
166
|
}
|
|
315
167
|
async watch(params) {
|
|
316
|
-
this.
|
|
317
|
-
for (const fileName of params.fileNames) {
|
|
318
|
-
this._watchedTestDependencies.add(fileName);
|
|
319
|
-
(0, import_compilationCache.dependenciesForTestFile)(fileName).forEach((file) => this._watchedTestDependencies.add(file));
|
|
320
|
-
}
|
|
321
|
-
await this._updateWatcher(true);
|
|
168
|
+
await this._testRunner.watch(params);
|
|
322
169
|
}
|
|
323
170
|
async findRelatedTestFiles(params) {
|
|
324
|
-
|
|
325
|
-
const reporter = new import_internalReporter.InternalReporter([errorReporter]);
|
|
326
|
-
const config = await this._loadConfigOrReportError(reporter);
|
|
327
|
-
if (!config)
|
|
328
|
-
return { errors: errorReporter.errors(), testFiles: [] };
|
|
329
|
-
const status = await (0, import_tasks.runTasks)(new import_tasks.TestRun(config, reporter), [
|
|
330
|
-
(0, import_tasks.createLoadTask)("out-of-process", { failOnLoadErrors: true, filterOnly: false, populateDependencies: true })
|
|
331
|
-
]);
|
|
332
|
-
if (status !== "passed")
|
|
333
|
-
return { errors: errorReporter.errors(), testFiles: [] };
|
|
334
|
-
return { testFiles: (0, import_compilationCache.affectedTestFiles)(params.files) };
|
|
171
|
+
return this._testRunner.findRelatedTestFiles(params);
|
|
335
172
|
}
|
|
336
173
|
async stopTests() {
|
|
337
|
-
this.
|
|
338
|
-
await this._testRun?.run;
|
|
174
|
+
await this._testRunner.stopTests();
|
|
339
175
|
}
|
|
340
176
|
async _setInterceptStdio(intercept) {
|
|
341
177
|
if (process.env.PWTEST_DEBUG)
|
|
@@ -362,32 +198,7 @@ class TestServerDispatcher {
|
|
|
362
198
|
}
|
|
363
199
|
}
|
|
364
200
|
async closeGracefully() {
|
|
365
|
-
|
|
366
|
-
}
|
|
367
|
-
async _loadConfig(overrides) {
|
|
368
|
-
try {
|
|
369
|
-
const config = await (0, import_configLoader.loadConfig)(this._configLocation, overrides);
|
|
370
|
-
if (!this._plugins) {
|
|
371
|
-
(0, import_webServerPlugin.webServerPluginsForConfig)(config).forEach((p) => config.plugins.push({ factory: p }));
|
|
372
|
-
(0, import_gitCommitInfoPlugin.addGitCommitInfoPlugin)(config);
|
|
373
|
-
this._plugins = config.plugins || [];
|
|
374
|
-
} else {
|
|
375
|
-
config.plugins.splice(0, config.plugins.length, ...this._plugins);
|
|
376
|
-
}
|
|
377
|
-
return { config };
|
|
378
|
-
} catch (e) {
|
|
379
|
-
return { config: null, error: (0, import_util2.serializeError)(e) };
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
async _loadConfigOrReportError(reporter, overrides) {
|
|
383
|
-
const { config, error } = await this._loadConfig(overrides);
|
|
384
|
-
if (config)
|
|
385
|
-
return config;
|
|
386
|
-
reporter.onConfigure(import_teleReceiver.baseFullConfig);
|
|
387
|
-
reporter.onError(error);
|
|
388
|
-
await reporter.onEnd({ status: "failed" });
|
|
389
|
-
await reporter.onExit();
|
|
390
|
-
return null;
|
|
201
|
+
await this._testRunner.closeGracefully();
|
|
391
202
|
}
|
|
392
203
|
}
|
|
393
204
|
async function runUIMode(configFile, configCLIOverrides, options) {
|
|
@@ -448,39 +259,10 @@ function chunkToPayload(type, chunk) {
|
|
|
448
259
|
return { type, buffer: chunk.toString("base64") };
|
|
449
260
|
return { type, text: chunk };
|
|
450
261
|
}
|
|
451
|
-
function hasSomeBrowsers() {
|
|
452
|
-
for (const browserName of ["chromium", "webkit", "firefox"]) {
|
|
453
|
-
try {
|
|
454
|
-
import_server.registry.findExecutable(browserName).executablePathOrDie("javascript");
|
|
455
|
-
return true;
|
|
456
|
-
} catch {
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
return false;
|
|
460
|
-
}
|
|
461
|
-
async function installBrowsers() {
|
|
462
|
-
const executables = import_server.registry.defaultExecutables();
|
|
463
|
-
await import_server.registry.install(executables, false);
|
|
464
|
-
}
|
|
465
|
-
function printInternalError(e) {
|
|
466
|
-
console.error("Internal error:", e);
|
|
467
|
-
}
|
|
468
|
-
async function resolveCtDirs(config) {
|
|
469
|
-
const use = config.config.projects[0].use;
|
|
470
|
-
const relativeTemplateDir = use.ctTemplateDir || "playwright";
|
|
471
|
-
const templateDir = await import_fs.default.promises.realpath(import_path.default.normalize(import_path.default.join(config.configDir, relativeTemplateDir))).catch(() => void 0);
|
|
472
|
-
if (!templateDir)
|
|
473
|
-
return null;
|
|
474
|
-
const outDir = use.ctCacheDir ? import_path.default.resolve(config.configDir, use.ctCacheDir) : import_path.default.resolve(templateDir, ".cache");
|
|
475
|
-
return {
|
|
476
|
-
outDir,
|
|
477
|
-
templateDir
|
|
478
|
-
};
|
|
479
|
-
}
|
|
480
262
|
// Annotate the CommonJS export names for ESM import in node:
|
|
481
263
|
0 && (module.exports = {
|
|
264
|
+
TestRunnerEvent,
|
|
482
265
|
TestServerDispatcher,
|
|
483
|
-
resolveCtDirs,
|
|
484
266
|
runTestServer,
|
|
485
267
|
runUIMode
|
|
486
268
|
});
|
package/lib/runner/watchMode.js
CHANGED
|
@@ -31,6 +31,7 @@ __export(watchMode_exports, {
|
|
|
31
31
|
runWatchModeLoop: () => runWatchModeLoop
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(watchMode_exports);
|
|
34
|
+
var import_fs = __toESM(require("fs"));
|
|
34
35
|
var import_path = __toESM(require("path"));
|
|
35
36
|
var import_readline = __toESM(require("readline"));
|
|
36
37
|
var import_stream = require("stream");
|
|
@@ -42,6 +43,8 @@ var import_utilsBundle = require("../utilsBundle");
|
|
|
42
43
|
var import_testServer = require("./testServer");
|
|
43
44
|
var import_teleSuiteUpdater = require("../isomorphic/teleSuiteUpdater");
|
|
44
45
|
var import_testServerConnection = require("../isomorphic/testServerConnection");
|
|
46
|
+
var import_util = require("../util");
|
|
47
|
+
var import_babelBundle = require("../transform/babelBundle");
|
|
45
48
|
class InMemoryTransport extends import_stream.EventEmitter {
|
|
46
49
|
constructor(send) {
|
|
47
50
|
super();
|
|
@@ -113,7 +116,37 @@ async function runWatchModeLoop(configLocation, initialOptions) {
|
|
|
113
116
|
});
|
|
114
117
|
});
|
|
115
118
|
testServerConnection.onReport((report2) => teleSuiteUpdater.processTestReportEvent(report2));
|
|
116
|
-
|
|
119
|
+
testServerConnection.onRecoverFromStepError(({ stepId, message, location }) => {
|
|
120
|
+
process.stdout.write(`
|
|
121
|
+
Test error occurred.
|
|
122
|
+
`);
|
|
123
|
+
process.stdout.write("\n" + createErrorCodeframe(message, location) + "\n");
|
|
124
|
+
process.stdout.write(`
|
|
125
|
+
${import_utils2.colors.dim("Try recovering from the error. Press")} ${import_utils2.colors.bold("c")} ${import_utils2.colors.dim("to continue or")} ${import_utils2.colors.bold("t")} ${import_utils2.colors.dim("to throw the error")}
|
|
126
|
+
`);
|
|
127
|
+
readKeyPress((text) => {
|
|
128
|
+
if (text === "c") {
|
|
129
|
+
process.stdout.write(`
|
|
130
|
+
${import_utils2.colors.dim("Continuing after recovery...")}
|
|
131
|
+
`);
|
|
132
|
+
testServerConnection.resumeAfterStepError({ stepId, status: "recovered", value: void 0 }).catch(() => {
|
|
133
|
+
});
|
|
134
|
+
} else if (text === "t") {
|
|
135
|
+
process.stdout.write(`
|
|
136
|
+
${import_utils2.colors.dim("Throwing error...")}
|
|
137
|
+
`);
|
|
138
|
+
testServerConnection.resumeAfterStepError({ stepId, status: "failed" }).catch(() => {
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return text;
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
await testServerConnection.initialize({
|
|
145
|
+
interceptStdio: false,
|
|
146
|
+
watchTestDirs: true,
|
|
147
|
+
populateDependenciesOnList: true,
|
|
148
|
+
recoverFromStepErrors: !process.env.PWTEST_RECOVERY_DISABLED
|
|
149
|
+
});
|
|
117
150
|
await testServerConnection.runGlobalSetup({});
|
|
118
151
|
const { report } = await testServerConnection.listTests({});
|
|
119
152
|
teleSuiteUpdater.processListReport(report);
|
|
@@ -385,6 +418,29 @@ async function toggleShowBrowser() {
|
|
|
385
418
|
`);
|
|
386
419
|
}
|
|
387
420
|
}
|
|
421
|
+
function createErrorCodeframe(message, location) {
|
|
422
|
+
let source;
|
|
423
|
+
try {
|
|
424
|
+
source = import_fs.default.readFileSync(location.file, "utf-8") + "\n//";
|
|
425
|
+
} catch (e) {
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
return (0, import_babelBundle.codeFrameColumns)(
|
|
429
|
+
source,
|
|
430
|
+
{
|
|
431
|
+
start: {
|
|
432
|
+
line: location.line,
|
|
433
|
+
column: location.column
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
highlightCode: true,
|
|
438
|
+
linesAbove: 5,
|
|
439
|
+
linesBelow: 5,
|
|
440
|
+
message: (0, import_util.stripAnsiEscapes)(message).split("\n")[0] || void 0
|
|
441
|
+
}
|
|
442
|
+
);
|
|
443
|
+
}
|
|
388
444
|
// Annotate the CommonJS export names for ESM import in node:
|
|
389
445
|
0 && (module.exports = {
|
|
390
446
|
runWatchModeLoop
|
package/lib/runner/workerHost.js
CHANGED
|
@@ -39,7 +39,7 @@ var import_ipc = require("../common/ipc");
|
|
|
39
39
|
var import_folders = require("../isomorphic/folders");
|
|
40
40
|
let lastWorkerIndex = 0;
|
|
41
41
|
class WorkerHost extends import_processHost.ProcessHost {
|
|
42
|
-
constructor(testGroup, parallelIndex, config, extraEnv, outputDir) {
|
|
42
|
+
constructor(testGroup, parallelIndex, config, recoverFromStepErrors, extraEnv, outputDir) {
|
|
43
43
|
const workerIndex = lastWorkerIndex++;
|
|
44
44
|
super(require.resolve("../worker/workerMain.js"), `worker-${workerIndex}`, {
|
|
45
45
|
...extraEnv,
|
|
@@ -56,7 +56,8 @@ class WorkerHost extends import_processHost.ProcessHost {
|
|
|
56
56
|
repeatEachIndex: testGroup.repeatEachIndex,
|
|
57
57
|
projectId: testGroup.projectId,
|
|
58
58
|
config,
|
|
59
|
-
artifactsDir: import_path.default.join(outputDir, (0, import_folders.artifactsFolderName)(workerIndex))
|
|
59
|
+
artifactsDir: import_path.default.join(outputDir, (0, import_folders.artifactsFolderName)(workerIndex)),
|
|
60
|
+
recoverFromStepErrors
|
|
60
61
|
};
|
|
61
62
|
}
|
|
62
63
|
async start() {
|
|
@@ -77,6 +78,9 @@ class WorkerHost extends import_processHost.ProcessHost {
|
|
|
77
78
|
runTestGroup(runPayload) {
|
|
78
79
|
this.sendMessageNoReply({ method: "runTestGroup", params: runPayload });
|
|
79
80
|
}
|
|
81
|
+
resumeAfterStepError(result) {
|
|
82
|
+
this.sendMessageNoReply({ method: "resumeAfterStepError", params: result });
|
|
83
|
+
}
|
|
80
84
|
hash() {
|
|
81
85
|
return this._hash;
|
|
82
86
|
}
|
package/lib/worker/testInfo.js
CHANGED
|
@@ -43,7 +43,7 @@ var import_testTracing = require("./testTracing");
|
|
|
43
43
|
var import_util2 = require("./util");
|
|
44
44
|
var import_transform = require("../transform/transform");
|
|
45
45
|
class TestInfoImpl {
|
|
46
|
-
constructor(configInternal, projectInternal, workerParams, test, retry, onStepBegin, onStepEnd, onAttach) {
|
|
46
|
+
constructor(configInternal, projectInternal, workerParams, test, retry, onStepBegin, onStepRecoverFromError, onStepEnd, onAttach) {
|
|
47
47
|
this._snapshotNames = { lastAnonymousSnapshotIndex: 0, lastNamedSnapshotIndex: {} };
|
|
48
48
|
this._ariaSnapshotNames = { lastAnonymousSnapshotIndex: 0, lastNamedSnapshotIndex: {} };
|
|
49
49
|
this._wasInterrupted = false;
|
|
@@ -61,6 +61,7 @@ class TestInfoImpl {
|
|
|
61
61
|
this.errors = [];
|
|
62
62
|
this.testId = test?.id ?? "";
|
|
63
63
|
this._onStepBegin = onStepBegin;
|
|
64
|
+
this._onStepRecoverFromError = onStepRecoverFromError;
|
|
64
65
|
this._onStepEnd = onStepEnd;
|
|
65
66
|
this._onAttach = onAttach;
|
|
66
67
|
this._startTime = (0, import_utils.monotonicTime)();
|
|
@@ -84,6 +85,7 @@ class TestInfoImpl {
|
|
|
84
85
|
this.fn = test?.fn ?? (() => {
|
|
85
86
|
});
|
|
86
87
|
this.expectedStatus = test?.expectedStatus ?? "skipped";
|
|
88
|
+
this._recoverFromStepErrorResults = workerParams.recoverFromStepErrors ? /* @__PURE__ */ new Map() : void 0;
|
|
87
89
|
this._timeoutManager = new import_timeoutManager.TimeoutManager(this.project.timeout);
|
|
88
90
|
if (configInternal.configCLIOverrides.debug)
|
|
89
91
|
this._setDebugMode();
|
|
@@ -202,6 +204,22 @@ class TestInfoImpl {
|
|
|
202
204
|
steps: [],
|
|
203
205
|
attachmentIndices: [],
|
|
204
206
|
info: new TestStepInfoImpl(this, stepId, data.title, parentStep?.info),
|
|
207
|
+
recoverFromStepError: async (error) => {
|
|
208
|
+
if (!this._recoverFromStepErrorResults)
|
|
209
|
+
return { stepId, status: "failed" };
|
|
210
|
+
const payload = {
|
|
211
|
+
testId: this.testId,
|
|
212
|
+
stepId,
|
|
213
|
+
error: (0, import_util.serializeError)(error)
|
|
214
|
+
};
|
|
215
|
+
this._onStepRecoverFromError(payload);
|
|
216
|
+
const recoveryPromise = new import_utils.ManualPromise();
|
|
217
|
+
this._recoverFromStepErrorResults.set(stepId, recoveryPromise);
|
|
218
|
+
const recoveryResult = await recoveryPromise;
|
|
219
|
+
if (recoveryResult.stepId !== stepId)
|
|
220
|
+
return { stepId, status: "failed" };
|
|
221
|
+
return recoveryResult;
|
|
222
|
+
},
|
|
205
223
|
complete: (result) => {
|
|
206
224
|
if (step.endWallTime)
|
|
207
225
|
return;
|
|
@@ -270,6 +288,11 @@ ${(0, import_utils.stringifyStackFrames)(step.boxedStack).join("\n")}`;
|
|
|
270
288
|
}
|
|
271
289
|
return step;
|
|
272
290
|
}
|
|
291
|
+
resumeAfterStepError(result) {
|
|
292
|
+
const recoveryPromise = this._recoverFromStepErrorResults?.get(result.stepId);
|
|
293
|
+
if (recoveryPromise)
|
|
294
|
+
recoveryPromise.resolve(result);
|
|
295
|
+
}
|
|
273
296
|
_interrupt() {
|
|
274
297
|
this._wasInterrupted = true;
|
|
275
298
|
this._timeoutManager.interrupt();
|
package/lib/worker/workerMain.js
CHANGED
|
@@ -95,6 +95,7 @@ class WorkerMain extends import_process.ProcessRunner {
|
|
|
95
95
|
const fakeTestInfo = new import_testInfo.TestInfoImpl(this._config, this._project, this._params, void 0, 0, () => {
|
|
96
96
|
}, () => {
|
|
97
97
|
}, () => {
|
|
98
|
+
}, () => {
|
|
98
99
|
});
|
|
99
100
|
const runnable = { type: "teardown" };
|
|
100
101
|
await fakeTestInfo._runWithTimeout(runnable, () => this._loadIfNeeded()).catch(() => {
|
|
@@ -216,6 +217,9 @@ class WorkerMain extends import_process.ProcessRunner {
|
|
|
216
217
|
this._runFinished.resolve();
|
|
217
218
|
}
|
|
218
219
|
}
|
|
220
|
+
resumeAfterStepError(params) {
|
|
221
|
+
this._currentTest?.resumeAfterStepError(params);
|
|
222
|
+
}
|
|
219
223
|
async _runTest(test, retry, nextTest) {
|
|
220
224
|
const testInfo = new import_testInfo.TestInfoImpl(
|
|
221
225
|
this._config,
|
|
@@ -224,6 +228,7 @@ class WorkerMain extends import_process.ProcessRunner {
|
|
|
224
228
|
test,
|
|
225
229
|
retry,
|
|
226
230
|
(stepBeginPayload) => this.dispatchEvent("stepBegin", stepBeginPayload),
|
|
231
|
+
(stepRecoverFromErrorPayload) => this.dispatchEvent("stepRecoverFromError", stepRecoverFromErrorPayload),
|
|
227
232
|
(stepEndPayload) => this.dispatchEvent("stepEnd", stepEndPayload),
|
|
228
233
|
(attachment) => this.dispatchEvent("attach", attachment)
|
|
229
234
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "playwright",
|
|
3
|
-
"version": "1.55.0-alpha-2025-08-
|
|
3
|
+
"version": "1.55.0-alpha-2025-08-14",
|
|
4
4
|
"description": "A high-level API to automate web browsers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"license": "Apache-2.0",
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"playwright-core": "1.55.0-alpha-2025-08-
|
|
59
|
+
"playwright-core": "1.55.0-alpha-2025-08-14"
|
|
60
60
|
},
|
|
61
61
|
"optionalDependencies": {
|
|
62
62
|
"fsevents": "2.3.2"
|