playwright 1.58.0-alpha-2025-12-03 → 1.58.0-alpha-2025-12-04
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/ThirdPartyNotices.txt +288 -2773
- package/lib/agents/agent.js +2 -2
- package/lib/agents/performTask.js +13 -8
- package/lib/index.js +2 -2
- package/lib/mcp/browser/browserServerBackend.js +2 -1
- package/lib/mcp/browser/response.js +129 -53
- package/lib/mcp/browser/tab.js +2 -5
- package/lib/mcp/browser/tools/common.js +5 -5
- package/lib/mcp/browser/tools/console.js +3 -3
- package/lib/mcp/browser/tools/dialogs.js +4 -4
- package/lib/mcp/browser/tools/evaluate.js +5 -5
- package/lib/mcp/browser/tools/files.js +3 -3
- package/lib/mcp/browser/tools/form.js +7 -7
- package/lib/mcp/browser/tools/install.js +2 -2
- package/lib/mcp/browser/tools/keyboard.js +6 -6
- package/lib/mcp/browser/tools/mouse.js +11 -11
- package/lib/mcp/browser/tools/navigate.js +4 -4
- package/lib/mcp/browser/tools/network.js +2 -2
- package/lib/mcp/browser/tools/pdf.js +3 -3
- package/lib/mcp/browser/tools/runCode.js +3 -3
- package/lib/mcp/browser/tools/screenshot.js +7 -7
- package/lib/mcp/browser/tools/snapshot.js +14 -14
- package/lib/mcp/browser/tools/tabs.js +4 -4
- package/lib/mcp/browser/tools/tool.js +8 -7
- package/lib/mcp/browser/tools/tracing.js +3 -3
- package/lib/mcp/browser/tools/verify.js +15 -15
- package/lib/mcp/browser/tools/wait.js +5 -5
- package/lib/mcp/sdk/http.js +1 -1
- package/lib/mcp/sdk/proxyBackend.js +1 -1
- package/lib/mcp/sdk/server.js +1 -1
- package/lib/mcp/sdk/tool.js +2 -2
- package/lib/mcp/test/generatorTools.js +9 -9
- package/lib/mcp/test/plannerTools.js +16 -16
- package/lib/mcp/test/testBackend.js +2 -2
- package/lib/mcp/test/testTools.js +9 -9
- package/package.json +2 -2
- package/types/test.d.ts +1 -3
- package/lib/mcp/sdk/bundle.js +0 -84
- package/lib/mcpBundleImpl.js +0 -96
|
@@ -31,12 +31,12 @@ __export(pdf_exports, {
|
|
|
31
31
|
default: () => pdf_default
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(pdf_exports);
|
|
34
|
-
var
|
|
34
|
+
var import_mcpBundle = require("playwright-core/lib/mcpBundle");
|
|
35
35
|
var import_tool = require("./tool");
|
|
36
36
|
var javascript = __toESM(require("../codegen"));
|
|
37
37
|
var import_utils = require("./utils");
|
|
38
|
-
const pdfSchema =
|
|
39
|
-
filename:
|
|
38
|
+
const pdfSchema = import_mcpBundle.z.object({
|
|
39
|
+
filename: import_mcpBundle.z.string().optional().describe("File name to save the pdf to. Defaults to `page-{timestamp}.pdf` if not specified. Prefer relative file names to stay within the output directory.")
|
|
40
40
|
});
|
|
41
41
|
const pdf = (0, import_tool.defineTabTool)({
|
|
42
42
|
capability: "pdf",
|
|
@@ -33,10 +33,10 @@ __export(runCode_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(runCode_exports);
|
|
34
34
|
var import_vm = __toESM(require("vm"));
|
|
35
35
|
var import_utils = require("playwright-core/lib/utils");
|
|
36
|
-
var
|
|
36
|
+
var import_mcpBundle = require("playwright-core/lib/mcpBundle");
|
|
37
37
|
var import_tool = require("./tool");
|
|
38
|
-
const codeSchema =
|
|
39
|
-
code:
|
|
38
|
+
const codeSchema = import_mcpBundle.z.object({
|
|
39
|
+
code: import_mcpBundle.z.string().describe(`Playwright code snippet to run. The snippet should access the \`page\` object to interact with the page. Can make multiple statements. For example: \`await page.getByRole('button', { name: 'Submit' }).click();\``)
|
|
40
40
|
});
|
|
41
41
|
const runCode = (0, import_tool.defineTabTool)({
|
|
42
42
|
capability: "core",
|
|
@@ -35,16 +35,16 @@ module.exports = __toCommonJS(screenshot_exports);
|
|
|
35
35
|
var import_fs = __toESM(require("fs"));
|
|
36
36
|
var import_utils = require("playwright-core/lib/utils");
|
|
37
37
|
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
|
|
38
|
-
var
|
|
38
|
+
var import_mcpBundle = require("playwright-core/lib/mcpBundle");
|
|
39
39
|
var import_tool = require("./tool");
|
|
40
40
|
var javascript = __toESM(require("../codegen"));
|
|
41
41
|
var import_utils2 = require("./utils");
|
|
42
|
-
const screenshotSchema =
|
|
43
|
-
type:
|
|
44
|
-
filename:
|
|
45
|
-
element:
|
|
46
|
-
ref:
|
|
47
|
-
fullPage:
|
|
42
|
+
const screenshotSchema = import_mcpBundle.z.object({
|
|
43
|
+
type: import_mcpBundle.z.enum(["png", "jpeg"]).default("png").describe("Image format for the screenshot. Default is png."),
|
|
44
|
+
filename: import_mcpBundle.z.string().optional().describe("File name to save the screenshot to. Defaults to `page-{timestamp}.{png|jpeg}` if not specified. Prefer relative file names to stay within the output directory."),
|
|
45
|
+
element: import_mcpBundle.z.string().optional().describe("Human-readable element description used to obtain permission to screenshot the element. If not provided, the screenshot will be taken of viewport. If element is provided, ref must be provided too."),
|
|
46
|
+
ref: import_mcpBundle.z.string().optional().describe("Exact target element reference from the page snapshot. If not provided, the screenshot will be taken of viewport. If ref is provided, element must be provided too."),
|
|
47
|
+
fullPage: import_mcpBundle.z.boolean().optional().describe("When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Cannot be used with element screenshots.")
|
|
48
48
|
});
|
|
49
49
|
const screenshot = (0, import_tool.defineTabTool)({
|
|
50
50
|
capability: "core",
|
|
@@ -32,7 +32,7 @@ __export(snapshot_exports, {
|
|
|
32
32
|
elementSchema: () => elementSchema
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(snapshot_exports);
|
|
35
|
-
var
|
|
35
|
+
var import_mcpBundle = require("playwright-core/lib/mcpBundle");
|
|
36
36
|
var import_tool = require("./tool");
|
|
37
37
|
var javascript = __toESM(require("../codegen"));
|
|
38
38
|
const snapshot = (0, import_tool.defineTool)({
|
|
@@ -41,7 +41,7 @@ const snapshot = (0, import_tool.defineTool)({
|
|
|
41
41
|
name: "browser_snapshot",
|
|
42
42
|
title: "Page snapshot",
|
|
43
43
|
description: "Capture accessibility snapshot of the current page, this is better than screenshot",
|
|
44
|
-
inputSchema:
|
|
44
|
+
inputSchema: import_mcpBundle.z.object({}),
|
|
45
45
|
type: "readOnly"
|
|
46
46
|
},
|
|
47
47
|
handle: async (context, params, response) => {
|
|
@@ -49,14 +49,14 @@ const snapshot = (0, import_tool.defineTool)({
|
|
|
49
49
|
response.setIncludeFullSnapshot();
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
|
-
const elementSchema =
|
|
53
|
-
element:
|
|
54
|
-
ref:
|
|
52
|
+
const elementSchema = import_mcpBundle.z.object({
|
|
53
|
+
element: import_mcpBundle.z.string().describe("Human-readable element description used to obtain permission to interact with the element"),
|
|
54
|
+
ref: import_mcpBundle.z.string().describe("Exact target element reference from the page snapshot")
|
|
55
55
|
});
|
|
56
56
|
const clickSchema = elementSchema.extend({
|
|
57
|
-
doubleClick:
|
|
58
|
-
button:
|
|
59
|
-
modifiers:
|
|
57
|
+
doubleClick: import_mcpBundle.z.boolean().optional().describe("Whether to perform a double click instead of a single click"),
|
|
58
|
+
button: import_mcpBundle.z.enum(["left", "right", "middle"]).optional().describe("Button to click, defaults to left"),
|
|
59
|
+
modifiers: import_mcpBundle.z.array(import_mcpBundle.z.enum(["Alt", "Control", "ControlOrMeta", "Meta", "Shift"])).optional().describe("Modifier keys to press")
|
|
60
60
|
});
|
|
61
61
|
const click = (0, import_tool.defineTabTool)({
|
|
62
62
|
capability: "core",
|
|
@@ -94,11 +94,11 @@ const drag = (0, import_tool.defineTabTool)({
|
|
|
94
94
|
name: "browser_drag",
|
|
95
95
|
title: "Drag mouse",
|
|
96
96
|
description: "Perform drag and drop between two elements",
|
|
97
|
-
inputSchema:
|
|
98
|
-
startElement:
|
|
99
|
-
startRef:
|
|
100
|
-
endElement:
|
|
101
|
-
endRef:
|
|
97
|
+
inputSchema: import_mcpBundle.z.object({
|
|
98
|
+
startElement: import_mcpBundle.z.string().describe("Human-readable source element description used to obtain the permission to interact with the element"),
|
|
99
|
+
startRef: import_mcpBundle.z.string().describe("Exact source element reference from the page snapshot"),
|
|
100
|
+
endElement: import_mcpBundle.z.string().describe("Human-readable target element description used to obtain the permission to interact with the element"),
|
|
101
|
+
endRef: import_mcpBundle.z.string().describe("Exact target element reference from the page snapshot")
|
|
102
102
|
}),
|
|
103
103
|
type: "input"
|
|
104
104
|
},
|
|
@@ -133,7 +133,7 @@ const hover = (0, import_tool.defineTabTool)({
|
|
|
133
133
|
}
|
|
134
134
|
});
|
|
135
135
|
const selectOptionSchema = elementSchema.extend({
|
|
136
|
-
values:
|
|
136
|
+
values: import_mcpBundle.z.array(import_mcpBundle.z.string()).describe("Array of values to select in the dropdown. This can be a single value or multiple values.")
|
|
137
137
|
});
|
|
138
138
|
const selectOption = (0, import_tool.defineTabTool)({
|
|
139
139
|
capability: "core",
|
|
@@ -21,7 +21,7 @@ __export(tabs_exports, {
|
|
|
21
21
|
default: () => tabs_default
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(tabs_exports);
|
|
24
|
-
var
|
|
24
|
+
var import_mcpBundle = require("playwright-core/lib/mcpBundle");
|
|
25
25
|
var import_tool = require("./tool");
|
|
26
26
|
const browserTabs = (0, import_tool.defineTool)({
|
|
27
27
|
capability: "core-tabs",
|
|
@@ -29,9 +29,9 @@ const browserTabs = (0, import_tool.defineTool)({
|
|
|
29
29
|
name: "browser_tabs",
|
|
30
30
|
title: "Manage tabs",
|
|
31
31
|
description: "List, create, close, or select a browser tab.",
|
|
32
|
-
inputSchema:
|
|
33
|
-
action:
|
|
34
|
-
index:
|
|
32
|
+
inputSchema: import_mcpBundle.z.object({
|
|
33
|
+
action: import_mcpBundle.z.enum(["list", "new", "close", "select"]).describe("Operation to perform"),
|
|
34
|
+
index: import_mcpBundle.z.number().optional().describe("Tab index, used for close/select. If omitted for close, current tab is closed.")
|
|
35
35
|
}),
|
|
36
36
|
type: "action"
|
|
37
37
|
},
|
|
@@ -31,14 +31,15 @@ function defineTabTool(tool) {
|
|
|
31
31
|
handle: async (context, params, response) => {
|
|
32
32
|
const tab = await context.ensureTab();
|
|
33
33
|
const modalStates = tab.modalStates().map((state) => state.type);
|
|
34
|
-
if (tool.clearsModalState && !modalStates.includes(tool.clearsModalState))
|
|
35
|
-
response.
|
|
36
|
-
`
|
|
37
|
-
else if (!tool.clearsModalState && modalStates.length)
|
|
38
|
-
response.
|
|
39
|
-
`
|
|
40
|
-
else
|
|
34
|
+
if (tool.clearsModalState && !modalStates.includes(tool.clearsModalState)) {
|
|
35
|
+
response.setIncludeModalStates(tab.modalStates());
|
|
36
|
+
response.addError(`Error: The tool "${tool.schema.name}" can only be used when there is related modal state present.`);
|
|
37
|
+
} else if (!tool.clearsModalState && modalStates.length) {
|
|
38
|
+
response.setIncludeModalStates(tab.modalStates());
|
|
39
|
+
response.addError(`Error: Tool "${tool.schema.name}" does not handle the modal state.`);
|
|
40
|
+
} else {
|
|
41
41
|
return tool.handle(tab, params, response);
|
|
42
|
+
}
|
|
42
43
|
}
|
|
43
44
|
};
|
|
44
45
|
}
|
|
@@ -21,7 +21,7 @@ __export(tracing_exports, {
|
|
|
21
21
|
default: () => tracing_default
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(tracing_exports);
|
|
24
|
-
var
|
|
24
|
+
var import_mcpBundle = require("playwright-core/lib/mcpBundle");
|
|
25
25
|
var import_tool = require("./tool");
|
|
26
26
|
const tracingStart = (0, import_tool.defineTool)({
|
|
27
27
|
capability: "tracing",
|
|
@@ -29,7 +29,7 @@ const tracingStart = (0, import_tool.defineTool)({
|
|
|
29
29
|
name: "browser_start_tracing",
|
|
30
30
|
title: "Start tracing",
|
|
31
31
|
description: "Start trace recording",
|
|
32
|
-
inputSchema:
|
|
32
|
+
inputSchema: import_mcpBundle.z.object({}),
|
|
33
33
|
type: "readOnly"
|
|
34
34
|
},
|
|
35
35
|
handle: async (context, params, response) => {
|
|
@@ -56,7 +56,7 @@ const tracingStop = (0, import_tool.defineTool)({
|
|
|
56
56
|
name: "browser_stop_tracing",
|
|
57
57
|
title: "Stop tracing",
|
|
58
58
|
description: "Stop trace recording",
|
|
59
|
-
inputSchema:
|
|
59
|
+
inputSchema: import_mcpBundle.z.object({}),
|
|
60
60
|
type: "readOnly"
|
|
61
61
|
},
|
|
62
62
|
handle: async (context, params, response) => {
|
|
@@ -31,7 +31,7 @@ __export(verify_exports, {
|
|
|
31
31
|
default: () => verify_default
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(verify_exports);
|
|
34
|
-
var
|
|
34
|
+
var import_mcpBundle = require("playwright-core/lib/mcpBundle");
|
|
35
35
|
var import_tool = require("./tool");
|
|
36
36
|
var javascript = __toESM(require("../codegen"));
|
|
37
37
|
const verifyElement = (0, import_tool.defineTabTool)({
|
|
@@ -40,9 +40,9 @@ const verifyElement = (0, import_tool.defineTabTool)({
|
|
|
40
40
|
name: "browser_verify_element_visible",
|
|
41
41
|
title: "Verify element visible",
|
|
42
42
|
description: "Verify element is visible on the page",
|
|
43
|
-
inputSchema:
|
|
44
|
-
role:
|
|
45
|
-
accessibleName:
|
|
43
|
+
inputSchema: import_mcpBundle.z.object({
|
|
44
|
+
role: import_mcpBundle.z.string().describe('ROLE of the element. Can be found in the snapshot like this: `- {ROLE} "Accessible Name":`'),
|
|
45
|
+
accessibleName: import_mcpBundle.z.string().describe('ACCESSIBLE_NAME of the element. Can be found in the snapshot like this: `- role "{ACCESSIBLE_NAME}"`')
|
|
46
46
|
}),
|
|
47
47
|
type: "assertion"
|
|
48
48
|
},
|
|
@@ -62,8 +62,8 @@ const verifyText = (0, import_tool.defineTabTool)({
|
|
|
62
62
|
name: "browser_verify_text_visible",
|
|
63
63
|
title: "Verify text visible",
|
|
64
64
|
description: `Verify text is visible on the page. Prefer ${verifyElement.schema.name} if possible.`,
|
|
65
|
-
inputSchema:
|
|
66
|
-
text:
|
|
65
|
+
inputSchema: import_mcpBundle.z.object({
|
|
66
|
+
text: import_mcpBundle.z.string().describe('TEXT to verify. Can be found in the snapshot like this: `- role "Accessible Name": {TEXT}` or like this: `- text: {TEXT}`')
|
|
67
67
|
}),
|
|
68
68
|
type: "assertion"
|
|
69
69
|
},
|
|
@@ -83,10 +83,10 @@ const verifyList = (0, import_tool.defineTabTool)({
|
|
|
83
83
|
name: "browser_verify_list_visible",
|
|
84
84
|
title: "Verify list visible",
|
|
85
85
|
description: "Verify list is visible on the page",
|
|
86
|
-
inputSchema:
|
|
87
|
-
element:
|
|
88
|
-
ref:
|
|
89
|
-
items:
|
|
86
|
+
inputSchema: import_mcpBundle.z.object({
|
|
87
|
+
element: import_mcpBundle.z.string().describe("Human-readable list description"),
|
|
88
|
+
ref: import_mcpBundle.z.string().describe("Exact target element reference that points to the list"),
|
|
89
|
+
items: import_mcpBundle.z.array(import_mcpBundle.z.string()).describe("Items to verify")
|
|
90
90
|
}),
|
|
91
91
|
type: "assertion"
|
|
92
92
|
},
|
|
@@ -115,11 +115,11 @@ const verifyValue = (0, import_tool.defineTabTool)({
|
|
|
115
115
|
name: "browser_verify_value",
|
|
116
116
|
title: "Verify value",
|
|
117
117
|
description: "Verify element value",
|
|
118
|
-
inputSchema:
|
|
119
|
-
type:
|
|
120
|
-
element:
|
|
121
|
-
ref:
|
|
122
|
-
value:
|
|
118
|
+
inputSchema: import_mcpBundle.z.object({
|
|
119
|
+
type: import_mcpBundle.z.enum(["textbox", "checkbox", "radio", "combobox", "slider"]).describe("Type of the element"),
|
|
120
|
+
element: import_mcpBundle.z.string().describe("Human-readable element description"),
|
|
121
|
+
ref: import_mcpBundle.z.string().describe("Exact target element reference that points to the element"),
|
|
122
|
+
value: import_mcpBundle.z.string().describe('Value to verify. For checkbox, use "true" or "false".')
|
|
123
123
|
}),
|
|
124
124
|
type: "assertion"
|
|
125
125
|
},
|
|
@@ -21,7 +21,7 @@ __export(wait_exports, {
|
|
|
21
21
|
default: () => wait_default
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(wait_exports);
|
|
24
|
-
var
|
|
24
|
+
var import_mcpBundle = require("playwright-core/lib/mcpBundle");
|
|
25
25
|
var import_tool = require("./tool");
|
|
26
26
|
const wait = (0, import_tool.defineTool)({
|
|
27
27
|
capability: "core",
|
|
@@ -29,10 +29,10 @@ const wait = (0, import_tool.defineTool)({
|
|
|
29
29
|
name: "browser_wait_for",
|
|
30
30
|
title: "Wait for",
|
|
31
31
|
description: "Wait for text to appear or disappear or a specified time to pass",
|
|
32
|
-
inputSchema:
|
|
33
|
-
time:
|
|
34
|
-
text:
|
|
35
|
-
textGone:
|
|
32
|
+
inputSchema: import_mcpBundle.z.object({
|
|
33
|
+
time: import_mcpBundle.z.number().optional().describe("The time to wait in seconds"),
|
|
34
|
+
text: import_mcpBundle.z.string().optional().describe("The text to wait for"),
|
|
35
|
+
textGone: import_mcpBundle.z.string().optional().describe("The text to wait for to disappear")
|
|
36
36
|
}),
|
|
37
37
|
type: "assertion"
|
|
38
38
|
},
|
package/lib/mcp/sdk/http.js
CHANGED
|
@@ -37,7 +37,7 @@ var import_assert = __toESM(require("assert"));
|
|
|
37
37
|
var import_http = __toESM(require("http"));
|
|
38
38
|
var import_crypto = __toESM(require("crypto"));
|
|
39
39
|
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
|
|
40
|
-
var mcpBundle = __toESM(require("
|
|
40
|
+
var mcpBundle = __toESM(require("playwright-core/lib/mcpBundle"));
|
|
41
41
|
var mcpServer = __toESM(require("./server"));
|
|
42
42
|
const testDebug = (0, import_utilsBundle.debug)("pw:mcp:test");
|
|
43
43
|
async function startHttpServer(config, abortSignal) {
|
|
@@ -32,7 +32,7 @@ __export(proxyBackend_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(proxyBackend_exports);
|
|
34
34
|
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
|
|
35
|
-
var mcpBundle = __toESM(require("
|
|
35
|
+
var mcpBundle = __toESM(require("playwright-core/lib/mcpBundle"));
|
|
36
36
|
const errorsDebug = (0, import_utilsBundle.debug)("pw:mcp:errors");
|
|
37
37
|
const { z, zodToJsonSchema } = mcpBundle;
|
|
38
38
|
class ProxyBackend {
|
package/lib/mcp/sdk/server.js
CHANGED
|
@@ -38,7 +38,7 @@ __export(server_exports, {
|
|
|
38
38
|
module.exports = __toCommonJS(server_exports);
|
|
39
39
|
var import_url = require("url");
|
|
40
40
|
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
|
|
41
|
-
var mcpBundle = __toESM(require("
|
|
41
|
+
var mcpBundle = __toESM(require("playwright-core/lib/mcpBundle"));
|
|
42
42
|
var import_http = require("./http");
|
|
43
43
|
var import_inProcessTransport = require("./inProcessTransport");
|
|
44
44
|
const serverDebug = (0, import_utilsBundle.debug)("pw:mcp:server");
|
package/lib/mcp/sdk/tool.js
CHANGED
|
@@ -22,13 +22,13 @@ __export(tool_exports, {
|
|
|
22
22
|
toMcpTool: () => toMcpTool
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(tool_exports);
|
|
25
|
-
var
|
|
25
|
+
var import_mcpBundle = require("playwright-core/lib/mcpBundle");
|
|
26
26
|
function toMcpTool(tool) {
|
|
27
27
|
const readOnly = tool.type === "readOnly" || tool.type === "assertion";
|
|
28
28
|
return {
|
|
29
29
|
name: tool.name,
|
|
30
30
|
description: tool.description,
|
|
31
|
-
inputSchema: (0,
|
|
31
|
+
inputSchema: (0, import_mcpBundle.zodToJsonSchema)(tool.inputSchema, { strictUnions: true }),
|
|
32
32
|
annotations: {
|
|
33
33
|
title: tool.title,
|
|
34
34
|
readOnlyHint: readOnly,
|
|
@@ -35,7 +35,7 @@ __export(generatorTools_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(generatorTools_exports);
|
|
36
36
|
var import_fs = __toESM(require("fs"));
|
|
37
37
|
var import_path = __toESM(require("path"));
|
|
38
|
-
var
|
|
38
|
+
var import_mcpBundle = require("playwright-core/lib/mcpBundle");
|
|
39
39
|
var import_testTool = require("./testTool");
|
|
40
40
|
var import_testContext = require("./testContext");
|
|
41
41
|
const setupPage = (0, import_testTool.defineTestTool)({
|
|
@@ -43,10 +43,10 @@ const setupPage = (0, import_testTool.defineTestTool)({
|
|
|
43
43
|
name: "generator_setup_page",
|
|
44
44
|
title: "Setup generator page",
|
|
45
45
|
description: "Setup the page for test.",
|
|
46
|
-
inputSchema:
|
|
47
|
-
plan:
|
|
48
|
-
project:
|
|
49
|
-
seedFile:
|
|
46
|
+
inputSchema: import_mcpBundle.z.object({
|
|
47
|
+
plan: import_mcpBundle.z.string().describe("The plan for the test. This should be the actual test plan with all the steps."),
|
|
48
|
+
project: import_mcpBundle.z.string().optional().describe('Project to use for setup. For example: "chromium", if no project is provided uses the first project in the config.'),
|
|
49
|
+
seedFile: import_mcpBundle.z.string().optional().describe('A seed file contains a single test that is used to setup the page for testing, for example: "tests/seed.spec.ts". If no seed file is provided, a default seed file is created.')
|
|
50
50
|
}),
|
|
51
51
|
type: "readOnly"
|
|
52
52
|
},
|
|
@@ -62,7 +62,7 @@ const generatorReadLog = (0, import_testTool.defineTestTool)({
|
|
|
62
62
|
name: "generator_read_log",
|
|
63
63
|
title: "Retrieve test log",
|
|
64
64
|
description: "Retrieve the performed test log",
|
|
65
|
-
inputSchema:
|
|
65
|
+
inputSchema: import_mcpBundle.z.object({}),
|
|
66
66
|
type: "readOnly"
|
|
67
67
|
},
|
|
68
68
|
handle: async (context) => {
|
|
@@ -80,9 +80,9 @@ const generatorWriteTest = (0, import_testTool.defineTestTool)({
|
|
|
80
80
|
name: "generator_write_test",
|
|
81
81
|
title: "Write test",
|
|
82
82
|
description: "Write the generated test to the test file",
|
|
83
|
-
inputSchema:
|
|
84
|
-
fileName:
|
|
85
|
-
code:
|
|
83
|
+
inputSchema: import_mcpBundle.z.object({
|
|
84
|
+
fileName: import_mcpBundle.z.string().describe("The file to write the test to"),
|
|
85
|
+
code: import_mcpBundle.z.string().describe("The generated test code")
|
|
86
86
|
}),
|
|
87
87
|
type: "readOnly"
|
|
88
88
|
},
|
|
@@ -35,16 +35,16 @@ __export(plannerTools_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(plannerTools_exports);
|
|
36
36
|
var import_fs = __toESM(require("fs"));
|
|
37
37
|
var import_path = __toESM(require("path"));
|
|
38
|
-
var
|
|
38
|
+
var import_mcpBundle = require("playwright-core/lib/mcpBundle");
|
|
39
39
|
var import_testTool = require("./testTool");
|
|
40
40
|
const setupPage = (0, import_testTool.defineTestTool)({
|
|
41
41
|
schema: {
|
|
42
42
|
name: "planner_setup_page",
|
|
43
43
|
title: "Setup planner page",
|
|
44
44
|
description: "Setup the page for test planning",
|
|
45
|
-
inputSchema:
|
|
46
|
-
project:
|
|
47
|
-
seedFile:
|
|
45
|
+
inputSchema: import_mcpBundle.z.object({
|
|
46
|
+
project: import_mcpBundle.z.string().optional().describe('Project to use for setup. For example: "chromium", if no project is provided uses the first project in the config.'),
|
|
47
|
+
seedFile: import_mcpBundle.z.string().optional().describe('A seed file contains a single test that is used to setup the page for testing, for example: "tests/seed.spec.ts". If no seed file is provided, a default seed file is created.')
|
|
48
48
|
}),
|
|
49
49
|
type: "readOnly"
|
|
50
50
|
},
|
|
@@ -54,16 +54,16 @@ const setupPage = (0, import_testTool.defineTestTool)({
|
|
|
54
54
|
return { content: [{ type: "text", text: output }], isError: status !== "paused" };
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
|
-
const planSchema =
|
|
58
|
-
overview:
|
|
59
|
-
suites:
|
|
60
|
-
name:
|
|
61
|
-
seedFile:
|
|
62
|
-
tests:
|
|
63
|
-
name:
|
|
64
|
-
file:
|
|
65
|
-
steps:
|
|
66
|
-
expectedResults:
|
|
57
|
+
const planSchema = import_mcpBundle.z.object({
|
|
58
|
+
overview: import_mcpBundle.z.string().describe("A brief overview of the application to be tested"),
|
|
59
|
+
suites: import_mcpBundle.z.array(import_mcpBundle.z.object({
|
|
60
|
+
name: import_mcpBundle.z.string().describe("The name of the suite"),
|
|
61
|
+
seedFile: import_mcpBundle.z.string().describe("A seed file that was used to setup the page for testing."),
|
|
62
|
+
tests: import_mcpBundle.z.array(import_mcpBundle.z.object({
|
|
63
|
+
name: import_mcpBundle.z.string().describe("The name of the test"),
|
|
64
|
+
file: import_mcpBundle.z.string().describe('The file the test should be saved to, for example: "tests/<suite-name>/<test-name>.spec.ts".'),
|
|
65
|
+
steps: import_mcpBundle.z.array(import_mcpBundle.z.string().describe(`The steps to be executed to perform the test. For example: 'Click on the "Submit" button'`)),
|
|
66
|
+
expectedResults: import_mcpBundle.z.array(import_mcpBundle.z.string().describe("The expected results of the steps for test to verify."))
|
|
67
67
|
}))
|
|
68
68
|
}))
|
|
69
69
|
});
|
|
@@ -90,8 +90,8 @@ const saveTestPlan = (0, import_testTool.defineTestTool)({
|
|
|
90
90
|
title: "Save test plan as markdown file",
|
|
91
91
|
description: "Save the test plan as a markdown file",
|
|
92
92
|
inputSchema: planSchema.extend({
|
|
93
|
-
name:
|
|
94
|
-
fileName:
|
|
93
|
+
name: import_mcpBundle.z.string().describe('The name of the test plan, for example: "Test Plan".'),
|
|
94
|
+
fileName: import_mcpBundle.z.string().describe('The file to save the test plan to, for example: "spec/test.plan.md". Relative to the workspace root.')
|
|
95
95
|
}),
|
|
96
96
|
type: "readOnly"
|
|
97
97
|
},
|
|
@@ -31,13 +31,13 @@ __export(testBackend_exports, {
|
|
|
31
31
|
TestServerBackend: () => TestServerBackend
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(testBackend_exports);
|
|
34
|
+
var import_mcpBundle = require("playwright-core/lib/mcpBundle");
|
|
34
35
|
var mcp = __toESM(require("../sdk/exports"));
|
|
35
36
|
var import_testContext = require("./testContext");
|
|
36
37
|
var testTools = __toESM(require("./testTools.js"));
|
|
37
38
|
var generatorTools = __toESM(require("./generatorTools.js"));
|
|
38
39
|
var plannerTools = __toESM(require("./plannerTools.js"));
|
|
39
40
|
var import_tools = require("../browser/tools");
|
|
40
|
-
var import_bundle = require("../sdk/bundle");
|
|
41
41
|
class TestServerBackend {
|
|
42
42
|
constructor(configPath, options) {
|
|
43
43
|
this.name = "Playwright";
|
|
@@ -80,7 +80,7 @@ class TestServerBackend {
|
|
|
80
80
|
const typesWithIntent = ["action", "assertion", "input"];
|
|
81
81
|
function wrapBrowserTool(tool) {
|
|
82
82
|
const inputSchema = typesWithIntent.includes(tool.schema.type) ? tool.schema.inputSchema.extend({
|
|
83
|
-
intent:
|
|
83
|
+
intent: import_mcpBundle.z.string().describe("The intent of the call, for example the test step description plan idea")
|
|
84
84
|
}) : tool.schema.inputSchema;
|
|
85
85
|
return {
|
|
86
86
|
schema: {
|
|
@@ -33,7 +33,7 @@ __export(testTools_exports, {
|
|
|
33
33
|
runTests: () => runTests
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(testTools_exports);
|
|
36
|
-
var
|
|
36
|
+
var import_mcpBundle = require("playwright-core/lib/mcpBundle");
|
|
37
37
|
var import_listModeReporter = __toESM(require("../../reporters/listModeReporter"));
|
|
38
38
|
var import_testTool = require("./testTool");
|
|
39
39
|
const listTests = (0, import_testTool.defineTestTool)({
|
|
@@ -41,7 +41,7 @@ const listTests = (0, import_testTool.defineTestTool)({
|
|
|
41
41
|
name: "test_list",
|
|
42
42
|
title: "List tests",
|
|
43
43
|
description: "List tests",
|
|
44
|
-
inputSchema:
|
|
44
|
+
inputSchema: import_mcpBundle.z.object({}),
|
|
45
45
|
type: "readOnly"
|
|
46
46
|
},
|
|
47
47
|
handle: async (context) => {
|
|
@@ -56,9 +56,9 @@ const runTests = (0, import_testTool.defineTestTool)({
|
|
|
56
56
|
name: "test_run",
|
|
57
57
|
title: "Run tests",
|
|
58
58
|
description: "Run tests",
|
|
59
|
-
inputSchema:
|
|
60
|
-
locations:
|
|
61
|
-
projects:
|
|
59
|
+
inputSchema: import_mcpBundle.z.object({
|
|
60
|
+
locations: import_mcpBundle.z.array(import_mcpBundle.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"'),
|
|
61
|
+
projects: import_mcpBundle.z.array(import_mcpBundle.z.string()).optional().describe('Projects to run, projects from playwright.config.ts, by default runs all projects. Running with "chromium" is a good start')
|
|
62
62
|
}),
|
|
63
63
|
type: "readOnly"
|
|
64
64
|
},
|
|
@@ -76,10 +76,10 @@ const debugTest = (0, import_testTool.defineTestTool)({
|
|
|
76
76
|
name: "test_debug",
|
|
77
77
|
title: "Debug single test",
|
|
78
78
|
description: "Debug single test",
|
|
79
|
-
inputSchema:
|
|
80
|
-
test:
|
|
81
|
-
id:
|
|
82
|
-
title:
|
|
79
|
+
inputSchema: import_mcpBundle.z.object({
|
|
80
|
+
test: import_mcpBundle.z.object({
|
|
81
|
+
id: import_mcpBundle.z.string().describe("Test ID to debug."),
|
|
82
|
+
title: import_mcpBundle.z.string().describe("Human readable test title for granting permission to debug the test.")
|
|
83
83
|
})
|
|
84
84
|
}),
|
|
85
85
|
type: "readOnly"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "playwright",
|
|
3
|
-
"version": "1.58.0-alpha-2025-12-
|
|
3
|
+
"version": "1.58.0-alpha-2025-12-04",
|
|
4
4
|
"description": "A high-level API to automate web browsers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"license": "Apache-2.0",
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"playwright-core": "1.58.0-alpha-2025-12-
|
|
67
|
+
"playwright-core": "1.58.0-alpha-2025-12-04"
|
|
68
68
|
},
|
|
69
69
|
"optionalDependencies": {
|
|
70
70
|
"fsevents": "2.3.2"
|
package/types/test.d.ts
CHANGED
|
@@ -6747,9 +6747,7 @@ export interface PlaywrightWorkerOptions {
|
|
|
6747
6747
|
/**
|
|
6748
6748
|
* Whether to run browser in headless mode. More details for
|
|
6749
6749
|
* [Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and
|
|
6750
|
-
* [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true
|
|
6751
|
-
* [`devtools`](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-devtools) option is
|
|
6752
|
-
* `true`.
|
|
6750
|
+
* [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true`.
|
|
6753
6751
|
*
|
|
6754
6752
|
* **Usage**
|
|
6755
6753
|
*
|
package/lib/mcp/sdk/bundle.js
DELETED
|
@@ -1,84 +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 bundle_exports = {};
|
|
30
|
-
__export(bundle_exports, {
|
|
31
|
-
CallToolRequestSchema: () => CallToolRequestSchema,
|
|
32
|
-
Client: () => Client,
|
|
33
|
-
ListRootsRequestSchema: () => ListRootsRequestSchema,
|
|
34
|
-
ListToolsRequestSchema: () => ListToolsRequestSchema,
|
|
35
|
-
Loop: () => Loop,
|
|
36
|
-
PingRequestSchema: () => PingRequestSchema,
|
|
37
|
-
ProgressNotificationSchema: () => ProgressNotificationSchema,
|
|
38
|
-
SSEClientTransport: () => SSEClientTransport,
|
|
39
|
-
SSEServerTransport: () => SSEServerTransport,
|
|
40
|
-
Server: () => Server,
|
|
41
|
-
StdioClientTransport: () => StdioClientTransport,
|
|
42
|
-
StdioServerTransport: () => StdioServerTransport,
|
|
43
|
-
StreamableHTTPClientTransport: () => StreamableHTTPClientTransport,
|
|
44
|
-
StreamableHTTPServerTransport: () => StreamableHTTPServerTransport,
|
|
45
|
-
z: () => z,
|
|
46
|
-
zodToJsonSchema: () => zodToJsonSchema
|
|
47
|
-
});
|
|
48
|
-
module.exports = __toCommonJS(bundle_exports);
|
|
49
|
-
var bundle = __toESM(require("../../mcpBundleImpl"));
|
|
50
|
-
const zodToJsonSchema = bundle.zodToJsonSchema;
|
|
51
|
-
const Client = bundle.Client;
|
|
52
|
-
const Server = bundle.Server;
|
|
53
|
-
const SSEClientTransport = bundle.SSEClientTransport;
|
|
54
|
-
const SSEServerTransport = bundle.SSEServerTransport;
|
|
55
|
-
const StdioClientTransport = bundle.StdioClientTransport;
|
|
56
|
-
const StdioServerTransport = bundle.StdioServerTransport;
|
|
57
|
-
const StreamableHTTPServerTransport = bundle.StreamableHTTPServerTransport;
|
|
58
|
-
const StreamableHTTPClientTransport = bundle.StreamableHTTPClientTransport;
|
|
59
|
-
const CallToolRequestSchema = bundle.CallToolRequestSchema;
|
|
60
|
-
const ListRootsRequestSchema = bundle.ListRootsRequestSchema;
|
|
61
|
-
const ProgressNotificationSchema = bundle.ProgressNotificationSchema;
|
|
62
|
-
const ListToolsRequestSchema = bundle.ListToolsRequestSchema;
|
|
63
|
-
const PingRequestSchema = bundle.PingRequestSchema;
|
|
64
|
-
const Loop = bundle.Loop;
|
|
65
|
-
const z = bundle.z;
|
|
66
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
-
0 && (module.exports = {
|
|
68
|
-
CallToolRequestSchema,
|
|
69
|
-
Client,
|
|
70
|
-
ListRootsRequestSchema,
|
|
71
|
-
ListToolsRequestSchema,
|
|
72
|
-
Loop,
|
|
73
|
-
PingRequestSchema,
|
|
74
|
-
ProgressNotificationSchema,
|
|
75
|
-
SSEClientTransport,
|
|
76
|
-
SSEServerTransport,
|
|
77
|
-
Server,
|
|
78
|
-
StdioClientTransport,
|
|
79
|
-
StdioServerTransport,
|
|
80
|
-
StreamableHTTPClientTransport,
|
|
81
|
-
StreamableHTTPServerTransport,
|
|
82
|
-
z,
|
|
83
|
-
zodToJsonSchema
|
|
84
|
-
});
|