@cotestdev/mcp_playwright 0.0.41 → 0.0.43

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.
@@ -76,13 +76,15 @@ const runCode = (0, import_tool.defineTabTool)({
76
76
  });
77
77
  const scriptSchema = import_mcpBundle.z.object({
78
78
  code: import_mcpBundle.z.string().describe(`A JavaScript 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(); }\``),
79
- params: import_mcpBundle.z.record(import_mcpBundle.z.string(), import_mcpBundle.z.any()).optional().describe("Parameters to pass to the script.")
79
+ params: import_mcpBundle.z.record(import_mcpBundle.z.string(), import_mcpBundle.z.any()).optional().describe("Parameters to pass to the script."),
80
+ projectId: import_mcpBundle.z.string().describe("Project ID"),
81
+ testId: import_mcpBundle.z.string().describe("Test ID")
80
82
  });
81
83
  const runScript = (0, import_tool.defineTabTool)({
82
84
  capability: "extra",
83
85
  schema: {
84
- name: "browser_run_script",
85
- title: "Run Playwright script",
86
+ name: "run_test_script",
87
+ title: "Run test script with runner",
86
88
  description: "Run Playwright script",
87
89
  inputSchema: scriptSchema,
88
90
  type: "action"
@@ -90,15 +92,15 @@ const runScript = (0, import_tool.defineTabTool)({
90
92
  handle: async (tab, params, response) => {
91
93
  response.setIncludeSnapshot();
92
94
  const __end__ = new import_utils.ManualPromise();
95
+ const runner = import_ai_runner_fake.Runner.NewInstance(params.projectId, params.testId);
96
+ await runner.init(tab.page, tab.page.content(), params.params);
93
97
  const context = {
94
98
  page: tab.page,
99
+ context: tab.page.context(),
95
100
  expect: import_test.expect,
96
- Runner: import_ai_runner_fake.Runner,
101
+ runner,
97
102
  __end__
98
103
  };
99
- for (const [key, value] of Object.entries(params.params || {})) {
100
- context[key] = value;
101
- }
102
104
  import_vm.default.createContext(context);
103
105
  await tab.waitForCompletion(async () => {
104
106
  const snippet = `(async () => {
@@ -110,9 +112,8 @@ const runScript = (0, import_tool.defineTabTool)({
110
112
  }
111
113
  })()`;
112
114
  await import_vm.default.runInContext(snippet, context);
113
- const result = await __end__;
114
- if (typeof result === "string")
115
- response.addTextResult(result);
115
+ await __end__;
116
+ response.addTextResult(`Out Parameters: ${JSON.stringify(runner.getAll())}`);
116
117
  });
117
118
  }
118
119
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cotestdev/mcp_playwright",
3
- "version": "0.0.41",
3
+ "version": "0.0.43",
4
4
  "description": "Playwright MCP (Model Context Protocol) tools for browser automation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -25,7 +25,6 @@
25
25
  "author": "",
26
26
  "license": "Apache-2.0",
27
27
  "dependencies": {
28
- "@cotestdev/ai-runner-fake": "^0.0.3",
29
28
  "playwright": "^1.40.0",
30
29
  "playwright-core": "^1.40.0"
31
30
  },