playwright 1.55.1 → 1.56.1
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/README.md +3 -3
- package/ThirdPartyNotices.txt +3 -3
- package/lib/agents/generateAgents.js +263 -0
- package/lib/agents/generator.md +102 -0
- package/lib/agents/healer.md +78 -0
- package/lib/agents/planner.md +135 -0
- package/lib/common/config.js +1 -1
- package/lib/common/expectBundle.js +3 -0
- package/lib/common/expectBundleImpl.js +51 -51
- package/lib/index.js +7 -8
- package/lib/isomorphic/testServerConnection.js +0 -7
- package/lib/isomorphic/testTree.js +35 -8
- package/lib/matchers/expect.js +8 -21
- package/lib/matchers/matcherHint.js +42 -18
- package/lib/matchers/matchers.js +12 -6
- package/lib/matchers/toBeTruthy.js +16 -14
- package/lib/matchers/toEqual.js +18 -13
- package/lib/matchers/toHaveURL.js +12 -27
- package/lib/matchers/toMatchAriaSnapshot.js +26 -30
- package/lib/matchers/toMatchSnapshot.js +15 -12
- package/lib/matchers/toMatchText.js +29 -35
- package/lib/mcp/browser/actions.d.js +16 -0
- package/lib/mcp/browser/browserContextFactory.js +296 -0
- package/lib/mcp/browser/browserServerBackend.js +76 -0
- package/lib/mcp/browser/codegen.js +66 -0
- package/lib/mcp/browser/config.js +383 -0
- package/lib/mcp/browser/context.js +284 -0
- package/lib/mcp/browser/response.js +228 -0
- package/lib/mcp/browser/sessionLog.js +160 -0
- package/lib/mcp/browser/tab.js +277 -0
- package/lib/mcp/browser/tools/common.js +63 -0
- package/lib/mcp/browser/tools/console.js +44 -0
- package/lib/mcp/browser/tools/dialogs.js +60 -0
- package/lib/mcp/browser/tools/evaluate.js +70 -0
- package/lib/mcp/browser/tools/files.js +58 -0
- package/lib/mcp/browser/tools/form.js +74 -0
- package/lib/mcp/browser/tools/install.js +69 -0
- package/lib/mcp/browser/tools/keyboard.js +85 -0
- package/lib/mcp/browser/tools/mouse.js +107 -0
- package/lib/mcp/browser/tools/navigate.js +62 -0
- package/lib/mcp/browser/tools/network.js +54 -0
- package/lib/mcp/browser/tools/pdf.js +59 -0
- package/lib/mcp/browser/tools/screenshot.js +88 -0
- package/lib/mcp/browser/tools/snapshot.js +182 -0
- package/lib/mcp/browser/tools/tabs.js +67 -0
- package/lib/mcp/browser/tools/tool.js +49 -0
- package/lib/mcp/browser/tools/tracing.js +74 -0
- package/lib/mcp/browser/tools/utils.js +100 -0
- package/lib/mcp/browser/tools/verify.js +154 -0
- package/lib/mcp/browser/tools/wait.js +63 -0
- package/lib/mcp/browser/tools.js +80 -0
- package/lib/mcp/browser/watchdog.js +44 -0
- package/lib/mcp/config.d.js +16 -0
- package/lib/mcp/extension/cdpRelay.js +351 -0
- package/lib/mcp/extension/extensionContextFactory.js +75 -0
- package/lib/mcp/extension/protocol.js +28 -0
- package/lib/mcp/index.js +61 -0
- package/lib/mcp/{tool.js → log.js} +12 -18
- package/lib/mcp/program.js +96 -0
- package/lib/mcp/{bundle.js → sdk/bundle.js} +24 -2
- package/lib/mcp/{exports.js → sdk/exports.js} +12 -10
- package/lib/mcp/{transport.js → sdk/http.js} +79 -60
- package/lib/mcp/sdk/mdb.js +208 -0
- package/lib/mcp/{proxyBackend.js → sdk/proxyBackend.js} +18 -13
- package/lib/mcp/sdk/server.js +190 -0
- package/lib/mcp/sdk/tool.js +51 -0
- package/lib/mcp/test/browserBackend.js +98 -0
- package/lib/mcp/test/generatorTools.js +122 -0
- package/lib/mcp/test/plannerTools.js +46 -0
- package/lib/mcp/test/seed.js +72 -0
- package/lib/mcp/test/streams.js +39 -0
- package/lib/mcp/test/testBackend.js +97 -0
- package/lib/mcp/test/testContext.js +176 -0
- package/lib/mcp/test/testTool.js +30 -0
- package/lib/mcp/test/testTools.js +115 -0
- package/lib/mcpBundleImpl.js +14 -67
- package/lib/plugins/webServerPlugin.js +2 -0
- package/lib/program.js +68 -0
- package/lib/reporters/base.js +15 -17
- package/lib/reporters/html.js +39 -26
- package/lib/reporters/list.js +8 -4
- package/lib/reporters/listModeReporter.js +6 -3
- package/lib/reporters/merge.js +3 -1
- package/lib/reporters/teleEmitter.js +3 -1
- package/lib/runner/dispatcher.js +9 -23
- package/lib/runner/failureTracker.js +12 -16
- package/lib/runner/loadUtils.js +39 -3
- package/lib/runner/projectUtils.js +8 -2
- package/lib/runner/tasks.js +18 -7
- package/lib/runner/testRunner.js +16 -28
- package/lib/runner/testServer.js +17 -23
- package/lib/runner/watchMode.js +1 -53
- package/lib/runner/workerHost.js +8 -10
- package/lib/transform/babelBundleImpl.js +10 -10
- package/lib/transform/compilationCache.js +22 -5
- package/lib/util.js +12 -16
- package/lib/utilsBundleImpl.js +1 -1
- package/lib/worker/fixtureRunner.js +15 -7
- package/lib/worker/testInfo.js +9 -24
- package/lib/worker/workerMain.js +12 -8
- package/package.json +7 -3
- package/types/test.d.ts +17 -8
- package/types/testReporter.d.ts +1 -1
- package/lib/mcp/server.js +0 -118
- /package/lib/mcp/{inProcessTransport.js → sdk/inProcessTransport.js} +0 -0
package/lib/runner/tasks.js
CHANGED
|
@@ -60,14 +60,15 @@ var import_compilationCache = require("../transform/compilationCache");
|
|
|
60
60
|
var import_util2 = require("../util");
|
|
61
61
|
const readDirAsync = (0, import_util.promisify)(import_fs.default.readdir);
|
|
62
62
|
class TestRun {
|
|
63
|
-
constructor(config, reporter) {
|
|
63
|
+
constructor(config, reporter, options) {
|
|
64
64
|
this.rootSuite = void 0;
|
|
65
65
|
this.phases = [];
|
|
66
66
|
this.projectFiles = /* @__PURE__ */ new Map();
|
|
67
67
|
this.projectSuites = /* @__PURE__ */ new Map();
|
|
68
|
+
this.topLevelProjects = [];
|
|
68
69
|
this.config = config;
|
|
69
70
|
this.reporter = reporter;
|
|
70
|
-
this.failureTracker = new import_failureTracker.FailureTracker(config);
|
|
71
|
+
this.failureTracker = new import_failureTracker.FailureTracker(config, options);
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
async function runTasks(testRun, tasks, globalTimeout, cancelPromise) {
|
|
@@ -214,8 +215,9 @@ function createListFilesTask() {
|
|
|
214
215
|
return {
|
|
215
216
|
title: "load tests",
|
|
216
217
|
setup: async (testRun, errors) => {
|
|
217
|
-
|
|
218
|
-
testRun.
|
|
218
|
+
const { rootSuite, topLevelProjects } = await (0, import_loadUtils.createRootSuite)(testRun, errors, false);
|
|
219
|
+
testRun.rootSuite = rootSuite;
|
|
220
|
+
testRun.failureTracker.onRootSuite(rootSuite, topLevelProjects);
|
|
219
221
|
await (0, import_loadUtils.collectProjectsAndTestFiles)(testRun, false);
|
|
220
222
|
for (const [project, files] of testRun.projectFiles) {
|
|
221
223
|
const projectSuite = new import_test.Suite(project.project.name, "project");
|
|
@@ -247,9 +249,18 @@ function createLoadTask(mode, options) {
|
|
|
247
249
|
const changedFiles = await (0, import_vcs.detectChangedTestFiles)(testRun.config.cliOnlyChanged, testRun.config.configDir);
|
|
248
250
|
testRun.config.preOnlyTestFilters.push((test) => changedFiles.has(test.location.file));
|
|
249
251
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
252
|
+
if (testRun.config.cliTestList) {
|
|
253
|
+
const testListFilter = await (0, import_loadUtils.loadTestList)(testRun.config, testRun.config.cliTestList);
|
|
254
|
+
testRun.config.preOnlyTestFilters.push(testListFilter);
|
|
255
|
+
}
|
|
256
|
+
if (testRun.config.cliTestListInvert) {
|
|
257
|
+
const testListInvertFilter = await (0, import_loadUtils.loadTestList)(testRun.config, testRun.config.cliTestListInvert);
|
|
258
|
+
testRun.config.preOnlyTestFilters.push((test) => !testListInvertFilter(test));
|
|
259
|
+
}
|
|
260
|
+
const { rootSuite, topLevelProjects } = await (0, import_loadUtils.createRootSuite)(testRun, options.failOnLoadErrors ? errors : softErrors, !!options.filterOnly);
|
|
261
|
+
testRun.rootSuite = rootSuite;
|
|
262
|
+
testRun.failureTracker.onRootSuite(rootSuite, topLevelProjects);
|
|
263
|
+
if (options.failOnLoadErrors && !testRun.rootSuite.allTests().length && !testRun.config.cliPassWithNoTests && !testRun.config.config.shard && !testRun.config.cliOnlyChanged && !testRun.config.cliTestList && !testRun.config.cliTestListInvert) {
|
|
253
264
|
if (testRun.config.cliArgs.length) {
|
|
254
265
|
throw new Error([
|
|
255
266
|
`No tests found.`,
|
package/lib/runner/testRunner.js
CHANGED
|
@@ -51,8 +51,7 @@ var import_reporters = require("./reporters");
|
|
|
51
51
|
var import_tasks = require("./tasks");
|
|
52
52
|
var import_lastRun = require("./lastRun");
|
|
53
53
|
const TestRunnerEvent = {
|
|
54
|
-
TestFilesChanged: "testFilesChanged"
|
|
55
|
-
RecoverFromStepError: "recoverFromStepError"
|
|
54
|
+
TestFilesChanged: "testFilesChanged"
|
|
56
55
|
};
|
|
57
56
|
class TestRunner extends import_events.default {
|
|
58
57
|
constructor(configLocation, configCLIOverrides) {
|
|
@@ -63,8 +62,6 @@ class TestRunner extends import_events.default {
|
|
|
63
62
|
this._queue = Promise.resolve();
|
|
64
63
|
this._watchTestDirs = false;
|
|
65
64
|
this._populateDependenciesOnList = false;
|
|
66
|
-
this._recoverFromStepErrors = false;
|
|
67
|
-
this._resumeAfterStepErrors = /* @__PURE__ */ new Map();
|
|
68
65
|
this.configLocation = configLocation;
|
|
69
66
|
this._configCLIOverrides = configCLIOverrides;
|
|
70
67
|
this._watcher = new import_fsWatcher.Watcher((events) => {
|
|
@@ -74,9 +71,9 @@ class TestRunner extends import_events.default {
|
|
|
74
71
|
});
|
|
75
72
|
}
|
|
76
73
|
async initialize(params) {
|
|
74
|
+
(0, import_utils.setPlaywrightTestProcessEnv)();
|
|
77
75
|
this._watchTestDirs = !!params.watchTestDirs;
|
|
78
76
|
this._populateDependenciesOnList = !!params.populateDependenciesOnList;
|
|
79
|
-
this._recoverFromStepErrors = !!params.recoverFromStepErrors;
|
|
80
77
|
}
|
|
81
78
|
resizeTerminal(params) {
|
|
82
79
|
process.stdout.columns = params.cols;
|
|
@@ -98,6 +95,12 @@ class TestRunner extends import_events.default {
|
|
|
98
95
|
const executables = import_server.registry.defaultExecutables();
|
|
99
96
|
await import_server.registry.install(executables, false);
|
|
100
97
|
}
|
|
98
|
+
async loadConfig() {
|
|
99
|
+
const { config, error } = await this._loadConfig(this._configCLIOverrides);
|
|
100
|
+
if (config)
|
|
101
|
+
return config;
|
|
102
|
+
throw new Error("Failed to load config: " + (error ? error.message : "Unknown error"));
|
|
103
|
+
}
|
|
101
104
|
async runGlobalSetup(userReporters) {
|
|
102
105
|
await this.runGlobalTeardown();
|
|
103
106
|
const reporter = new import_internalReporter.InternalReporter(userReporters);
|
|
@@ -232,6 +235,7 @@ class TestRunner extends import_events.default {
|
|
|
232
235
|
...this._configCLIOverrides,
|
|
233
236
|
repeatEach: 1,
|
|
234
237
|
retries: 0,
|
|
238
|
+
timeout: params.timeout,
|
|
235
239
|
preserveOutputDir: true,
|
|
236
240
|
reporter: params.reporters ? params.reporters.map((r) => [r]) : void 0,
|
|
237
241
|
use: {
|
|
@@ -265,16 +269,15 @@ class TestRunner extends import_events.default {
|
|
|
265
269
|
const testIdSet = new Set(params.testIds);
|
|
266
270
|
config.preOnlyTestFilters.push((test) => testIdSet.has(test.id));
|
|
267
271
|
}
|
|
268
|
-
const configReporters = await (0, import_reporters.createReporters)(config, "test", true);
|
|
272
|
+
const configReporters = params.disableConfigReporters ? [] : await (0, import_reporters.createReporters)(config, "test", true);
|
|
269
273
|
const reporter = new import_internalReporter.InternalReporter([...configReporters, userReporter]);
|
|
270
274
|
const stop = new import_utils.ManualPromise();
|
|
271
275
|
const tasks = [
|
|
272
276
|
(0, import_tasks.createApplyRebaselinesTask)(),
|
|
273
|
-
(0, import_tasks.createLoadTask)("out-of-process", { filterOnly: true, failOnLoadErrors:
|
|
277
|
+
(0, import_tasks.createLoadTask)("out-of-process", { filterOnly: true, failOnLoadErrors: !!params.failOnLoadErrors, doNotRunDepsOutsideProjectFilter: params.doNotRunDepsOutsideProjectFilter }),
|
|
274
278
|
...(0, import_tasks.createRunTestsTasks)(config)
|
|
275
279
|
];
|
|
276
|
-
const testRun = new import_tasks.TestRun(config, reporter);
|
|
277
|
-
testRun.failureTracker.setRecoverFromStepErrorHandler(this._recoverFromStepError.bind(this));
|
|
280
|
+
const testRun = new import_tasks.TestRun(config, reporter, { pauseOnError: params.pauseOnError, pauseAtEnd: params.pauseAtEnd });
|
|
278
281
|
const run = (0, import_tasks.runTasks)(testRun, tasks, 0, stop).then(async (status) => {
|
|
279
282
|
this._testRun = void 0;
|
|
280
283
|
return status;
|
|
@@ -282,24 +285,6 @@ class TestRunner extends import_events.default {
|
|
|
282
285
|
this._testRun = { run, stop };
|
|
283
286
|
return { status: await run };
|
|
284
287
|
}
|
|
285
|
-
async _recoverFromStepError(stepId, error) {
|
|
286
|
-
if (!this._recoverFromStepErrors)
|
|
287
|
-
return { stepId, status: "failed" };
|
|
288
|
-
const recoveryPromise = new import_utils.ManualPromise();
|
|
289
|
-
this._resumeAfterStepErrors.set(stepId, recoveryPromise);
|
|
290
|
-
if (!error?.message || !error?.location)
|
|
291
|
-
return { stepId, status: "failed" };
|
|
292
|
-
this.emit(TestRunnerEvent.RecoverFromStepError, stepId, error.message, error.location);
|
|
293
|
-
const recoveredResult = await recoveryPromise;
|
|
294
|
-
if (recoveredResult.stepId !== stepId)
|
|
295
|
-
return { stepId, status: "failed" };
|
|
296
|
-
return recoveredResult;
|
|
297
|
-
}
|
|
298
|
-
async resumeAfterStepError(params) {
|
|
299
|
-
const recoveryPromise = this._resumeAfterStepErrors.get(params.stepId);
|
|
300
|
-
if (recoveryPromise)
|
|
301
|
-
recoveryPromise.resolve(params);
|
|
302
|
-
}
|
|
303
288
|
async watch(fileNames) {
|
|
304
289
|
this._watchedTestDependencies = /* @__PURE__ */ new Set();
|
|
305
290
|
for (const fileName of fileNames) {
|
|
@@ -325,11 +310,13 @@ class TestRunner extends import_events.default {
|
|
|
325
310
|
async stopTests() {
|
|
326
311
|
this._testRun?.stop?.resolve();
|
|
327
312
|
await this._testRun?.run;
|
|
328
|
-
this._resumeAfterStepErrors.clear();
|
|
329
313
|
}
|
|
330
314
|
async closeGracefully() {
|
|
331
315
|
(0, import_utils.gracefullyProcessExitDoNotHang)(0);
|
|
332
316
|
}
|
|
317
|
+
async stop() {
|
|
318
|
+
await this.runGlobalTeardown();
|
|
319
|
+
}
|
|
333
320
|
async _loadConfig(overrides) {
|
|
334
321
|
try {
|
|
335
322
|
const config = await (0, import_configLoader.loadConfig)(this.configLocation, overrides);
|
|
@@ -372,6 +359,7 @@ async function resolveCtDirs(config) {
|
|
|
372
359
|
};
|
|
373
360
|
}
|
|
374
361
|
async function runAllTestsWithConfig(config) {
|
|
362
|
+
(0, import_utils.setPlaywrightTestProcessEnv)();
|
|
375
363
|
const listOnly = config.cliListOnly;
|
|
376
364
|
(0, import_gitCommitInfoPlugin.addGitCommitInfoPlugin)(config);
|
|
377
365
|
(0, import_webServerPlugin.webServerPluginsForConfig)(config).forEach((p) => config.plugins.push({ factory: p }));
|
package/lib/runner/testServer.js
CHANGED
|
@@ -28,7 +28,6 @@ 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,
|
|
32
31
|
TestServerDispatcher: () => TestServerDispatcher,
|
|
33
32
|
runTestServer: () => runTestServer,
|
|
34
33
|
runUIMode: () => runUIMode
|
|
@@ -56,14 +55,9 @@ class TestServer {
|
|
|
56
55
|
return await (0, import_server.startTraceViewerServer)({ ...options, transport: this._dispatcher.transport });
|
|
57
56
|
}
|
|
58
57
|
async stop() {
|
|
59
|
-
await this._dispatcher?.
|
|
60
|
-
await this._dispatcher?.runGlobalTeardown();
|
|
58
|
+
await this._dispatcher?.stop();
|
|
61
59
|
}
|
|
62
60
|
}
|
|
63
|
-
const TestRunnerEvent = {
|
|
64
|
-
TestFilesChanged: "testFilesChanged",
|
|
65
|
-
RecoverFromStepError: "recoverFromStepError"
|
|
66
|
-
};
|
|
67
61
|
class TestServerDispatcher {
|
|
68
62
|
constructor(configLocation, configCLIOverrides) {
|
|
69
63
|
this._serializer = require.resolve("./uiModeReporter");
|
|
@@ -79,8 +73,7 @@ class TestServerDispatcher {
|
|
|
79
73
|
}
|
|
80
74
|
};
|
|
81
75
|
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 }));
|
|
76
|
+
this._testRunner.on(import_testRunner.TestRunnerEvent.TestFilesChanged, (testFiles) => this._dispatchEvent("testFilesChanged", { testFiles }));
|
|
84
77
|
}
|
|
85
78
|
async _wireReporter(messageSink) {
|
|
86
79
|
return await (0, import_reporters.createReporterForTestServer)(this._serializer, messageSink);
|
|
@@ -95,12 +88,10 @@ class TestServerDispatcher {
|
|
|
95
88
|
async initialize(params) {
|
|
96
89
|
this._serializer = params.serializer || require.resolve("./uiModeReporter");
|
|
97
90
|
this._closeOnDisconnect = !!params.closeOnDisconnect;
|
|
98
|
-
await this._setInterceptStdio(!!params.interceptStdio);
|
|
99
91
|
await this._testRunner.initialize({
|
|
100
|
-
|
|
101
|
-
populateDependenciesOnList: !!params.populateDependenciesOnList,
|
|
102
|
-
recoverFromStepErrors: !!params.recoverFromStepErrors
|
|
92
|
+
...params
|
|
103
93
|
});
|
|
94
|
+
this._setInterceptStdio(!!params.interceptStdio);
|
|
104
95
|
}
|
|
105
96
|
async ping() {
|
|
106
97
|
}
|
|
@@ -158,12 +149,12 @@ class TestServerDispatcher {
|
|
|
158
149
|
}
|
|
159
150
|
async runTests(params) {
|
|
160
151
|
const wireReporter = await this._wireReporter((e) => this._dispatchEvent("report", e));
|
|
161
|
-
const { status } = await this._testRunner.runTests(wireReporter,
|
|
152
|
+
const { status } = await this._testRunner.runTests(wireReporter, {
|
|
153
|
+
...params,
|
|
154
|
+
doNotRunDepsOutsideProjectFilter: true
|
|
155
|
+
});
|
|
162
156
|
return { status };
|
|
163
157
|
}
|
|
164
|
-
async resumeAfterStepError(params) {
|
|
165
|
-
await this._testRunner.resumeAfterStepError(params);
|
|
166
|
-
}
|
|
167
158
|
async watch(params) {
|
|
168
159
|
await this._testRunner.watch(params.fileNames);
|
|
169
160
|
}
|
|
@@ -173,10 +164,17 @@ class TestServerDispatcher {
|
|
|
173
164
|
async stopTests() {
|
|
174
165
|
await this._testRunner.stopTests();
|
|
175
166
|
}
|
|
176
|
-
async
|
|
167
|
+
async stop() {
|
|
168
|
+
this._setInterceptStdio(false);
|
|
169
|
+
await this._testRunner.stop();
|
|
170
|
+
}
|
|
171
|
+
async closeGracefully() {
|
|
172
|
+
await this._testRunner.closeGracefully();
|
|
173
|
+
}
|
|
174
|
+
_setInterceptStdio(interceptStdio) {
|
|
177
175
|
if (process.env.PWTEST_DEBUG)
|
|
178
176
|
return;
|
|
179
|
-
if (
|
|
177
|
+
if (interceptStdio) {
|
|
180
178
|
if (import_utilsBundle.debug.log === originalDebugLog) {
|
|
181
179
|
import_utilsBundle.debug.log = (...args) => {
|
|
182
180
|
const string = import_util.default.format(...args) + "\n";
|
|
@@ -199,9 +197,6 @@ class TestServerDispatcher {
|
|
|
199
197
|
process.stderr.write = originalStderrWrite;
|
|
200
198
|
}
|
|
201
199
|
}
|
|
202
|
-
async closeGracefully() {
|
|
203
|
-
await this._testRunner.closeGracefully();
|
|
204
|
-
}
|
|
205
200
|
}
|
|
206
201
|
async function runUIMode(configFile, configCLIOverrides, options) {
|
|
207
202
|
const configLocation = (0, import_configLoader.resolveConfigLocation)(configFile);
|
|
@@ -263,7 +258,6 @@ function chunkToPayload(type, chunk) {
|
|
|
263
258
|
}
|
|
264
259
|
// Annotate the CommonJS export names for ESM import in node:
|
|
265
260
|
0 && (module.exports = {
|
|
266
|
-
TestRunnerEvent,
|
|
267
261
|
TestServerDispatcher,
|
|
268
262
|
runTestServer,
|
|
269
263
|
runUIMode
|
package/lib/runner/watchMode.js
CHANGED
|
@@ -31,7 +31,6 @@ __export(watchMode_exports, {
|
|
|
31
31
|
runWatchModeLoop: () => runWatchModeLoop
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(watchMode_exports);
|
|
34
|
-
var import_fs = __toESM(require("fs"));
|
|
35
34
|
var import_path = __toESM(require("path"));
|
|
36
35
|
var import_readline = __toESM(require("readline"));
|
|
37
36
|
var import_stream = require("stream");
|
|
@@ -43,8 +42,6 @@ var import_utilsBundle = require("../utilsBundle");
|
|
|
43
42
|
var import_testServer = require("./testServer");
|
|
44
43
|
var import_teleSuiteUpdater = require("../isomorphic/teleSuiteUpdater");
|
|
45
44
|
var import_testServerConnection = require("../isomorphic/testServerConnection");
|
|
46
|
-
var import_util = require("../util");
|
|
47
|
-
var import_babelBundle = require("../transform/babelBundle");
|
|
48
45
|
class InMemoryTransport extends import_stream.EventEmitter {
|
|
49
46
|
constructor(send) {
|
|
50
47
|
super();
|
|
@@ -116,36 +113,10 @@ async function runWatchModeLoop(configLocation, initialOptions) {
|
|
|
116
113
|
});
|
|
117
114
|
});
|
|
118
115
|
testServerConnection.onReport((report2) => teleSuiteUpdater.processTestReportEvent(report2));
|
|
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
116
|
await testServerConnection.initialize({
|
|
145
117
|
interceptStdio: false,
|
|
146
118
|
watchTestDirs: true,
|
|
147
|
-
populateDependenciesOnList: true
|
|
148
|
-
recoverFromStepErrors: !process.env.PWTEST_RECOVERY_DISABLED
|
|
119
|
+
populateDependenciesOnList: true
|
|
149
120
|
});
|
|
150
121
|
await testServerConnection.runGlobalSetup({});
|
|
151
122
|
const { report } = await testServerConnection.listTests({});
|
|
@@ -418,29 +389,6 @@ async function toggleShowBrowser() {
|
|
|
418
389
|
`);
|
|
419
390
|
}
|
|
420
391
|
}
|
|
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
|
-
}
|
|
444
392
|
// Annotate the CommonJS export names for ESM import in node:
|
|
445
393
|
0 && (module.exports = {
|
|
446
394
|
runWatchModeLoop
|
package/lib/runner/workerHost.js
CHANGED
|
@@ -39,25 +39,26 @@ 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,
|
|
42
|
+
constructor(testGroup, options) {
|
|
43
43
|
const workerIndex = lastWorkerIndex++;
|
|
44
44
|
super(require.resolve("../worker/workerMain.js"), `worker-${workerIndex}`, {
|
|
45
|
-
...extraEnv,
|
|
45
|
+
...options.extraEnv,
|
|
46
46
|
FORCE_COLOR: "1",
|
|
47
47
|
DEBUG_COLORS: process.env.DEBUG_COLORS === void 0 ? "1" : process.env.DEBUG_COLORS
|
|
48
48
|
});
|
|
49
49
|
this._didFail = false;
|
|
50
50
|
this.workerIndex = workerIndex;
|
|
51
|
-
this.parallelIndex = parallelIndex;
|
|
51
|
+
this.parallelIndex = options.parallelIndex;
|
|
52
52
|
this._hash = testGroup.workerHash;
|
|
53
53
|
this._params = {
|
|
54
54
|
workerIndex: this.workerIndex,
|
|
55
|
-
parallelIndex,
|
|
55
|
+
parallelIndex: options.parallelIndex,
|
|
56
56
|
repeatEachIndex: testGroup.repeatEachIndex,
|
|
57
57
|
projectId: testGroup.projectId,
|
|
58
|
-
config,
|
|
59
|
-
artifactsDir: import_path.default.join(outputDir, (0, import_folders.artifactsFolderName)(workerIndex)),
|
|
60
|
-
|
|
58
|
+
config: options.config,
|
|
59
|
+
artifactsDir: import_path.default.join(options.outputDir, (0, import_folders.artifactsFolderName)(workerIndex)),
|
|
60
|
+
pauseOnError: options.pauseOnError,
|
|
61
|
+
pauseAtEnd: options.pauseAtEnd
|
|
61
62
|
};
|
|
62
63
|
}
|
|
63
64
|
async start() {
|
|
@@ -78,9 +79,6 @@ class WorkerHost extends import_processHost.ProcessHost {
|
|
|
78
79
|
runTestGroup(runPayload) {
|
|
79
80
|
this.sendMessageNoReply({ method: "runTestGroup", params: runPayload });
|
|
80
81
|
}
|
|
81
|
-
resumeAfterStepError(result) {
|
|
82
|
-
this.sendMessageNoReply({ method: "resumeAfterStepError", params: result });
|
|
83
|
-
}
|
|
84
82
|
hash() {
|
|
85
83
|
return this._hash;
|
|
86
84
|
}
|