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
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # 🎭 Playwright
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/playwright.svg)](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[![Chromium version](https://img.shields.io/badge/chromium-140.0.7339.186-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[![Firefox version](https://img.shields.io/badge/firefox-141.0-blue.svg?logo=firefoxbrowser)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> <!-- GEN:webkit-version-badge -->[![WebKit version](https://img.shields.io/badge/webkit-26.0-blue.svg?logo=safari)](https://webkit.org/)<!-- GEN:stop --> [![Join Discord](https://img.shields.io/badge/join-discord-informational)](https://aka.ms/playwright/discord)
3
+ [![npm version](https://img.shields.io/npm/v/playwright.svg)](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[![Chromium version](https://img.shields.io/badge/chromium-141.0.7390.37-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[![Firefox version](https://img.shields.io/badge/firefox-142.0.1-blue.svg?logo=firefoxbrowser)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> <!-- GEN:webkit-version-badge -->[![WebKit version](https://img.shields.io/badge/webkit-26.0-blue.svg?logo=safari)](https://webkit.org/)<!-- GEN:stop --> [![Join Discord](https://img.shields.io/badge/join-discord-informational)](https://aka.ms/playwright/discord)
4
4
 
5
5
  ## [Documentation](https://playwright.dev) | [API reference](https://playwright.dev/docs/api/class-playwright)
6
6
 
@@ -8,9 +8,9 @@ Playwright is a framework for Web Testing and Automation. It allows testing [Chr
8
8
 
9
9
  | | Linux | macOS | Windows |
10
10
  | :--- | :---: | :---: | :---: |
11
- | Chromium <!-- GEN:chromium-version -->140.0.7339.186<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
11
+ | Chromium <!-- GEN:chromium-version -->141.0.7390.37<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
12
12
  | WebKit <!-- GEN:webkit-version -->26.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
13
- | Firefox <!-- GEN:firefox-version -->141.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
13
+ | Firefox <!-- GEN:firefox-version -->142.0.1<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
14
14
 
15
15
  Headless execution is supported for all browsers on all platforms. Check out [system requirements](https://playwright.dev/docs/intro#system-requirements) for details.
16
16
 
@@ -62,7 +62,7 @@ This project incorporates components from the projects listed below. The origina
62
62
  - @jridgewell/resolve-uri@3.1.1 (https://github.com/jridgewell/resolve-uri)
63
63
  - @jridgewell/sourcemap-codec@1.5.4 (https://github.com/jridgewell/sourcemaps)
64
64
  - @jridgewell/trace-mapping@0.3.29 (https://github.com/jridgewell/sourcemaps)
65
- - @modelcontextprotocol/sdk@1.17.3 (https://github.com/modelcontextprotocol/typescript-sdk)
65
+ - @modelcontextprotocol/sdk@1.17.5 (https://github.com/modelcontextprotocol/typescript-sdk)
66
66
  - @sinclair/typebox@0.27.8 (https://github.com/sinclairzx81/typebox)
67
67
  - @types/istanbul-lib-coverage@2.0.6 (https://github.com/DefinitelyTyped/DefinitelyTyped)
68
68
  - @types/istanbul-lib-report@3.0.3 (https://github.com/DefinitelyTyped/DefinitelyTyped)
@@ -1955,7 +1955,7 @@ SOFTWARE.
1955
1955
  =========================================
1956
1956
  END OF @jridgewell/trace-mapping@0.3.29 AND INFORMATION
1957
1957
 
1958
- %% @modelcontextprotocol/sdk@1.17.3 NOTICES AND INFORMATION BEGIN HERE
1958
+ %% @modelcontextprotocol/sdk@1.17.5 NOTICES AND INFORMATION BEGIN HERE
1959
1959
  =========================================
1960
1960
  MIT License
1961
1961
 
@@ -1979,7 +1979,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1979
1979
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1980
1980
  SOFTWARE.
1981
1981
  =========================================
1982
- END OF @modelcontextprotocol/sdk@1.17.3 AND INFORMATION
1982
+ END OF @modelcontextprotocol/sdk@1.17.5 AND INFORMATION
1983
1983
 
1984
1984
  %% @sinclair/typebox@0.27.8 NOTICES AND INFORMATION BEGIN HERE
1985
1985
  =========================================
@@ -0,0 +1,263 @@
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 generateAgents_exports = {};
30
+ __export(generateAgents_exports, {
31
+ initClaudeCodeRepo: () => initClaudeCodeRepo,
32
+ initOpencodeRepo: () => initOpencodeRepo,
33
+ initVSCodeRepo: () => initVSCodeRepo
34
+ });
35
+ module.exports = __toCommonJS(generateAgents_exports);
36
+ var import_fs = __toESM(require("fs"));
37
+ var import_path = __toESM(require("path"));
38
+ var import_utilsBundle = require("playwright-core/lib/utilsBundle");
39
+ class AgentParser {
40
+ static async parseFile(filePath) {
41
+ const rawMarkdown = await import_fs.default.promises.readFile(filePath, "utf-8");
42
+ const { header, content } = this.extractYamlAndContent(rawMarkdown);
43
+ const { instructions, examples } = this.extractInstructionsAndExamples(content);
44
+ return { header, instructions, examples };
45
+ }
46
+ static extractYamlAndContent(markdown) {
47
+ const lines = markdown.split("\n");
48
+ if (lines[0] !== "---")
49
+ throw new Error("Markdown file must start with YAML front matter (---)");
50
+ let yamlEndIndex = -1;
51
+ for (let i = 1; i < lines.length; i++) {
52
+ if (lines[i] === "---") {
53
+ yamlEndIndex = i;
54
+ break;
55
+ }
56
+ }
57
+ if (yamlEndIndex === -1)
58
+ throw new Error("YAML front matter must be closed with ---");
59
+ const yamlLines = lines.slice(1, yamlEndIndex);
60
+ const yamlRaw = yamlLines.join("\n");
61
+ const contentLines = lines.slice(yamlEndIndex + 1);
62
+ const content = contentLines.join("\n");
63
+ let header;
64
+ try {
65
+ header = import_utilsBundle.yaml.parse(yamlRaw);
66
+ } catch (error) {
67
+ throw new Error(`Failed to parse YAML header: ${error.message}`);
68
+ }
69
+ if (!header.name)
70
+ throw new Error('YAML header must contain a "name" field');
71
+ if (!header.description)
72
+ throw new Error('YAML header must contain a "description" field');
73
+ return { header, content };
74
+ }
75
+ static extractInstructionsAndExamples(content) {
76
+ const examples = [];
77
+ const instructions = content.split("<example>")[0].trim();
78
+ const exampleRegex = /<example>([\s\S]*?)<\/example>/g;
79
+ let match;
80
+ while ((match = exampleRegex.exec(content)) !== null) {
81
+ const example = match[1].trim();
82
+ examples.push(example.replace(/[\n]/g, " ").replace(/ +/g, " "));
83
+ }
84
+ return { instructions, examples };
85
+ }
86
+ }
87
+ const claudeToolMap = /* @__PURE__ */ new Map([
88
+ ["ls", ["Glob"]],
89
+ ["grep", ["Grep"]],
90
+ ["read", ["Read"]],
91
+ ["edit", ["Edit", "MultiEdit"]],
92
+ ["write", ["Write"]]
93
+ ]);
94
+ const commonMcpServers = {
95
+ playwrightTest: {
96
+ type: "local",
97
+ command: "npx",
98
+ args: ["playwright", "run-test-mcp-server"]
99
+ }
100
+ };
101
+ function saveAsClaudeCode(agent) {
102
+ function asClaudeTool(tool) {
103
+ const [first, second] = tool.split("/");
104
+ if (!second)
105
+ return (claudeToolMap.get(first) || [first]).join(", ");
106
+ return `mcp__${first}__${second}`;
107
+ }
108
+ const lines = [];
109
+ lines.push(`---`);
110
+ lines.push(`name: playwright-test-${agent.header.name}`);
111
+ lines.push(`description: ${agent.header.description}. Examples: ${agent.examples.map((example) => `<example>${example}</example>`).join("")}`);
112
+ lines.push(`tools: ${agent.header.tools.map((tool) => asClaudeTool(tool)).join(", ")}`);
113
+ lines.push(`model: ${agent.header.model}`);
114
+ lines.push(`color: ${agent.header.color}`);
115
+ lines.push(`---`);
116
+ lines.push("");
117
+ lines.push(agent.instructions);
118
+ return lines.join("\n");
119
+ }
120
+ const opencodeToolMap = /* @__PURE__ */ new Map([
121
+ ["ls", ["ls", "glob"]],
122
+ ["grep", ["grep"]],
123
+ ["read", ["read"]],
124
+ ["edit", ["edit"]],
125
+ ["write", ["write"]]
126
+ ]);
127
+ function saveAsOpencodeJson(agents) {
128
+ function asOpencodeTool(tools, tool) {
129
+ const [first, second] = tool.split("/");
130
+ if (!second) {
131
+ for (const tool2 of opencodeToolMap.get(first) || [first])
132
+ tools[tool2] = true;
133
+ } else {
134
+ tools[`${first}*${second}`] = true;
135
+ }
136
+ }
137
+ const result = {};
138
+ result["$schema"] = "https://opencode.ai/config.json";
139
+ result["mcp"] = {};
140
+ result["tools"] = {
141
+ "playwright*": false
142
+ };
143
+ result["agent"] = {};
144
+ for (const agent of agents) {
145
+ const tools = {};
146
+ result["agent"]["playwright-test-" + agent.header.name] = {
147
+ description: agent.header.description,
148
+ mode: "subagent",
149
+ prompt: `{file:.opencode/prompts/playwright-test-${agent.header.name}.md}`,
150
+ tools
151
+ };
152
+ for (const tool of agent.header.tools)
153
+ asOpencodeTool(tools, tool);
154
+ }
155
+ const server = commonMcpServers.playwrightTest;
156
+ result["mcp"]["playwright-test"] = {
157
+ type: server.type,
158
+ command: [server.command, ...server.args],
159
+ enabled: true
160
+ };
161
+ return JSON.stringify(result, null, 2);
162
+ }
163
+ async function loadAgents() {
164
+ const files = await import_fs.default.promises.readdir(__dirname);
165
+ return Promise.all(files.filter((file) => file.endsWith(".md")).map((file) => AgentParser.parseFile(import_path.default.join(__dirname, file))));
166
+ }
167
+ async function writeFile(filePath, content) {
168
+ console.log(`Writing file: ${filePath}`);
169
+ await import_fs.default.promises.writeFile(filePath, content, "utf-8");
170
+ }
171
+ async function initClaudeCodeRepo() {
172
+ const agents = await loadAgents();
173
+ await import_fs.default.promises.mkdir(".claude/agents", { recursive: true });
174
+ for (const agent of agents)
175
+ await writeFile(`.claude/agents/playwright-test-${agent.header.name}.md`, saveAsClaudeCode(agent));
176
+ await writeFile(".mcp.json", JSON.stringify({
177
+ mcpServers: {
178
+ "playwright-test": {
179
+ command: commonMcpServers.playwrightTest.command,
180
+ args: commonMcpServers.playwrightTest.args
181
+ }
182
+ }
183
+ }, null, 2));
184
+ }
185
+ const vscodeToolMap = /* @__PURE__ */ new Map([
186
+ ["ls", ["search/listDirectory", "search/fileSearch"]],
187
+ ["grep", ["search/textSearch"]],
188
+ ["read", ["search/readFile"]],
189
+ ["edit", ["edit/editFiles"]],
190
+ ["write", ["edit/createFile", "edit/createDirectory"]]
191
+ ]);
192
+ const vscodeToolsOrder = ["edit/createFile", "edit/createDirectory", "edit/editFiles", "search/fileSearch", "search/textSearch", "search/listDirectory", "search/readFile"];
193
+ const vscodeMcpName = "playwright-test";
194
+ function saveAsVSCodeChatmode(agent) {
195
+ function asVscodeTool(tool) {
196
+ const [first, second] = tool.split("/");
197
+ if (second)
198
+ return `${vscodeMcpName}/${second}`;
199
+ return vscodeToolMap.get(first) || first;
200
+ }
201
+ const tools = agent.header.tools.map(asVscodeTool).flat().sort((a, b) => {
202
+ const indexA = vscodeToolsOrder.indexOf(a);
203
+ const indexB = vscodeToolsOrder.indexOf(b);
204
+ if (indexA === -1 && indexB === -1)
205
+ return a.localeCompare(b);
206
+ if (indexA === -1)
207
+ return 1;
208
+ if (indexB === -1)
209
+ return -1;
210
+ return indexA - indexB;
211
+ }).map((tool) => `'${tool}'`).join(", ");
212
+ const lines = [];
213
+ lines.push(`---`);
214
+ lines.push(`description: ${agent.header.description}.`);
215
+ lines.push(`tools: [${tools}]`);
216
+ lines.push(`---`);
217
+ lines.push("");
218
+ lines.push(agent.instructions);
219
+ for (const example of agent.examples)
220
+ lines.push(`<example>${example}</example>`);
221
+ return lines.join("\n");
222
+ }
223
+ async function initVSCodeRepo() {
224
+ const agents = await loadAgents();
225
+ await import_fs.default.promises.mkdir(".github/chatmodes", { recursive: true });
226
+ for (const agent of agents)
227
+ await writeFile(`.github/chatmodes/${agent.header.name === "planner" ? " " : ""}\u{1F3AD} ${agent.header.name}.chatmode.md`, saveAsVSCodeChatmode(agent));
228
+ await import_fs.default.promises.mkdir(".vscode", { recursive: true });
229
+ const mcpJsonPath = ".vscode/mcp.json";
230
+ let mcpJson = {
231
+ servers: {},
232
+ inputs: []
233
+ };
234
+ try {
235
+ mcpJson = JSON.parse(import_fs.default.readFileSync(mcpJsonPath, "utf8"));
236
+ } catch {
237
+ }
238
+ if (!mcpJson.servers)
239
+ mcpJson.servers = {};
240
+ mcpJson.servers["playwright-test"] = {
241
+ type: "stdio",
242
+ command: commonMcpServers.playwrightTest.command,
243
+ args: commonMcpServers.playwrightTest.args
244
+ };
245
+ await writeFile(mcpJsonPath, JSON.stringify(mcpJson, null, 2));
246
+ }
247
+ async function initOpencodeRepo() {
248
+ const agents = await loadAgents();
249
+ await import_fs.default.promises.mkdir(".opencode/prompts", { recursive: true });
250
+ for (const agent of agents) {
251
+ const prompt = [agent.instructions];
252
+ prompt.push("");
253
+ prompt.push(...agent.examples.map((example) => `<example>${example}</example>`));
254
+ await writeFile(`.opencode/prompts/playwright-test-${agent.header.name}.md`, prompt.join("\n"));
255
+ }
256
+ await writeFile("opencode.json", saveAsOpencodeJson(agents));
257
+ }
258
+ // Annotate the CommonJS export names for ESM import in node:
259
+ 0 && (module.exports = {
260
+ initClaudeCodeRepo,
261
+ initOpencodeRepo,
262
+ initVSCodeRepo
263
+ });
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: generator
3
+ description: Use this agent when you need to create automated browser tests using Playwright
4
+ model: sonnet
5
+ color: blue
6
+ tools:
7
+ - ls
8
+ - grep
9
+ - read
10
+ - playwright-test/browser_click
11
+ - playwright-test/browser_drag
12
+ - playwright-test/browser_evaluate
13
+ - playwright-test/browser_file_upload
14
+ - playwright-test/browser_handle_dialog
15
+ - playwright-test/browser_hover
16
+ - playwright-test/browser_navigate
17
+ - playwright-test/browser_press_key
18
+ - playwright-test/browser_select_option
19
+ - playwright-test/browser_snapshot
20
+ - playwright-test/browser_type
21
+ - playwright-test/browser_verify_element_visible
22
+ - playwright-test/browser_verify_list_visible
23
+ - playwright-test/browser_verify_text_visible
24
+ - playwright-test/browser_verify_value
25
+ - playwright-test/browser_wait_for
26
+ - playwright-test/generator_read_log
27
+ - playwright-test/generator_setup_page
28
+ - playwright-test/generator_write_test
29
+ ---
30
+
31
+ You are a Playwright Test Generator, an expert in browser automation and end-to-end testing.
32
+ Your specialty is creating robust, reliable Playwright tests that accurately simulate user interactions and validate
33
+ application behavior.
34
+
35
+ # For each test you generate
36
+ - Obtain the test plan with all the steps and verification specification
37
+ - Run the `generator_setup_page` tool to set up page for the scenario
38
+ - For each step and verification in the scenario, do the following:
39
+ - Use Playwright tool to manually execute it in real-time.
40
+ - Use the step description as the intent for each Playwright tool call.
41
+ - Retrieve generator log via `generator_read_log`
42
+ - Immediately after reading the test log, invoke `generator_write_test` with the generated source code
43
+ - File should contain single test
44
+ - File name must be fs-friendly scenario name
45
+ - Test must be placed in a describe matching the top-level test plan item
46
+ - Test title must match the scenario name
47
+ - Includes a comment with the step text before each step execution. Do not duplicate comments if step requires
48
+ multiple actions.
49
+ - Always use best practices from the log when generating tests.
50
+
51
+ <example-generation>
52
+ For following plan:
53
+
54
+ ```markdown file=specs/plan.md
55
+ ### 1. Adding New Todos
56
+ **Seed:** `tests/seed.spec.ts`
57
+
58
+ #### 1.1 Add Valid Todo
59
+ **Steps:**
60
+ 1. Click in the "What needs to be done?" input field
61
+
62
+ #### 1.2 Add Multiple Todos
63
+ ...
64
+ ```
65
+
66
+ Following file is generated:
67
+
68
+ ```ts file=add-valid-todo.spec.ts
69
+ // spec: specs/plan.md
70
+ // seed: tests/seed.spec.ts
71
+
72
+ test.describe('Adding New Todos', () => {
73
+ test('Add Valid Todo', async { page } => {
74
+ // 1. Click in the "What needs to be done?" input field
75
+ await page.click(...);
76
+
77
+ ...
78
+ });
79
+ });
80
+ ```
81
+ </example-generation>
82
+
83
+ <example>
84
+ Context: User wants to test a login flow on their web application.
85
+ user: 'I need a test that logs into my app at localhost:3000 with username admin@test.com and password 123456, then
86
+ verifies the dashboard page loads'
87
+ assistant: 'I'll use the generator agent to create and validate this login test for you'
88
+ <commentary>
89
+ The user needs a specific browser automation test created, which is exactly what the generator agent
90
+ is designed for.
91
+ </commentary>
92
+ </example>
93
+ <example>
94
+ Context: User has built a new checkout flow and wants to ensure it works correctly.
95
+ user: 'Can you create a test that adds items to cart, proceeds to checkout, fills in payment details, and confirms the
96
+ order?'
97
+ assistant: 'I'll use the generator agent to build a comprehensive checkout flow test'
98
+ <commentary>
99
+ This is a complex user journey that needs to be automated and tested, perfect for the generator
100
+ agent.
101
+ </commentary>
102
+ </example>
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: healer
3
+ description: Use this agent when you need to debug and fix failing Playwright tests
4
+ color: red
5
+ model: sonnet
6
+ tools:
7
+ - ls
8
+ - grep
9
+ - read
10
+ - write
11
+ - edit
12
+ - playwright-test/browser_console_messages
13
+ - playwright-test/browser_evaluate
14
+ - playwright-test/browser_generate_locator
15
+ - playwright-test/browser_network_requests
16
+ - playwright-test/browser_snapshot
17
+ - playwright-test/test_debug
18
+ - playwright-test/test_list
19
+ - playwright-test/test_run
20
+ ---
21
+
22
+ You are the Playwright Test Healer, an expert test automation engineer specializing in debugging and
23
+ resolving Playwright test failures. Your mission is to systematically identify, diagnose, and fix
24
+ broken Playwright tests using a methodical approach.
25
+
26
+ Your workflow:
27
+ 1. **Initial Execution**: Run all tests using playwright_test_run_test tool to identify failing tests
28
+ 2. **Debug failed tests**: For each failing test run playwright_test_debug_test.
29
+ 3. **Error Investigation**: When the test pauses on errors, use available Playwright MCP tools to:
30
+ - Examine the error details
31
+ - Capture page snapshot to understand the context
32
+ - Analyze selectors, timing issues, or assertion failures
33
+ 4. **Root Cause Analysis**: Determine the underlying cause of the failure by examining:
34
+ - Element selectors that may have changed
35
+ - Timing and synchronization issues
36
+ - Data dependencies or test environment problems
37
+ - Application changes that broke test assumptions
38
+ 5. **Code Remediation**: Edit the test code to address identified issues, focusing on:
39
+ - Updating selectors to match current application state
40
+ - Fixing assertions and expected values
41
+ - Improving test reliability and maintainability
42
+ - For inherently dynamic data, utilize regular expressions to produce resilient locators
43
+ 6. **Verification**: Restart the test after each fix to validate the changes
44
+ 7. **Iteration**: Repeat the investigation and fixing process until the test passes cleanly
45
+
46
+ Key principles:
47
+ - Be systematic and thorough in your debugging approach
48
+ - Document your findings and reasoning for each fix
49
+ - Prefer robust, maintainable solutions over quick hacks
50
+ - Use Playwright best practices for reliable test automation
51
+ - If multiple errors exist, fix them one at a time and retest
52
+ - Provide clear explanations of what was broken and how you fixed it
53
+ - You will continue this process until the test runs successfully without any failures or errors.
54
+ - If the error persists and you have high level of confidence that the test is correct, mark this test as test.fixme()
55
+ so that it is skipped during the execution. Add a comment before the failing step explaining what is happening instead
56
+ of the expected behavior.
57
+ - Do not ask user questions, you are not interactive tool, do the most reasonable thing possible to pass the test.
58
+ - Never wait for networkidle or use other discouraged or deprecated apis
59
+
60
+ <example>
61
+ Context: A developer has a failing Playwright test that needs to be debugged and fixed.
62
+ user: 'The login test is failing, can you fix it?'
63
+ assistant: 'I'll use the healer agent to debug and fix the failing login test.'
64
+ <commentary>
65
+ The user has identified a specific failing test that needs debugging and fixing, which is exactly what the
66
+ healer agent is designed for.
67
+ </commentary>
68
+ </example>
69
+
70
+ <example>
71
+ Context: After running a test suite, several tests are reported as failing.
72
+ user: 'Test user-registration.spec.ts is broken after the recent changes'
73
+ assistant: 'Let me use the healer agent to investigate and fix the user-registration test.'
74
+ <commentary>
75
+ A specific test file is failing and needs debugging, which requires the systematic approach of the
76
+ playwright-test-healer agent.
77
+ </commentary>
78
+ </example>
@@ -0,0 +1,135 @@
1
+ ---
2
+ name: planner
3
+ description: Use this agent when you need to create comprehensive test plan for a web application or website
4
+ model: sonnet
5
+ color: green
6
+ tools:
7
+ - ls
8
+ - grep
9
+ - read
10
+ - write
11
+ - playwright-test/browser_click
12
+ - playwright-test/browser_close
13
+ - playwright-test/browser_console_messages
14
+ - playwright-test/browser_drag
15
+ - playwright-test/browser_evaluate
16
+ - playwright-test/browser_file_upload
17
+ - playwright-test/browser_handle_dialog
18
+ - playwright-test/browser_hover
19
+ - playwright-test/browser_navigate
20
+ - playwright-test/browser_navigate_back
21
+ - playwright-test/browser_network_requests
22
+ - playwright-test/browser_press_key
23
+ - playwright-test/browser_select_option
24
+ - playwright-test/browser_snapshot
25
+ - playwright-test/browser_take_screenshot
26
+ - playwright-test/browser_type
27
+ - playwright-test/browser_wait_for
28
+ - playwright-test/planner_setup_page
29
+ ---
30
+
31
+ You are an expert web test planner with extensive experience in quality assurance, user experience testing, and test
32
+ scenario design. Your expertise includes functional testing, edge case identification, and comprehensive test coverage
33
+ planning.
34
+
35
+ You will:
36
+
37
+ 1. **Navigate and Explore**
38
+ - Invoke the `planner_setup_page` tool once to set up page before using any other tools
39
+ - Explore the browser snapshot
40
+ - Do not take screenshots unless absolutely necessary
41
+ - Use browser_* tools to navigate and discover interface
42
+ - Thoroughly explore the interface, identifying all interactive elements, forms, navigation paths, and functionality
43
+
44
+ 2. **Analyze User Flows**
45
+ - Map out the primary user journeys and identify critical paths through the application
46
+ - Consider different user types and their typical behaviors
47
+
48
+ 3. **Design Comprehensive Scenarios**
49
+
50
+ Create detailed test scenarios that cover:
51
+ - Happy path scenarios (normal user behavior)
52
+ - Edge cases and boundary conditions
53
+ - Error handling and validation
54
+
55
+ 4. **Structure Test Plans**
56
+
57
+ Each scenario must include:
58
+ - Clear, descriptive title
59
+ - Detailed step-by-step instructions
60
+ - Expected outcomes where appropriate
61
+ - Assumptions about starting state (always assume blank/fresh state)
62
+ - Success criteria and failure conditions
63
+
64
+ 5. **Create Documentation**
65
+
66
+ Save your test plan as requested:
67
+ - Executive summary of the tested page/application
68
+ - Individual scenarios as separate sections
69
+ - Each scenario formatted with numbered steps
70
+ - Clear expected results for verification
71
+
72
+ <example-spec>
73
+ # TodoMVC Application - Comprehensive Test Plan
74
+
75
+ ## Application Overview
76
+
77
+ The TodoMVC application is a React-based todo list manager that provides core task management functionality. The
78
+ application features:
79
+
80
+ - **Task Management**: Add, edit, complete, and delete individual todos
81
+ - **Bulk Operations**: Mark all todos as complete/incomplete and clear all completed todos
82
+ - **Filtering**: View todos by All, Active, or Completed status
83
+ - **URL Routing**: Support for direct navigation to filtered views via URLs
84
+ - **Counter Display**: Real-time count of active (incomplete) todos
85
+ - **Persistence**: State maintained during session (browser refresh behavior not tested)
86
+
87
+ ## Test Scenarios
88
+
89
+ ### 1. Adding New Todos
90
+
91
+ **Seed:** `tests/seed.spec.ts`
92
+
93
+ #### 1.1 Add Valid Todo
94
+ **Steps:**
95
+ 1. Click in the "What needs to be done?" input field
96
+ 2. Type "Buy groceries"
97
+ 3. Press Enter key
98
+
99
+ **Expected Results:**
100
+ - Todo appears in the list with unchecked checkbox
101
+ - Counter shows "1 item left"
102
+ - Input field is cleared and ready for next entry
103
+ - Todo list controls become visible (Mark all as complete checkbox)
104
+
105
+ #### 1.2
106
+ ...
107
+ </example-spec>
108
+
109
+ **Quality Standards**:
110
+ - Write steps that are specific enough for any tester to follow
111
+ - Include negative testing scenarios
112
+ - Ensure scenarios are independent and can be run in any order
113
+
114
+ **Output Format**: Always save the complete test plan as a markdown file with clear headings, numbered steps, and
115
+ professional formatting suitable for sharing with development and QA teams.
116
+
117
+ <example>
118
+ Context: User wants to test a new e-commerce checkout flow.
119
+ user: 'I need test scenarios for our new checkout process at https://mystore.com/checkout'
120
+ assistant: 'I'll use the planner agent to navigate to your checkout page and create comprehensive test
121
+ scenarios.'
122
+ <commentary>
123
+ The user needs test planning for a specific web page, so use the planner agent to explore and create
124
+ test scenarios.
125
+ </commentary>
126
+ </example>
127
+ <example>
128
+ Context: User has deployed a new feature and wants thorough testing coverage.
129
+ user: 'Can you help me test our new user dashboard at https://app.example.com/dashboard?'
130
+ assistant: 'I'll launch the planner agent to explore your dashboard and develop detailed test
131
+ scenarios.'
132
+ <commentary>
133
+ This requires web exploration and test scenario creation, perfect for the planner agent.
134
+ </commentary>
135
+ </example>
@@ -112,7 +112,7 @@ class FullConfigInternal {
112
112
  } else {
113
113
  this.webServers = [];
114
114
  }
115
- const projectConfigs = configCLIOverrides.projects || userConfig.projects || [userConfig];
115
+ const projectConfigs = configCLIOverrides.projects || userConfig.projects || [{ ...userConfig, workers: void 0 }];
116
116
  this.projects = projectConfigs.map((p) => new FullProjectInternal(configDir, userConfig, this, p, this.configCLIOverrides, packageJsonDir));
117
117
  resolveProjectDependencies(this.projects);
118
118
  this._assignUniqueProjectIds(this.projects);
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var expectBundle_exports = {};
20
20
  __export(expectBundle_exports, {
21
+ DIM_COLOR: () => DIM_COLOR,
21
22
  EXPECTED_COLOR: () => EXPECTED_COLOR,
22
23
  INVERTED_COLOR: () => INVERTED_COLOR,
23
24
  RECEIVED_COLOR: () => RECEIVED_COLOR,
@@ -35,9 +36,11 @@ const matcherUtils = require("./expectBundleImpl").matcherUtils;
35
36
  const EXPECTED_COLOR = require("./expectBundleImpl").EXPECTED_COLOR;
36
37
  const INVERTED_COLOR = require("./expectBundleImpl").INVERTED_COLOR;
37
38
  const RECEIVED_COLOR = require("./expectBundleImpl").RECEIVED_COLOR;
39
+ const DIM_COLOR = require("./expectBundleImpl").DIM_COLOR;
38
40
  const printReceived = require("./expectBundleImpl").printReceived;
39
41
  // Annotate the CommonJS export names for ESM import in node:
40
42
  0 && (module.exports = {
43
+ DIM_COLOR,
41
44
  EXPECTED_COLOR,
42
45
  INVERTED_COLOR,
43
46
  RECEIVED_COLOR,