@cotestdev/mcp_playwright 0.0.26 → 0.0.28
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.
|
@@ -178,8 +178,12 @@ class Context {
|
|
|
178
178
|
const result = await this._browserContextFactory.createContext(this._clientInfo, this._abortController.signal, this._runningToolName);
|
|
179
179
|
const { browserContext } = result;
|
|
180
180
|
if (!this.config.allowUnrestrictedFileAccess) {
|
|
181
|
-
browserContext._setAllowedProtocols
|
|
182
|
-
|
|
181
|
+
if (typeof browserContext._setAllowedProtocols === "function") {
|
|
182
|
+
browserContext._setAllowedProtocols(["http:", "https:", "about:", "data:"]);
|
|
183
|
+
}
|
|
184
|
+
if (typeof browserContext._setAllowedDirectories === "function") {
|
|
185
|
+
browserContext._setAllowedDirectories(allRootPaths(this._clientInfo));
|
|
186
|
+
}
|
|
183
187
|
}
|
|
184
188
|
await this._setupRequestInterception(browserContext);
|
|
185
189
|
if (this.sessionLog)
|
|
@@ -33,6 +33,7 @@ __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 import_test = require("playwright/test");
|
|
36
37
|
var import_mcpBundle = require("../../../mcpBundleImpl");
|
|
37
38
|
var import_tool = require("./tool");
|
|
38
39
|
var import_common = require("./common");
|
|
@@ -73,7 +74,7 @@ const runCode = (0, import_tool.defineTabTool)({
|
|
|
73
74
|
});
|
|
74
75
|
}
|
|
75
76
|
});
|
|
76
|
-
const scriptSchema =
|
|
77
|
+
const scriptSchema = import_mcpBundle.z.object({
|
|
77
78
|
code: import_mcpBundle.z.string().describe(`A Typescript function containing Playwright code to execute. It will be invoked with a single argument, page, which you can use for any page interaction. For example: \`async (page) => { await page.getByRole('button', { name: 'Submit' }).click(); return await page.title(); }\``),
|
|
78
79
|
params: import_mcpBundle.z.record(import_mcpBundle.z.any()).optional().describe("Parameters to pass to the script.")
|
|
79
80
|
});
|
|
@@ -92,6 +93,7 @@ const runScript = (0, import_tool.defineTabTool)({
|
|
|
92
93
|
const __end__ = new import_utils.ManualPromise();
|
|
93
94
|
const context = {
|
|
94
95
|
page: tab.page,
|
|
96
|
+
expect: import_test.expect,
|
|
95
97
|
__end__
|
|
96
98
|
};
|
|
97
99
|
if (params.params) {
|