playwright 1.56.0-alpha-1756475278000 → 1.56.0-alpha-2025-08-30

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.
@@ -120,7 +120,7 @@ class TerminalReporter {
120
120
  this._fatalErrors = [];
121
121
  this._failureCount = 0;
122
122
  this.screen = options.screen ?? terminalScreen;
123
- this._omitFailures = options.omitFailures || false;
123
+ this._options = options;
124
124
  }
125
125
  version() {
126
126
  return "v2";
@@ -258,7 +258,7 @@ class TerminalReporter {
258
258
  epilogue(full) {
259
259
  const summary = this.generateSummary();
260
260
  const summaryMessage = this.generateSummaryMessage(summary);
261
- if (full && summary.failuresToPrint.length && !this._omitFailures)
261
+ if (full && summary.failuresToPrint.length && !this._options.omitFailures)
262
262
  this._printFailures(summary.failuresToPrint);
263
263
  this._printSlowTests();
264
264
  this._printSummary(summaryMessage);
@@ -284,14 +284,14 @@ class TerminalReporter {
284
284
  willRetry(test) {
285
285
  return test.outcome() === "unexpected" && test.results.length <= test.retries;
286
286
  }
287
- formatTestTitle(test, step, omitLocation = false) {
288
- return formatTestTitle(this.screen, this.config, test, step, omitLocation);
287
+ formatTestTitle(test, step) {
288
+ return formatTestTitle(this.screen, this.config, test, step, this._options);
289
289
  }
290
290
  formatTestHeader(test, options = {}) {
291
- return formatTestHeader(this.screen, this.config, test, options);
291
+ return formatTestHeader(this.screen, this.config, test, { ...options, includeTestId: this._options.includeTestId });
292
292
  }
293
293
  formatFailure(test, index) {
294
- return formatFailure(this.screen, this.config, test, index);
294
+ return formatFailure(this.screen, this.config, test, index, this._options);
295
295
  }
296
296
  formatError(error) {
297
297
  return formatError(this.screen, error);
@@ -300,9 +300,9 @@ class TerminalReporter {
300
300
  this.screen.stdout?.write(line ? line + "\n" : "\n");
301
301
  }
302
302
  }
303
- function formatFailure(screen, config, test, index) {
303
+ function formatFailure(screen, config, test, index, options) {
304
304
  const lines = [];
305
- const header = formatTestHeader(screen, config, test, { indent: " ", index, mode: "error" });
305
+ const header = formatTestHeader(screen, config, test, { indent: " ", index, mode: "error", includeTestId: options?.includeTestId });
306
306
  lines.push(screen.colors.red(header));
307
307
  for (const result of test.results) {
308
308
  const resultLines = [];
@@ -416,20 +416,18 @@ function stepSuffix(step) {
416
416
  const stepTitles = step ? step.titlePath() : [];
417
417
  return stepTitles.map((t) => t.split("\n")[0]).map((t) => " \u203A " + t).join("");
418
418
  }
419
- function formatTestTitle(screen, config, test, step, omitLocation = false) {
419
+ function formatTestTitle(screen, config, test, step, options = {}) {
420
420
  const [, projectName, , ...titles] = test.titlePath();
421
- let location;
422
- if (omitLocation)
423
- location = `${relativeTestPath(screen, config, test)}`;
424
- else
425
- location = `${relativeTestPath(screen, config, test)}:${test.location.line}:${test.location.column}`;
426
- const projectTitle = projectName ? `[${projectName}] \u203A ` : "";
427
- const testTitle = `${projectTitle}${location} \u203A ${titles.join(" \u203A ")}`;
421
+ const location = `${relativeTestPath(screen, config, test)}:${test.location.line}:${test.location.column}`;
422
+ const testId = options.includeTestId ? `[id=${test.id}] ` : "";
423
+ const projectLabel = options.includeTestId ? `project=` : "";
424
+ const projectTitle = projectName ? `[${projectLabel}${projectName}] \u203A ` : "";
425
+ const testTitle = `${testId}${projectTitle}${location} \u203A ${titles.join(" \u203A ")}`;
428
426
  const extraTags = test.tags.filter((t) => !testTitle.includes(t));
429
427
  return `${testTitle}${stepSuffix(step)}${extraTags.length ? " " + extraTags.join(" ") : ""}`;
430
428
  }
431
429
  function formatTestHeader(screen, config, test, options = {}) {
432
- const title = formatTestTitle(screen, config, test);
430
+ const title = formatTestTitle(screen, config, test, void 0, options);
433
431
  const header = `${options.indent || ""}${options.index ? options.index + ") " : ""}${title}`;
434
432
  let fullHeader = header;
435
433
  if (options.mode === "error") {
@@ -34,7 +34,8 @@ module.exports = __toCommonJS(listModeReporter_exports);
34
34
  var import_path = __toESM(require("path"));
35
35
  var import_base = require("./base");
36
36
  class ListModeReporter {
37
- constructor(options) {
37
+ constructor(options = {}) {
38
+ this._options = options;
38
39
  this.screen = options?.screen ?? import_base.terminalScreen;
39
40
  }
40
41
  version() {
@@ -50,8 +51,10 @@ class ListModeReporter {
50
51
  for (const test of tests) {
51
52
  const [, projectName, , ...titles] = test.titlePath();
52
53
  const location = `${import_path.default.relative(this.config.rootDir, test.location.file)}:${test.location.line}:${test.location.column}`;
53
- const projectTitle = projectName ? `[${projectName}] \u203A ` : "";
54
- this._writeLine(` ${projectTitle}${location} \u203A ${titles.join(" \u203A ")}`);
54
+ const testId = this._options.includeTestId ? `[id=${test.id}] ` : "";
55
+ const projectLabel = this._options.includeTestId ? `project=` : "";
56
+ const projectTitle = projectName ? `[${projectLabel}${projectName}] \u203A ` : "";
57
+ this._writeLine(` ${testId}${projectTitle}${location} \u203A ${titles.join(" \u203A ")}`);
55
58
  files.add(test.location.file);
56
59
  }
57
60
  this._writeLine(`Total: ${tests.length} ${tests.length === 1 ? "test" : "tests"} in ${files.size} ${files.size === 1 ? "file" : "files"}`);
@@ -36,8 +36,6 @@ module.exports = __toCommonJS(testRunner_exports);
36
36
  var import_events = __toESM(require("events"));
37
37
  var import_fs = __toESM(require("fs"));
38
38
  var import_path = __toESM(require("path"));
39
- var import_util = __toESM(require("util"));
40
- var import_utilsBundle = require("playwright-core/lib/utilsBundle");
41
39
  var import_server = require("playwright-core/lib/server");
42
40
  var import_utils = require("playwright-core/lib/utils");
43
41
  var import_configLoader = require("../common/configLoader");
@@ -48,17 +46,13 @@ var import_webServerPlugin = require("../plugins/webServerPlugin");
48
46
  var import_base = require("../reporters/base");
49
47
  var import_internalReporter = require("../reporters/internalReporter");
50
48
  var import_compilationCache = require("../transform/compilationCache");
51
- var import_util2 = require("../util");
49
+ var import_util = require("../util");
52
50
  var import_reporters = require("./reporters");
53
51
  var import_tasks = require("./tasks");
54
52
  var import_lastRun = require("./lastRun");
55
53
  const TestRunnerEvent = {
56
- TestFilesChanged: "testFilesChanged",
57
- StdioChunk: "stdioChunk"
54
+ TestFilesChanged: "testFilesChanged"
58
55
  };
59
- const originalDebugLog = import_utilsBundle.debug.log;
60
- const originalStdoutWrite = process.stdout.write;
61
- const originalStderrWrite = process.stderr.write;
62
56
  class TestRunner extends import_events.default {
63
57
  constructor(configLocation, configCLIOverrides) {
64
58
  super();
@@ -79,10 +73,6 @@ class TestRunner extends import_events.default {
79
73
  async initialize(params) {
80
74
  this._watchTestDirs = !!params.watchTestDirs;
81
75
  this._populateDependenciesOnList = !!params.populateDependenciesOnList;
82
- this._setInterceptStdio({
83
- sendStdioEvents: !!params.sendStdioEvents,
84
- muteConsole: !!params.muteConsole
85
- });
86
76
  }
87
77
  resizeTerminal(params) {
88
78
  process.stdout.columns = params.cols;
@@ -318,7 +308,6 @@ class TestRunner extends import_events.default {
318
308
  (0, import_utils.gracefullyProcessExitDoNotHang)(0);
319
309
  }
320
310
  async stop() {
321
- this._setInterceptStdio({ sendStdioEvents: false, muteConsole: false });
322
311
  await this.runGlobalTeardown();
323
312
  }
324
313
  async _loadConfig(overrides) {
@@ -333,7 +322,7 @@ class TestRunner extends import_events.default {
333
322
  }
334
323
  return { config };
335
324
  } catch (e) {
336
- return { config: null, error: (0, import_util2.serializeError)(e) };
325
+ return { config: null, error: (0, import_util.serializeError)(e) };
337
326
  }
338
327
  }
339
328
  async _loadConfigOrReportError(reporter, overrides) {
@@ -346,38 +335,6 @@ class TestRunner extends import_events.default {
346
335
  await reporter.onExit();
347
336
  return null;
348
337
  }
349
- _setInterceptStdio(options) {
350
- if (process.env.PWTEST_DEBUG)
351
- return;
352
- if (options.sendStdioEvents || options.muteConsole) {
353
- if (import_utilsBundle.debug.log === originalDebugLog) {
354
- import_utilsBundle.debug.log = (...args) => {
355
- const string = import_util.default.format(...args) + "\n";
356
- return originalStderrWrite.apply(process.stderr, [string]);
357
- };
358
- }
359
- const stdoutWrite = (chunk) => {
360
- if (options.sendStdioEvents)
361
- this.emit(TestRunnerEvent.StdioChunk, chunk, "stdout");
362
- if (!options.muteConsole)
363
- originalStdoutWrite.apply(process.stdout, [chunk]);
364
- return true;
365
- };
366
- const stderrWrite = (chunk) => {
367
- if (options.sendStdioEvents)
368
- this.emit(TestRunnerEvent.StdioChunk, chunk, "stderr");
369
- if (!options.muteConsole)
370
- originalStderrWrite.apply(process.stderr, [chunk]);
371
- return true;
372
- };
373
- process.stdout.write = stdoutWrite;
374
- process.stderr.write = stderrWrite;
375
- } else {
376
- import_utilsBundle.debug.log = originalDebugLog;
377
- process.stdout.write = originalStdoutWrite;
378
- process.stderr.write = originalStderrWrite;
379
- }
380
- }
381
338
  }
382
339
  function printInternalError(e) {
383
340
  console.error("Internal error:", e);
@@ -33,6 +33,7 @@ __export(testServer_exports, {
33
33
  runUIMode: () => runUIMode
34
34
  });
35
35
  module.exports = __toCommonJS(testServer_exports);
36
+ var import_util = __toESM(require("util"));
36
37
  var import_server = require("playwright-core/lib/server");
37
38
  var import_utils = require("playwright-core/lib/utils");
38
39
  var import_utilsBundle = require("playwright-core/lib/utilsBundle");
@@ -41,6 +42,9 @@ var import_list = __toESM(require("../reporters/list"));
41
42
  var import_reporters = require("./reporters");
42
43
  var import_sigIntWatcher = require("./sigIntWatcher");
43
44
  var import_testRunner = require("./testRunner");
45
+ const originalDebugLog = import_utilsBundle.debug.log;
46
+ const originalStdoutWrite = process.stdout.write;
47
+ const originalStderrWrite = process.stderr.write;
44
48
  class TestServer {
45
49
  constructor(configLocation, configCLIOverrides) {
46
50
  this._configLocation = configLocation;
@@ -70,7 +74,6 @@ class TestServerDispatcher {
70
74
  };
71
75
  this._dispatchEvent = (method, params) => this.transport.sendEvent?.(method, params);
72
76
  this._testRunner.on(import_testRunner.TestRunnerEvent.TestFilesChanged, (testFiles) => this._dispatchEvent("testFilesChanged", { testFiles }));
73
- this._testRunner.on(import_testRunner.TestRunnerEvent.StdioChunk, (chunk, stdio) => this._dispatchEvent("stdio", chunkToPayload(stdio, chunk)));
74
77
  }
75
78
  async _wireReporter(messageSink) {
76
79
  return await (0, import_reporters.createReporterForTestServer)(this._serializer, messageSink);
@@ -86,10 +89,9 @@ class TestServerDispatcher {
86
89
  this._serializer = params.serializer || require.resolve("./uiModeReporter");
87
90
  this._closeOnDisconnect = !!params.closeOnDisconnect;
88
91
  await this._testRunner.initialize({
89
- ...params,
90
- sendStdioEvents: !!params.interceptStdio,
91
- muteConsole: !!params.interceptStdio
92
+ ...params
92
93
  });
94
+ this._setInterceptStdio(!!params.interceptStdio);
93
95
  }
94
96
  async ping() {
95
97
  }
@@ -160,11 +162,38 @@ class TestServerDispatcher {
160
162
  await this._testRunner.stopTests();
161
163
  }
162
164
  async stop() {
165
+ this._setInterceptStdio(false);
163
166
  await this._testRunner.stop();
164
167
  }
165
168
  async closeGracefully() {
166
169
  await this._testRunner.closeGracefully();
167
170
  }
171
+ _setInterceptStdio(interceptStdio) {
172
+ if (process.env.PWTEST_DEBUG)
173
+ return;
174
+ if (interceptStdio) {
175
+ if (import_utilsBundle.debug.log === originalDebugLog) {
176
+ import_utilsBundle.debug.log = (...args) => {
177
+ const string = import_util.default.format(...args) + "\n";
178
+ return originalStderrWrite.apply(process.stderr, [string]);
179
+ };
180
+ }
181
+ const stdoutWrite = (chunk) => {
182
+ this._dispatchEvent("stdio", chunkToPayload("stdout", chunk));
183
+ return true;
184
+ };
185
+ const stderrWrite = (chunk) => {
186
+ this._dispatchEvent("stdio", chunkToPayload("stderr", chunk));
187
+ return true;
188
+ };
189
+ process.stdout.write = stdoutWrite;
190
+ process.stderr.write = stderrWrite;
191
+ } else {
192
+ import_utilsBundle.debug.log = originalDebugLog;
193
+ process.stdout.write = originalStdoutWrite;
194
+ process.stderr.write = originalStderrWrite;
195
+ }
196
+ }
168
197
  }
169
198
  async function runUIMode(configFile, configCLIOverrides, options) {
170
199
  const configLocation = (0, import_configLoader.resolveConfigLocation)(configFile);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright",
3
- "version": "1.56.0-alpha-1756475278000",
3
+ "version": "1.56.0-alpha-2025-08-30",
4
4
  "description": "A high-level API to automate web browsers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,6 +21,7 @@
21
21
  "./package.json": "./package.json",
22
22
  "./lib/common/configLoader": "./lib/common/configLoader.js",
23
23
  "./lib/fsWatcher": "./lib/fsWatcher.js",
24
+ "./lib/mcpBundleImpl": "./lib/mcpBundleImpl.js",
24
25
  "./lib/mcp/sdk/exports": "./lib/mcp/sdk/exports.js",
25
26
  "./lib/program": "./lib/program.js",
26
27
  "./lib/reporters/base": "./lib/reporters/base.js",
@@ -60,7 +61,7 @@
60
61
  },
61
62
  "license": "Apache-2.0",
62
63
  "dependencies": {
63
- "playwright-core": "1.56.0-alpha-1756475278000"
64
+ "playwright-core": "1.56.0-alpha-2025-08-30"
64
65
  },
65
66
  "optionalDependencies": {
66
67
  "fsevents": "2.3.2"
@@ -1,88 +0,0 @@
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 listTests_exports = {};
30
- __export(listTests_exports, {
31
- listTests: () => listTests
32
- });
33
- module.exports = __toCommonJS(listTests_exports);
34
- var import_path = __toESM(require("path"));
35
- var import_bundle = require("../sdk/bundle");
36
- var import_tool = require("./tool.js");
37
- const listTests = (0, import_tool.defineTool)({
38
- schema: {
39
- name: "playwright_test_list_tests",
40
- title: "List tests",
41
- description: "List tests",
42
- inputSchema: import_bundle.z.object({}),
43
- type: "readOnly"
44
- },
45
- handle: async (context, params) => {
46
- const reporter = new ListModeReporter();
47
- const testRunner = await context.createTestRunner();
48
- await testRunner.listTests(reporter, {});
49
- if (reporter.hasErrors())
50
- throw new Error(reporter.content());
51
- return {
52
- content: [{ type: "text", text: reporter.content() }]
53
- };
54
- }
55
- });
56
- class ListModeReporter {
57
- constructor() {
58
- this._lines = [];
59
- this._hasErrors = false;
60
- }
61
- onBegin(config, suite) {
62
- this._lines.push(`Listing tests:`);
63
- const tests = suite.allTests();
64
- const files = /* @__PURE__ */ new Set();
65
- for (const test of tests) {
66
- const [, projectName, , ...titles] = test.titlePath();
67
- const location = `${import_path.default.relative(config.rootDir, test.location.file)}:${test.location.line}:${test.location.column}`;
68
- const projectTitle = projectName ? `[${projectName}] \u203A ` : "";
69
- this._lines.push(` [id=${test.id}] ${projectTitle}${location} \u203A ${titles.join(" \u203A ")}`);
70
- files.add(test.location.file);
71
- }
72
- this._lines.push(`Total: ${tests.length} ${tests.length === 1 ? "test" : "tests"} in ${files.size} ${files.size === 1 ? "file" : "files"}`);
73
- }
74
- onError(error) {
75
- this._hasErrors = true;
76
- this._lines.push(error.stack || error.message || error.value || "");
77
- }
78
- hasErrors() {
79
- return this._hasErrors;
80
- }
81
- content() {
82
- return this._lines.join("\n");
83
- }
84
- }
85
- // Annotate the CommonJS export names for ESM import in node:
86
- 0 && (module.exports = {
87
- listTests
88
- });