@cotestdev/mcp_playwright 0.0.56 → 0.0.58

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.
@@ -0,0 +1,298 @@
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 testType_exports = {};
20
+ __export(testType_exports, {
21
+ TestTypeImpl: () => TestTypeImpl,
22
+ mergeTests: () => mergeTests,
23
+ rootTestType: () => rootTestType
24
+ });
25
+ module.exports = __toCommonJS(testType_exports);
26
+ var import_playwright_core = require("playwright-core");
27
+ var import_utils = require("playwright-core/lib/utils");
28
+ var import_globals = require("./globals");
29
+ var import_test = require("./test");
30
+ var import_expect = require("../matchers/expect");
31
+ var import_transform = require("../transform/transform");
32
+ var import_validators = require("./validators");
33
+ const testTypeSymbol = Symbol("testType");
34
+ class TestTypeImpl {
35
+ constructor(fixtures) {
36
+ this.fixtures = fixtures;
37
+ const test = (0, import_transform.wrapFunctionWithLocation)(this._createTest.bind(this, "default"));
38
+ test[testTypeSymbol] = this;
39
+ test.expect = import_expect.expect;
40
+ test.only = (0, import_transform.wrapFunctionWithLocation)(this._createTest.bind(this, "only"));
41
+ test.describe = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "default"));
42
+ test.describe.only = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "only"));
43
+ test.describe.configure = (0, import_transform.wrapFunctionWithLocation)(this._configure.bind(this));
44
+ test.describe.fixme = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "fixme"));
45
+ test.describe.parallel = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "parallel"));
46
+ test.describe.parallel.only = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "parallel.only"));
47
+ test.describe.serial = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "serial"));
48
+ test.describe.serial.only = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "serial.only"));
49
+ test.describe.skip = (0, import_transform.wrapFunctionWithLocation)(this._describe.bind(this, "skip"));
50
+ test.beforeEach = (0, import_transform.wrapFunctionWithLocation)(this._hook.bind(this, "beforeEach"));
51
+ test.afterEach = (0, import_transform.wrapFunctionWithLocation)(this._hook.bind(this, "afterEach"));
52
+ test.beforeAll = (0, import_transform.wrapFunctionWithLocation)(this._hook.bind(this, "beforeAll"));
53
+ test.afterAll = (0, import_transform.wrapFunctionWithLocation)(this._hook.bind(this, "afterAll"));
54
+ test.skip = (0, import_transform.wrapFunctionWithLocation)(this._modifier.bind(this, "skip"));
55
+ test.fixme = (0, import_transform.wrapFunctionWithLocation)(this._modifier.bind(this, "fixme"));
56
+ test.fail = (0, import_transform.wrapFunctionWithLocation)(this._modifier.bind(this, "fail"));
57
+ test.fail.only = (0, import_transform.wrapFunctionWithLocation)(this._createTest.bind(this, "fail.only"));
58
+ test.slow = (0, import_transform.wrapFunctionWithLocation)(this._modifier.bind(this, "slow"));
59
+ test.setTimeout = (0, import_transform.wrapFunctionWithLocation)(this._setTimeout.bind(this));
60
+ test.step = this._step.bind(this, "pass");
61
+ test.step.skip = this._step.bind(this, "skip");
62
+ test.use = (0, import_transform.wrapFunctionWithLocation)(this._use.bind(this));
63
+ test.extend = (0, import_transform.wrapFunctionWithLocation)(this._extend.bind(this));
64
+ test.info = () => {
65
+ const result = (0, import_globals.currentTestInfo)();
66
+ if (!result)
67
+ throw new Error("test.info() can only be called while test is running");
68
+ return result;
69
+ };
70
+ this.test = test;
71
+ }
72
+ _currentSuite(location, title) {
73
+ const suite = (0, import_globals.currentlyLoadingFileSuite)();
74
+ if (!suite) {
75
+ throw new Error([
76
+ `Playwright Test did not expect ${title} to be called here.`,
77
+ `Most common reasons include:`,
78
+ `- You are calling ${title} in a configuration file.`,
79
+ `- You are calling ${title} in a file that is imported by the configuration file.`,
80
+ `- You have two different versions of @playwright/test. This usually happens`,
81
+ ` when one of the dependencies in your package.json depends on @playwright/test.`
82
+ ].join("\n"));
83
+ }
84
+ return suite;
85
+ }
86
+ _createTest(type, location, title, fnOrDetails, fn) {
87
+ throwIfRunningInsideJest();
88
+ const suite = this._currentSuite(location, "test()");
89
+ if (!suite)
90
+ return;
91
+ let details;
92
+ let body;
93
+ if (typeof fnOrDetails === "function") {
94
+ body = fnOrDetails;
95
+ details = {};
96
+ } else {
97
+ body = fn;
98
+ details = fnOrDetails;
99
+ }
100
+ const validatedDetails = (0, import_validators.validateTestDetails)(details, location);
101
+ const test = new import_test.TestCase(title, body, this, location);
102
+ test._requireFile = suite._requireFile;
103
+ test.annotations.push(...validatedDetails.annotations);
104
+ test._tags.push(...validatedDetails.tags);
105
+ suite._addTest(test);
106
+ if (type === "only" || type === "fail.only")
107
+ test._only = true;
108
+ if (type === "skip" || type === "fixme" || type === "fail")
109
+ test.annotations.push({ type, location });
110
+ else if (type === "fail.only")
111
+ test.annotations.push({ type: "fail", location });
112
+ }
113
+ _describe(type, location, titleOrFn, fnOrDetails, fn) {
114
+ throwIfRunningInsideJest();
115
+ const suite = this._currentSuite(location, "test.describe()");
116
+ if (!suite)
117
+ return;
118
+ let title;
119
+ let body;
120
+ let details;
121
+ if (typeof titleOrFn === "function") {
122
+ title = "";
123
+ details = {};
124
+ body = titleOrFn;
125
+ } else if (typeof fnOrDetails === "function") {
126
+ title = titleOrFn;
127
+ details = {};
128
+ body = fnOrDetails;
129
+ } else {
130
+ title = titleOrFn;
131
+ details = fnOrDetails;
132
+ body = fn;
133
+ }
134
+ const validatedDetails = (0, import_validators.validateTestDetails)(details, location);
135
+ const child = new import_test.Suite(title, "describe");
136
+ child._requireFile = suite._requireFile;
137
+ child.location = location;
138
+ child._staticAnnotations.push(...validatedDetails.annotations);
139
+ child._tags.push(...validatedDetails.tags);
140
+ suite._addSuite(child);
141
+ if (type === "only" || type === "serial.only" || type === "parallel.only")
142
+ child._only = true;
143
+ if (type === "serial" || type === "serial.only")
144
+ child._parallelMode = "serial";
145
+ if (type === "parallel" || type === "parallel.only")
146
+ child._parallelMode = "parallel";
147
+ if (type === "skip" || type === "fixme")
148
+ child._staticAnnotations.push({ type, location });
149
+ for (let parent = suite; parent; parent = parent.parent) {
150
+ if (parent._parallelMode === "serial" && child._parallelMode === "parallel")
151
+ throw new Error("describe.parallel cannot be nested inside describe.serial");
152
+ if (parent._parallelMode === "default" && child._parallelMode === "parallel")
153
+ throw new Error("describe.parallel cannot be nested inside describe with default mode");
154
+ }
155
+ (0, import_globals.setCurrentlyLoadingFileSuite)(child);
156
+ body();
157
+ (0, import_globals.setCurrentlyLoadingFileSuite)(suite);
158
+ }
159
+ _hook(name, location, title, fn) {
160
+ const suite = this._currentSuite(location, `test.${name}()`);
161
+ if (!suite)
162
+ return;
163
+ if (typeof title === "function") {
164
+ fn = title;
165
+ title = `${name} hook`;
166
+ }
167
+ suite._hooks.push({ type: name, fn, title, location });
168
+ }
169
+ _configure(location, options) {
170
+ throwIfRunningInsideJest();
171
+ const suite = this._currentSuite(location, `test.describe.configure()`);
172
+ if (!suite)
173
+ return;
174
+ if (options.timeout !== void 0)
175
+ suite._timeout = options.timeout;
176
+ if (options.retries !== void 0)
177
+ suite._retries = options.retries;
178
+ if (options.mode !== void 0) {
179
+ if (suite._parallelMode !== "none")
180
+ throw new Error(`"${suite._parallelMode}" mode is already assigned for the enclosing scope.`);
181
+ suite._parallelMode = options.mode;
182
+ for (let parent = suite.parent; parent; parent = parent.parent) {
183
+ if (parent._parallelMode === "serial" && suite._parallelMode === "parallel")
184
+ throw new Error("describe with parallel mode cannot be nested inside describe with serial mode");
185
+ if (parent._parallelMode === "default" && suite._parallelMode === "parallel")
186
+ throw new Error("describe with parallel mode cannot be nested inside describe with default mode");
187
+ }
188
+ }
189
+ }
190
+ _modifier(type, location, ...modifierArgs) {
191
+ const suite = (0, import_globals.currentlyLoadingFileSuite)();
192
+ if (suite) {
193
+ if (typeof modifierArgs[0] === "string" && typeof modifierArgs[1] === "function" && (type === "skip" || type === "fixme" || type === "fail")) {
194
+ this._createTest(type, location, modifierArgs[0], modifierArgs[1]);
195
+ return;
196
+ }
197
+ if (typeof modifierArgs[0] === "string" && typeof modifierArgs[1] === "object" && typeof modifierArgs[2] === "function" && (type === "skip" || type === "fixme" || type === "fail")) {
198
+ this._createTest(type, location, modifierArgs[0], modifierArgs[1], modifierArgs[2]);
199
+ return;
200
+ }
201
+ if (typeof modifierArgs[0] === "function") {
202
+ suite._modifiers.push({ type, fn: modifierArgs[0], location, description: modifierArgs[1] });
203
+ } else {
204
+ if (modifierArgs.length >= 1 && !modifierArgs[0])
205
+ return;
206
+ const description = modifierArgs[1];
207
+ suite._staticAnnotations.push({ type, description, location });
208
+ }
209
+ return;
210
+ }
211
+ const testInfo = (0, import_globals.currentTestInfo)();
212
+ if (!testInfo)
213
+ throw new Error(`test.${type}() can only be called inside test, describe block or fixture`);
214
+ if (typeof modifierArgs[0] === "function")
215
+ throw new Error(`test.${type}() with a function can only be called inside describe block`);
216
+ testInfo._modifier(type, location, modifierArgs);
217
+ }
218
+ _setTimeout(location, timeout) {
219
+ const suite = (0, import_globals.currentlyLoadingFileSuite)();
220
+ if (suite) {
221
+ suite._timeout = timeout;
222
+ return;
223
+ }
224
+ const testInfo = (0, import_globals.currentTestInfo)();
225
+ if (!testInfo)
226
+ throw new Error(`test.setTimeout() can only be called from a test`);
227
+ testInfo.setTimeout(timeout);
228
+ }
229
+ _use(location, fixtures) {
230
+ const suite = this._currentSuite(location, `test.use()`);
231
+ if (!suite)
232
+ return;
233
+ suite._use.push({ fixtures, location });
234
+ }
235
+ async _step(expectation, title, body, options = {}) {
236
+ const testInfo = (0, import_globals.currentTestInfo)();
237
+ if (!testInfo)
238
+ throw new Error(`test.step() can only be called from a test`);
239
+ const step = testInfo._addStep({ category: "test.step", title, location: options.location, box: options.box });
240
+ return await (0, import_utils.currentZone)().with("stepZone", step).run(async () => {
241
+ try {
242
+ let result = void 0;
243
+ result = await (0, import_utils.raceAgainstDeadline)(async () => {
244
+ try {
245
+ return await step.info._runStepBody(expectation === "skip", body, step.location);
246
+ } catch (e) {
247
+ if (result?.timedOut)
248
+ testInfo._failWithError(e);
249
+ throw e;
250
+ }
251
+ }, options.timeout ? (0, import_utils.monotonicTime)() + options.timeout : 0);
252
+ if (result.timedOut)
253
+ throw new import_playwright_core.errors.TimeoutError(`Step timeout of ${options.timeout}ms exceeded.`);
254
+ step.complete({});
255
+ return result.result;
256
+ } catch (error) {
257
+ step.complete({ error });
258
+ throw error;
259
+ }
260
+ });
261
+ }
262
+ _extend(location, fixtures) {
263
+ if (fixtures[testTypeSymbol])
264
+ throw new Error(`test.extend() accepts fixtures object, not a test object.
265
+ Did you mean to call mergeTests()?`);
266
+ const fixturesWithLocation = { fixtures, location };
267
+ return new TestTypeImpl([...this.fixtures, fixturesWithLocation]).test;
268
+ }
269
+ }
270
+ function throwIfRunningInsideJest() {
271
+ if (process.env.JEST_WORKER_ID) {
272
+ const packageManagerCommand = (0, import_utils.getPackageManagerExecCommand)();
273
+ throw new Error(
274
+ `Playwright Test needs to be invoked via '${packageManagerCommand} playwright test' and excluded from Jest test runs.
275
+ Creating one directory for Playwright tests and one for Jest is the recommended way of doing it.
276
+ See https://playwright.dev/docs/intro for more information about Playwright Test.`
277
+ );
278
+ }
279
+ }
280
+ const rootTestType = new TestTypeImpl([]);
281
+ function mergeTests(...tests) {
282
+ let result = rootTestType;
283
+ for (const t of tests) {
284
+ const testTypeImpl = t[testTypeSymbol];
285
+ if (!testTypeImpl)
286
+ throw new Error(`mergeTests() accepts "test" functions as parameters.
287
+ Did you mean to call test.extend() with fixtures instead?`);
288
+ const newFixtures = testTypeImpl.fixtures.filter((theirs) => !result.fixtures.find((ours) => ours.fixtures === theirs.fixtures));
289
+ result = new TestTypeImpl([...result.fixtures, ...newFixtures]);
290
+ }
291
+ return result.test;
292
+ }
293
+ // Annotate the CommonJS export names for ESM import in node:
294
+ 0 && (module.exports = {
295
+ TestTypeImpl,
296
+ mergeTests,
297
+ rootTestType
298
+ });
@@ -0,0 +1,68 @@
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 validators_exports = {};
20
+ __export(validators_exports, {
21
+ validateTestAnnotation: () => validateTestAnnotation,
22
+ validateTestDetails: () => validateTestDetails
23
+ });
24
+ module.exports = __toCommonJS(validators_exports);
25
+ var import_mcpBundle = require("../mcpBundle");
26
+ const testAnnotationSchema = import_mcpBundle.z.object({
27
+ type: import_mcpBundle.z.string(),
28
+ description: import_mcpBundle.z.string().optional()
29
+ });
30
+ const testDetailsSchema = import_mcpBundle.z.object({
31
+ tag: import_mcpBundle.z.union([
32
+ import_mcpBundle.z.string().optional(),
33
+ import_mcpBundle.z.array(import_mcpBundle.z.string())
34
+ ]).transform((val) => Array.isArray(val) ? val : val !== void 0 ? [val] : []).refine((val) => val.every((v) => v.startsWith("@")), {
35
+ message: "Tag must start with '@'"
36
+ }),
37
+ annotation: import_mcpBundle.z.union([
38
+ testAnnotationSchema,
39
+ import_mcpBundle.z.array(testAnnotationSchema).optional()
40
+ ]).transform((val) => Array.isArray(val) ? val : val !== void 0 ? [val] : [])
41
+ });
42
+ function validateTestAnnotation(annotation) {
43
+ try {
44
+ return testAnnotationSchema.parse(annotation);
45
+ } catch (error) {
46
+ throwZodError(error);
47
+ }
48
+ }
49
+ function validateTestDetails(details, location) {
50
+ try {
51
+ const parsedDetails = testDetailsSchema.parse(details);
52
+ return {
53
+ annotations: parsedDetails.annotation.map((a) => ({ ...a, location })),
54
+ tags: parsedDetails.tag,
55
+ location
56
+ };
57
+ } catch (error) {
58
+ throwZodError(error);
59
+ }
60
+ }
61
+ function throwZodError(error) {
62
+ throw new Error(error.issues.map((i) => i.message).join("\n"));
63
+ }
64
+ // Annotate the CommonJS export names for ESM import in node:
65
+ 0 && (module.exports = {
66
+ validateTestAnnotation,
67
+ validateTestDetails
68
+ });
@@ -236,10 +236,8 @@ class Context {
236
236
  const result = await this._browserContextFactory.createContext(this._clientInfo, this._abortController.signal, { toolName: this._runningToolName });
237
237
  const { browserContext } = result;
238
238
  if (!this.config.allowUnrestrictedFileAccess) {
239
- if (typeof browserContext._setAllowedProtocols === "function")
240
- browserContext._setAllowedProtocols(["http:", "https:", "about:", "data:"]);
241
- if (typeof browserContext._setAllowedDirectories === "function")
242
- browserContext._setAllowedDirectories(allRootPaths(this._clientInfo));
239
+ browserContext._setAllowedProtocols(["http:", "https:", "about:", "data:"]);
240
+ browserContext._setAllowedDirectories(allRootPaths(this._clientInfo));
243
241
  }
244
242
  await this._setupRequestInterception(browserContext);
245
243
  for (const page of browserContext.pages())
@@ -24,7 +24,6 @@ module.exports = __toCommonJS(common_exports);
24
24
  var import_mcpBundle = require("../../../mcpBundle");
25
25
  var import_tool = require("./tool");
26
26
  var import_response = require("../response");
27
- var import_schema = require("./schema");
28
27
  const close = (0, import_tool.defineTool)({
29
28
  capability: "core",
30
29
  schema: {
@@ -47,7 +46,7 @@ const resize = (0, import_tool.defineTabTool)({
47
46
  name: "browser_resize",
48
47
  title: "Resize browser window",
49
48
  description: "Resize the browser window",
50
- inputSchema: import_schema.baseSchema.extend({
49
+ inputSchema: import_mcpBundle.z.object({
51
50
  width: import_mcpBundle.z.number().describe("Width of the browser window"),
52
51
  height: import_mcpBundle.z.number().describe("Height of the browser window")
53
52
  }),
@@ -24,14 +24,13 @@ __export(dialogs_exports, {
24
24
  module.exports = __toCommonJS(dialogs_exports);
25
25
  var import_mcpBundle = require("../../../mcpBundle");
26
26
  var import_tool = require("./tool");
27
- var import_schema = require("./schema");
28
27
  const handleDialog = (0, import_tool.defineTabTool)({
29
28
  capability: "core",
30
29
  schema: {
31
30
  name: "browser_handle_dialog",
32
31
  title: "Handle a dialog",
33
32
  description: "Handle a dialog",
34
- inputSchema: import_schema.baseSchema.extend({
33
+ inputSchema: import_mcpBundle.z.object({
35
34
  accept: import_mcpBundle.z.boolean().describe("Whether to accept the dialog."),
36
35
  promptText: import_mcpBundle.z.string().optional().describe("The text of the prompt in case of a prompt dialog.")
37
36
  }),
@@ -24,8 +24,7 @@ module.exports = __toCommonJS(evaluate_exports);
24
24
  var import_mcpBundle = require("../../../mcpBundle");
25
25
  var import_utils = require("playwright-core/lib/utils");
26
26
  var import_tool = require("./tool");
27
- var import_schema = require("./schema");
28
- const evaluateSchema = import_schema.baseSchema.extend({
27
+ const evaluateSchema = import_mcpBundle.z.object({
29
28
  function: import_mcpBundle.z.string().describe("() => { /* code */ } or (element) => { /* code */ } when element is provided"),
30
29
  element: import_mcpBundle.z.string().optional().describe("Human-readable element description used to obtain permission to interact with the element"),
31
30
  ref: import_mcpBundle.z.string().optional().describe("Exact target element reference from the page snapshot")
@@ -24,14 +24,13 @@ __export(files_exports, {
24
24
  module.exports = __toCommonJS(files_exports);
25
25
  var import_mcpBundle = require("../../../mcpBundle");
26
26
  var import_tool = require("./tool");
27
- var import_schema = require("./schema");
28
27
  const uploadFile = (0, import_tool.defineTabTool)({
29
28
  capability: "core",
30
29
  schema: {
31
30
  name: "browser_file_upload",
32
31
  title: "Upload files",
33
32
  description: "Upload one or multiple files",
34
- inputSchema: import_schema.baseSchema.extend({
33
+ inputSchema: import_mcpBundle.z.object({
35
34
  paths: import_mcpBundle.z.array(import_mcpBundle.z.string()).optional().describe("The absolute paths to the files to upload. Can be single file or multiple files. If omitted, file chooser is cancelled.")
36
35
  }),
37
36
  type: "action"
@@ -24,14 +24,13 @@ module.exports = __toCommonJS(form_exports);
24
24
  var import_mcpBundle = require("../../../mcpBundle");
25
25
  var import_utils = require("playwright-core/lib/utils");
26
26
  var import_tool = require("./tool");
27
- var import_schema = require("./schema");
28
27
  const fillForm = (0, import_tool.defineTabTool)({
29
28
  capability: "core",
30
29
  schema: {
31
30
  name: "browser_fill_form",
32
31
  title: "Fill form",
33
32
  description: "Fill multiple form fields",
34
- inputSchema: import_schema.baseSchema.extend({
33
+ inputSchema: import_mcpBundle.z.object({
35
34
  fields: import_mcpBundle.z.array(import_mcpBundle.z.object({
36
35
  name: import_mcpBundle.z.string().describe("Human-readable field name"),
37
36
  type: import_mcpBundle.z.enum(["textbox", "checkbox", "radio", "combobox", "slider"]).describe("Type of the field"),
@@ -24,14 +24,13 @@ module.exports = __toCommonJS(keyboard_exports);
24
24
  var import_mcpBundle = require("../../../mcpBundle");
25
25
  var import_tool = require("./tool");
26
26
  var import_snapshot = require("./snapshot");
27
- var import_schema = require("./schema");
28
27
  const press = (0, import_tool.defineTabTool)({
29
28
  capability: "core-input",
30
29
  schema: {
31
30
  name: "browser_press_key",
32
31
  title: "Press a key",
33
32
  description: "Press a key on the keyboard",
34
- inputSchema: import_schema.baseSchema.extend({
33
+ inputSchema: import_mcpBundle.z.object({
35
34
  key: import_mcpBundle.z.string().describe("Name of the key to press or a character to generate, such as `ArrowLeft` or `a`")
36
35
  }),
37
36
  type: "input"
@@ -56,7 +55,7 @@ const pressSequentially = (0, import_tool.defineTabTool)({
56
55
  name: "browser_press_sequentially",
57
56
  title: "Type text key by key",
58
57
  description: "Type text key by key on the keyboard",
59
- inputSchema: import_schema.baseSchema.extend({
58
+ inputSchema: import_mcpBundle.z.object({
60
59
  text: import_mcpBundle.z.string().describe("Text to type"),
61
60
  submit: import_mcpBundle.z.boolean().optional().describe("Whether to submit entered text (press Enter after)")
62
61
  }),
@@ -116,7 +115,7 @@ const keydown = (0, import_tool.defineTabTool)({
116
115
  name: "browser_keydown",
117
116
  title: "Press a key down",
118
117
  description: "Press a key down on the keyboard",
119
- inputSchema: import_schema.baseSchema.extend({
118
+ inputSchema: import_mcpBundle.z.object({
120
119
  key: import_mcpBundle.z.string().describe("Name of the key to press or a character to generate, such as `ArrowLeft` or `a`")
121
120
  }),
122
121
  type: "input"
@@ -133,7 +132,7 @@ const keyup = (0, import_tool.defineTabTool)({
133
132
  name: "browser_keyup",
134
133
  title: "Press a key up",
135
134
  description: "Press a key up on the keyboard",
136
- inputSchema: import_schema.baseSchema.extend({
135
+ inputSchema: import_mcpBundle.z.object({
137
136
  key: import_mcpBundle.z.string().describe("Name of the key to press or a character to generate, such as `ArrowLeft` or `a`")
138
137
  }),
139
138
  type: "input"
@@ -23,14 +23,13 @@ __export(navigate_exports, {
23
23
  module.exports = __toCommonJS(navigate_exports);
24
24
  var import_mcpBundle = require("../../../mcpBundle");
25
25
  var import_tool = require("./tool");
26
- var import_schema = require("./schema");
27
26
  const navigate = (0, import_tool.defineTool)({
28
27
  capability: "core-navigation",
29
28
  schema: {
30
29
  name: "browser_navigate",
31
30
  title: "Navigate to a URL",
32
31
  description: "Navigate to a URL",
33
- inputSchema: import_schema.baseSchema.extend({
32
+ inputSchema: import_mcpBundle.z.object({
34
33
  url: import_mcpBundle.z.string().describe("The URL to navigate to")
35
34
  }),
36
35
  type: "action"
@@ -57,7 +56,7 @@ const goBack = (0, import_tool.defineTabTool)({
57
56
  name: "browser_navigate_back",
58
57
  title: "Go back",
59
58
  description: "Go back to the previous page in the history",
60
- inputSchema: import_schema.baseSchema.extend({}),
59
+ inputSchema: import_mcpBundle.z.object({}),
61
60
  type: "action"
62
61
  },
63
62
  handle: async (tab, params, response) => {
@@ -73,7 +72,7 @@ const goForward = (0, import_tool.defineTabTool)({
73
72
  name: "browser_navigate_forward",
74
73
  title: "Go forward",
75
74
  description: "Go forward to the next page in the history",
76
- inputSchema: import_schema.baseSchema.extend({}),
75
+ inputSchema: import_mcpBundle.z.object({}),
77
76
  type: "action"
78
77
  },
79
78
  handle: async (tab, params, response) => {
@@ -89,7 +88,7 @@ const reload = (0, import_tool.defineTabTool)({
89
88
  name: "browser_reload",
90
89
  title: "Reload the page",
91
90
  description: "Reload the current page",
92
- inputSchema: import_schema.baseSchema.extend({}),
91
+ inputSchema: import_mcpBundle.z.object({}),
93
92
  type: "action"
94
93
  },
95
94
  handle: async (tab, params, response) => {
@@ -34,10 +34,8 @@ module.exports = __toCommonJS(runCode_exports);
34
34
  var import_vm = __toESM(require("vm"));
35
35
  var import_utils = require("playwright-core/lib/utils");
36
36
  var import_mcpBundle = require("../../../mcpBundle");
37
- var import_ai_runner_fake = require("@cotestdev/ai-runner-fake");
38
37
  var import_tool = require("./tool");
39
- var import_schema = require("./schema");
40
- const codeSchema = import_schema.baseSchema.extend({
38
+ const codeSchema = import_mcpBundle.z.object({
41
39
  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(); }\``)
42
40
  });
43
41
  const runCode = (0, import_tool.defineTabTool)({
@@ -73,33 +71,6 @@ const runCode = (0, import_tool.defineTabTool)({
73
71
  });
74
72
  }
75
73
  });
76
- const scriptSchema = import_mcpBundle.z.object({
77
- 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(); }\``),
78
- params: import_mcpBundle.z.record(import_mcpBundle.z.string(), import_mcpBundle.z.any()).optional().describe("Parameters to pass to the script."),
79
- projectId: import_mcpBundle.z.string().describe("Project ID"),
80
- testId: import_mcpBundle.z.string().describe("Test ID")
81
- });
82
- const runScript = (0, import_tool.defineTabTool)({
83
- capability: "extra",
84
- schema: {
85
- name: "run_test_script",
86
- title: "Run test script with runner",
87
- description: "Run Playwright script",
88
- inputSchema: scriptSchema,
89
- type: "action"
90
- },
91
- handle: async (tab, params, response) => {
92
- response.setIncludeSnapshot();
93
- const runner = import_ai_runner_fake.Runner.NewInstance(params.projectId, params.testId);
94
- await runner.init(tab.page, tab.page.context(), params.params);
95
- const result = await runner.runScript(params.testId, params.code);
96
- const code = `// Returns the out parameters of the reusable test
97
- const result = await runner.reuseTest('${params.testId}');`;
98
- response.addCode(code);
99
- response.addTextResult(`Out Parameters: ${JSON.stringify(result)}`);
100
- }
101
- });
102
74
  var runCode_default = [
103
- runCode,
104
- runScript
75
+ runCode
105
76
  ];
@@ -27,8 +27,7 @@ var import_utilsBundle = require("playwright-core/lib/utilsBundle");
27
27
  var import_utils2 = require("playwright-core/lib/utils");
28
28
  var import_mcpBundle = require("../../../mcpBundle");
29
29
  var import_tool = require("./tool");
30
- var import_schema = require("./schema");
31
- const screenshotSchema = import_schema.baseSchema.extend({
30
+ const screenshotSchema = import_mcpBundle.z.object({
32
31
  type: import_mcpBundle.z.enum(["png", "jpeg"]).default("png").describe("Image format for the screenshot. Default is png."),
33
32
  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."),
34
33
  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."),
@@ -25,7 +25,6 @@ module.exports = __toCommonJS(snapshot_exports);
25
25
  var import_mcpBundle = require("../../../mcpBundle");
26
26
  var import_utils = require("playwright-core/lib/utils");
27
27
  var import_tool = require("./tool");
28
- var import_schema = require("./schema");
29
28
  const snapshot = (0, import_tool.defineTool)({
30
29
  capability: "core",
31
30
  schema: {
@@ -42,7 +41,7 @@ const snapshot = (0, import_tool.defineTool)({
42
41
  response.setIncludeFullSnapshot(params.filename);
43
42
  }
44
43
  });
45
- const elementSchema = import_schema.baseSchema.extend({
44
+ const elementSchema = import_mcpBundle.z.object({
46
45
  element: import_mcpBundle.z.string().optional().describe("Human-readable element description used to obtain permission to interact with the element"),
47
46
  ref: import_mcpBundle.z.string().describe("Exact target element reference from the page snapshot")
48
47
  });
@@ -87,7 +86,7 @@ const drag = (0, import_tool.defineTabTool)({
87
86
  name: "browser_drag",
88
87
  title: "Drag mouse",
89
88
  description: "Perform drag and drop between two elements",
90
- inputSchema: import_schema.baseSchema.extend({
89
+ inputSchema: import_mcpBundle.z.object({
91
90
  startElement: import_mcpBundle.z.string().describe("Human-readable source element description used to obtain the permission to interact with the element"),
92
91
  startRef: import_mcpBundle.z.string().describe("Exact source element reference from the page snapshot"),
93
92
  endElement: import_mcpBundle.z.string().describe("Human-readable target element description used to obtain the permission to interact with the element"),
@@ -24,14 +24,13 @@ module.exports = __toCommonJS(tabs_exports);
24
24
  var import_mcpBundle = require("../../../mcpBundle");
25
25
  var import_tool = require("./tool");
26
26
  var import_response = require("../response");
27
- var import_schema = require("./schema");
28
27
  const browserTabs = (0, import_tool.defineTool)({
29
28
  capability: "core-tabs",
30
29
  schema: {
31
30
  name: "browser_tabs",
32
31
  title: "Manage tabs",
33
32
  description: "List, create, close, or select a browser tab.",
34
- inputSchema: import_schema.baseSchema.extend({
33
+ inputSchema: import_mcpBundle.z.object({
35
34
  action: import_mcpBundle.z.enum(["list", "new", "close", "select"]).describe("Operation to perform"),
36
35
  index: import_mcpBundle.z.number().optional().describe("Tab index, used for close/select. If omitted for close, current tab is closed.")
37
36
  }),