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.
Files changed (105) hide show
  1. package/README.md +3 -3
  2. package/ThirdPartyNotices.txt +3 -3
  3. package/lib/agents/generateAgents.js +263 -0
  4. package/lib/agents/generator.md +102 -0
  5. package/lib/agents/healer.md +78 -0
  6. package/lib/agents/planner.md +135 -0
  7. package/lib/common/config.js +1 -1
  8. package/lib/common/expectBundle.js +3 -0
  9. package/lib/common/expectBundleImpl.js +51 -51
  10. package/lib/index.js +7 -8
  11. package/lib/isomorphic/testServerConnection.js +0 -7
  12. package/lib/isomorphic/testTree.js +35 -8
  13. package/lib/matchers/expect.js +8 -21
  14. package/lib/matchers/matcherHint.js +42 -18
  15. package/lib/matchers/matchers.js +12 -6
  16. package/lib/matchers/toBeTruthy.js +16 -14
  17. package/lib/matchers/toEqual.js +18 -13
  18. package/lib/matchers/toHaveURL.js +12 -27
  19. package/lib/matchers/toMatchAriaSnapshot.js +26 -30
  20. package/lib/matchers/toMatchSnapshot.js +15 -12
  21. package/lib/matchers/toMatchText.js +29 -35
  22. package/lib/mcp/browser/actions.d.js +16 -0
  23. package/lib/mcp/browser/browserContextFactory.js +296 -0
  24. package/lib/mcp/browser/browserServerBackend.js +76 -0
  25. package/lib/mcp/browser/codegen.js +66 -0
  26. package/lib/mcp/browser/config.js +383 -0
  27. package/lib/mcp/browser/context.js +284 -0
  28. package/lib/mcp/browser/response.js +228 -0
  29. package/lib/mcp/browser/sessionLog.js +160 -0
  30. package/lib/mcp/browser/tab.js +277 -0
  31. package/lib/mcp/browser/tools/common.js +63 -0
  32. package/lib/mcp/browser/tools/console.js +44 -0
  33. package/lib/mcp/browser/tools/dialogs.js +60 -0
  34. package/lib/mcp/browser/tools/evaluate.js +70 -0
  35. package/lib/mcp/browser/tools/files.js +58 -0
  36. package/lib/mcp/browser/tools/form.js +74 -0
  37. package/lib/mcp/browser/tools/install.js +69 -0
  38. package/lib/mcp/browser/tools/keyboard.js +85 -0
  39. package/lib/mcp/browser/tools/mouse.js +107 -0
  40. package/lib/mcp/browser/tools/navigate.js +62 -0
  41. package/lib/mcp/browser/tools/network.js +54 -0
  42. package/lib/mcp/browser/tools/pdf.js +59 -0
  43. package/lib/mcp/browser/tools/screenshot.js +88 -0
  44. package/lib/mcp/browser/tools/snapshot.js +182 -0
  45. package/lib/mcp/browser/tools/tabs.js +67 -0
  46. package/lib/mcp/browser/tools/tool.js +49 -0
  47. package/lib/mcp/browser/tools/tracing.js +74 -0
  48. package/lib/mcp/browser/tools/utils.js +100 -0
  49. package/lib/mcp/browser/tools/verify.js +154 -0
  50. package/lib/mcp/browser/tools/wait.js +63 -0
  51. package/lib/mcp/browser/tools.js +80 -0
  52. package/lib/mcp/browser/watchdog.js +44 -0
  53. package/lib/mcp/config.d.js +16 -0
  54. package/lib/mcp/extension/cdpRelay.js +351 -0
  55. package/lib/mcp/extension/extensionContextFactory.js +75 -0
  56. package/lib/mcp/extension/protocol.js +28 -0
  57. package/lib/mcp/index.js +61 -0
  58. package/lib/mcp/{tool.js → log.js} +12 -18
  59. package/lib/mcp/program.js +96 -0
  60. package/lib/mcp/{bundle.js → sdk/bundle.js} +24 -2
  61. package/lib/mcp/{exports.js → sdk/exports.js} +12 -10
  62. package/lib/mcp/{transport.js → sdk/http.js} +79 -60
  63. package/lib/mcp/sdk/mdb.js +208 -0
  64. package/lib/mcp/{proxyBackend.js → sdk/proxyBackend.js} +18 -13
  65. package/lib/mcp/sdk/server.js +190 -0
  66. package/lib/mcp/sdk/tool.js +51 -0
  67. package/lib/mcp/test/browserBackend.js +98 -0
  68. package/lib/mcp/test/generatorTools.js +122 -0
  69. package/lib/mcp/test/plannerTools.js +46 -0
  70. package/lib/mcp/test/seed.js +72 -0
  71. package/lib/mcp/test/streams.js +39 -0
  72. package/lib/mcp/test/testBackend.js +97 -0
  73. package/lib/mcp/test/testContext.js +176 -0
  74. package/lib/mcp/test/testTool.js +30 -0
  75. package/lib/mcp/test/testTools.js +115 -0
  76. package/lib/mcpBundleImpl.js +14 -67
  77. package/lib/plugins/webServerPlugin.js +2 -0
  78. package/lib/program.js +68 -0
  79. package/lib/reporters/base.js +15 -17
  80. package/lib/reporters/html.js +39 -26
  81. package/lib/reporters/list.js +8 -4
  82. package/lib/reporters/listModeReporter.js +6 -3
  83. package/lib/reporters/merge.js +3 -1
  84. package/lib/reporters/teleEmitter.js +3 -1
  85. package/lib/runner/dispatcher.js +9 -23
  86. package/lib/runner/failureTracker.js +12 -16
  87. package/lib/runner/loadUtils.js +39 -3
  88. package/lib/runner/projectUtils.js +8 -2
  89. package/lib/runner/tasks.js +18 -7
  90. package/lib/runner/testRunner.js +16 -28
  91. package/lib/runner/testServer.js +17 -23
  92. package/lib/runner/watchMode.js +1 -53
  93. package/lib/runner/workerHost.js +8 -10
  94. package/lib/transform/babelBundleImpl.js +10 -10
  95. package/lib/transform/compilationCache.js +22 -5
  96. package/lib/util.js +12 -16
  97. package/lib/utilsBundleImpl.js +1 -1
  98. package/lib/worker/fixtureRunner.js +15 -7
  99. package/lib/worker/testInfo.js +9 -24
  100. package/lib/worker/workerMain.js +12 -8
  101. package/package.json +7 -3
  102. package/types/test.d.ts +17 -8
  103. package/types/testReporter.d.ts +1 -1
  104. package/lib/mcp/server.js +0 -118
  105. /package/lib/mcp/{inProcessTransport.js → sdk/inProcessTransport.js} +0 -0
@@ -0,0 +1,97 @@
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 testBackend_exports = {};
30
+ __export(testBackend_exports, {
31
+ TestServerBackend: () => TestServerBackend
32
+ });
33
+ module.exports = __toCommonJS(testBackend_exports);
34
+ var mcp = __toESM(require("../sdk/exports"));
35
+ var import_testContext = require("./testContext");
36
+ var testTools = __toESM(require("./testTools.js"));
37
+ var generatorTools = __toESM(require("./generatorTools.js"));
38
+ var plannerTools = __toESM(require("./plannerTools.js"));
39
+ var import_tools = require("../browser/tools");
40
+ var import_configLoader = require("../../common/configLoader");
41
+ var import_response = require("../browser/response");
42
+ class TestServerBackend {
43
+ constructor(configOption, options) {
44
+ this.name = "Playwright";
45
+ this.version = "0.0.1";
46
+ this._tools = [
47
+ plannerTools.setupPage,
48
+ generatorTools.setupPage,
49
+ generatorTools.generatorReadLog,
50
+ generatorTools.generatorWriteTest,
51
+ testTools.listTests,
52
+ testTools.runTests,
53
+ testTools.debugTest
54
+ ];
55
+ this._context = new import_testContext.TestContext(options);
56
+ this._configOption = configOption;
57
+ }
58
+ async initialize(server, clientInfo) {
59
+ const rootPath = mcp.firstRootPath(clientInfo);
60
+ if (this._configOption) {
61
+ this._context.initialize(rootPath, (0, import_configLoader.resolveConfigLocation)(this._configOption));
62
+ return;
63
+ }
64
+ if (rootPath) {
65
+ this._context.initialize(rootPath, (0, import_configLoader.resolveConfigLocation)(rootPath));
66
+ return;
67
+ }
68
+ this._context.initialize(rootPath, (0, import_configLoader.resolveConfigLocation)(void 0));
69
+ }
70
+ async listTools() {
71
+ return [
72
+ ...this._tools.map((tool) => mcp.toMcpTool(tool.schema)),
73
+ ...import_tools.browserTools.map((tool) => mcp.toMcpTool(tool.schema, { addIntent: true }))
74
+ ];
75
+ }
76
+ async afterCallTool(name, args, result) {
77
+ if (!import_tools.browserTools.find((tool) => tool.schema.name === name))
78
+ return;
79
+ const response = (0, import_response.parseResponse)(result);
80
+ if (response && !response.isError && response.code && typeof args?.["intent"] === "string")
81
+ this._context.generatorJournal?.logStep(args["intent"], response.code);
82
+ }
83
+ async callTool(name, args, progress) {
84
+ const tool = this._tools.find((tool2) => tool2.schema.name === name);
85
+ if (!tool)
86
+ throw new Error(`Tool not found: ${name}. Available tools: ${this._tools.map((tool2) => tool2.schema.name).join(", ")}`);
87
+ const parsedArguments = tool.schema.inputSchema.parse(args || {});
88
+ return await tool.handle(this._context, parsedArguments, progress);
89
+ }
90
+ serverClosed() {
91
+ void this._context.close();
92
+ }
93
+ }
94
+ // Annotate the CommonJS export names for ESM import in node:
95
+ 0 && (module.exports = {
96
+ TestServerBackend
97
+ });
@@ -0,0 +1,176 @@
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 testContext_exports = {};
30
+ __export(testContext_exports, {
31
+ GeneratorJournal: () => GeneratorJournal,
32
+ TestContext: () => TestContext
33
+ });
34
+ module.exports = __toCommonJS(testContext_exports);
35
+ var import_fs = __toESM(require("fs"));
36
+ var import_path = __toESM(require("path"));
37
+ var import_utils = require("playwright-core/lib/utils");
38
+ var import_base = require("../../reporters/base");
39
+ var import_list = __toESM(require("../../reporters/list"));
40
+ var import_streams = require("./streams");
41
+ var import_util = require("../../util");
42
+ var import_testRunner = require("../../runner/testRunner");
43
+ var import_seed = require("./seed");
44
+ class GeneratorJournal {
45
+ constructor(rootPath, plan, seed) {
46
+ this._rootPath = rootPath;
47
+ this._plan = plan;
48
+ this._seed = seed;
49
+ this._steps = [];
50
+ }
51
+ logStep(title, code) {
52
+ if (title)
53
+ this._steps.push({ title, code });
54
+ }
55
+ journal() {
56
+ const result = [];
57
+ result.push(`# Plan`);
58
+ result.push(this._plan);
59
+ result.push(`# Seed file: ${import_path.default.relative(this._rootPath, this._seed.file)}`);
60
+ result.push("```ts");
61
+ result.push(this._seed.content);
62
+ result.push("```");
63
+ result.push(`# Steps`);
64
+ result.push(this._steps.map((step) => `### ${step.title}
65
+ \`\`\`ts
66
+ ${step.code}
67
+ \`\`\``).join("\n\n"));
68
+ result.push(bestPracticesMarkdown);
69
+ return result.join("\n\n");
70
+ }
71
+ }
72
+ class TestContext {
73
+ constructor(options) {
74
+ this.options = options;
75
+ }
76
+ initialize(rootPath, configLocation) {
77
+ this.configLocation = configLocation;
78
+ this.rootPath = rootPath || configLocation.configDir;
79
+ }
80
+ existingTestRunner() {
81
+ return this._testRunner;
82
+ }
83
+ async createTestRunner() {
84
+ if (this._testRunner)
85
+ await this._testRunner.stopTests();
86
+ const testRunner = new import_testRunner.TestRunner(this.configLocation, {});
87
+ await testRunner.initialize({});
88
+ this._testRunner = testRunner;
89
+ testRunner.on(import_testRunner.TestRunnerEvent.TestFilesChanged, (testFiles) => {
90
+ this._testRunner?.emit(import_testRunner.TestRunnerEvent.TestFilesChanged, testFiles);
91
+ });
92
+ this._testRunner = testRunner;
93
+ return testRunner;
94
+ }
95
+ async getOrCreateSeedFile(seedFile, projectName) {
96
+ const configDir = this.configLocation.configDir;
97
+ const testRunner = await this.createTestRunner();
98
+ const config = await testRunner.loadConfig();
99
+ const project = (0, import_seed.seedProject)(config, projectName);
100
+ if (!seedFile) {
101
+ seedFile = await (0, import_seed.ensureSeedTest)(project, false);
102
+ } else {
103
+ const candidateFiles = [];
104
+ const testDir = project.project.testDir;
105
+ candidateFiles.push(import_path.default.resolve(testDir, seedFile));
106
+ candidateFiles.push(import_path.default.resolve(configDir, seedFile));
107
+ candidateFiles.push(import_path.default.resolve(this.rootPath, seedFile));
108
+ let resolvedSeedFile;
109
+ for (const candidateFile of candidateFiles) {
110
+ if (await (0, import_util.fileExistsAsync)(candidateFile)) {
111
+ resolvedSeedFile = candidateFile;
112
+ break;
113
+ }
114
+ }
115
+ if (!resolvedSeedFile)
116
+ throw new Error("seed test not found.");
117
+ seedFile = resolvedSeedFile;
118
+ }
119
+ const seedFileContent = await import_fs.default.promises.readFile(seedFile, "utf8");
120
+ return {
121
+ file: seedFile,
122
+ content: seedFileContent,
123
+ projectName: project.project.name
124
+ };
125
+ }
126
+ async runSeedTest(seedFile, projectName, progress) {
127
+ const { screen } = this.createScreen(progress);
128
+ const configDir = this.configLocation.configDir;
129
+ const reporter = new import_list.default({ configDir, screen });
130
+ const testRunner = await this.createTestRunner();
131
+ const result = await testRunner.runTests(reporter, {
132
+ headed: !this.options?.headless,
133
+ locations: ["/" + (0, import_utils.escapeRegExp)(seedFile) + "/"],
134
+ projects: [projectName],
135
+ timeout: 0,
136
+ workers: 1,
137
+ pauseAtEnd: true,
138
+ disableConfigReporters: true,
139
+ failOnLoadErrors: true
140
+ });
141
+ if (result.status === "passed" && !reporter.suite?.allTests().length)
142
+ throw new Error("seed test not found.");
143
+ if (result.status !== "passed")
144
+ throw new Error("Errors while running the seed test.");
145
+ }
146
+ createScreen(progress) {
147
+ const stream = new import_streams.StringWriteStream(progress);
148
+ const screen = {
149
+ ...import_base.terminalScreen,
150
+ isTTY: false,
151
+ colors: import_utils.noColors,
152
+ stdout: stream,
153
+ stderr: stream
154
+ };
155
+ return { screen, stream };
156
+ }
157
+ async close() {
158
+ }
159
+ }
160
+ const bestPracticesMarkdown = `
161
+ # Best practices
162
+ - Do not improvise, do not add directives that were not asked for
163
+ - Use clear, descriptive assertions to validate the expected behavior
164
+ - Use reliable locators from this log
165
+ - Use local variables for locators that are used multiple times
166
+ - Use Playwright waiting assertions and best practices from this log
167
+ - NEVER! use page.waitForLoadState()
168
+ - NEVER! use page.waitForNavigation()
169
+ - NEVER! use page.waitForTimeout()
170
+ - NEVER! use page.evaluate()
171
+ `;
172
+ // Annotate the CommonJS export names for ESM import in node:
173
+ 0 && (module.exports = {
174
+ GeneratorJournal,
175
+ TestContext
176
+ });
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var testTool_exports = {};
20
+ __export(testTool_exports, {
21
+ defineTestTool: () => defineTestTool
22
+ });
23
+ module.exports = __toCommonJS(testTool_exports);
24
+ function defineTestTool(tool) {
25
+ return tool;
26
+ }
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ defineTestTool
30
+ });
@@ -0,0 +1,115 @@
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 testTools_exports = {};
30
+ __export(testTools_exports, {
31
+ debugTest: () => debugTest,
32
+ listTests: () => listTests,
33
+ runTests: () => runTests
34
+ });
35
+ module.exports = __toCommonJS(testTools_exports);
36
+ var import_bundle = require("../sdk/bundle");
37
+ var import_list = __toESM(require("../../reporters/list"));
38
+ var import_listModeReporter = __toESM(require("../../reporters/listModeReporter"));
39
+ var import_testTool = require("./testTool");
40
+ const listTests = (0, import_testTool.defineTestTool)({
41
+ schema: {
42
+ name: "test_list",
43
+ title: "List tests",
44
+ description: "List tests",
45
+ inputSchema: import_bundle.z.object({}),
46
+ type: "readOnly"
47
+ },
48
+ handle: async (context, _, progress) => {
49
+ const { screen } = context.createScreen(progress);
50
+ const reporter = new import_listModeReporter.default({ screen, includeTestId: true });
51
+ const testRunner = await context.createTestRunner();
52
+ await testRunner.listTests(reporter, {});
53
+ return { content: [] };
54
+ }
55
+ });
56
+ const runTests = (0, import_testTool.defineTestTool)({
57
+ schema: {
58
+ name: "test_run",
59
+ title: "Run tests",
60
+ description: "Run tests",
61
+ inputSchema: import_bundle.z.object({
62
+ locations: import_bundle.z.array(import_bundle.z.string()).optional().describe('Folder, file or location to run: "test/e2e" or "test/e2e/file.spec.ts" or "test/e2e/file.spec.ts:20"'),
63
+ projects: import_bundle.z.array(import_bundle.z.string()).optional().describe('Projects to run, projects from playwright.config.ts, by default runs all projects. Running with "chromium" is a good start')
64
+ }),
65
+ type: "readOnly"
66
+ },
67
+ handle: async (context, params, progress) => {
68
+ const { screen } = context.createScreen(progress);
69
+ const configDir = context.configLocation.configDir;
70
+ const reporter = new import_list.default({ configDir, screen, includeTestId: true, prefixStdio: "out" });
71
+ const testRunner = await context.createTestRunner();
72
+ await testRunner.runTests(reporter, {
73
+ locations: params.locations,
74
+ projects: params.projects,
75
+ disableConfigReporters: true
76
+ });
77
+ return { content: [] };
78
+ }
79
+ });
80
+ const debugTest = (0, import_testTool.defineTestTool)({
81
+ schema: {
82
+ name: "test_debug",
83
+ title: "Debug single test",
84
+ description: "Debug single test",
85
+ inputSchema: import_bundle.z.object({
86
+ test: import_bundle.z.object({
87
+ id: import_bundle.z.string().describe("Test ID to debug."),
88
+ title: import_bundle.z.string().describe("Human readable test title for granting permission to debug the test.")
89
+ })
90
+ }),
91
+ type: "readOnly"
92
+ },
93
+ handle: async (context, params, progress) => {
94
+ const { screen } = context.createScreen(progress);
95
+ const configDir = context.configLocation.configDir;
96
+ const reporter = new import_list.default({ configDir, screen, includeTestId: true, prefixStdio: "out" });
97
+ const testRunner = await context.createTestRunner();
98
+ await testRunner.runTests(reporter, {
99
+ headed: !context.options?.headless,
100
+ testIds: [params.test.id],
101
+ // For automatic recovery
102
+ timeout: 0,
103
+ workers: 1,
104
+ pauseOnError: true,
105
+ disableConfigReporters: true
106
+ });
107
+ return { content: [] };
108
+ }
109
+ });
110
+ // Annotate the CommonJS export names for ESM import in node:
111
+ 0 && (module.exports = {
112
+ debugTest,
113
+ listTests,
114
+ runTests
115
+ });