|
f7eb47b…
|
lmata
|
1 |
"use strict"; |
|
f7eb47b…
|
lmata
|
2 |
var __create = Object.create; |
|
f7eb47b…
|
lmata
|
3 |
var __defProp = Object.defineProperty; |
|
f7eb47b…
|
lmata
|
4 |
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; |
|
f7eb47b…
|
lmata
|
5 |
var __getOwnPropNames = Object.getOwnPropertyNames; |
|
f7eb47b…
|
lmata
|
6 |
var __getProtoOf = Object.getPrototypeOf; |
|
f7eb47b…
|
lmata
|
7 |
var __hasOwnProp = Object.prototype.hasOwnProperty; |
|
f7eb47b…
|
lmata
|
8 |
var __export = (target, all) => { |
|
f7eb47b…
|
lmata
|
9 |
for (var name in all) |
|
f7eb47b…
|
lmata
|
10 |
__defProp(target, name, { get: all[name], enumerable: true }); |
|
f7eb47b…
|
lmata
|
11 |
}; |
|
f7eb47b…
|
lmata
|
12 |
var __copyProps = (to, from, except, desc) => { |
|
f7eb47b…
|
lmata
|
13 |
if (from && typeof from === "object" || typeof from === "function") { |
|
f7eb47b…
|
lmata
|
14 |
for (let key of __getOwnPropNames(from)) |
|
f7eb47b…
|
lmata
|
15 |
if (!__hasOwnProp.call(to, key) && key !== except) |
|
f7eb47b…
|
lmata
|
16 |
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); |
|
f7eb47b…
|
lmata
|
17 |
} |
|
f7eb47b…
|
lmata
|
18 |
return to; |
|
f7eb47b…
|
lmata
|
19 |
}; |
|
f7eb47b…
|
lmata
|
20 |
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( |
|
f7eb47b…
|
lmata
|
21 |
// If the importer is in node compatibility mode or this is not an ESM |
|
f7eb47b…
|
lmata
|
22 |
// file that has been converted to a CommonJS file using a Babel- |
|
f7eb47b…
|
lmata
|
23 |
// compatible transform (i.e. "__esModule" has not been set), then set |
|
f7eb47b…
|
lmata
|
24 |
// "default" to the CommonJS "module.exports" for node compatibility. |
|
f7eb47b…
|
lmata
|
25 |
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, |
|
f7eb47b…
|
lmata
|
26 |
mod |
|
f7eb47b…
|
lmata
|
27 |
)); |
|
f7eb47b…
|
lmata
|
28 |
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); |
|
f7eb47b…
|
lmata
|
29 |
var testTools_exports = {}; |
|
f7eb47b…
|
lmata
|
30 |
__export(testTools_exports, { |
|
f7eb47b…
|
lmata
|
31 |
debugTest: () => debugTest, |
|
f7eb47b…
|
lmata
|
32 |
listTests: () => listTests, |
|
f7eb47b…
|
lmata
|
33 |
runTests: () => runTests |
|
f7eb47b…
|
lmata
|
34 |
}); |
|
f7eb47b…
|
lmata
|
35 |
module.exports = __toCommonJS(testTools_exports); |
|
f7eb47b…
|
lmata
|
36 |
var import_mcpBundle = require("playwright-core/lib/mcpBundle"); |
|
f7eb47b…
|
lmata
|
37 |
var import_listModeReporter = __toESM(require("../../reporters/listModeReporter")); |
|
f7eb47b…
|
lmata
|
38 |
var import_testTool = require("./testTool"); |
|
f7eb47b…
|
lmata
|
39 |
const listTests = (0, import_testTool.defineTestTool)({ |
|
f7eb47b…
|
lmata
|
40 |
schema: { |
|
f7eb47b…
|
lmata
|
41 |
name: "test_list", |
|
f7eb47b…
|
lmata
|
42 |
title: "List tests", |
|
f7eb47b…
|
lmata
|
43 |
description: "List tests", |
|
f7eb47b…
|
lmata
|
44 |
inputSchema: import_mcpBundle.z.object({}), |
|
f7eb47b…
|
lmata
|
45 |
type: "readOnly" |
|
f7eb47b…
|
lmata
|
46 |
}, |
|
f7eb47b…
|
lmata
|
47 |
handle: async (context) => { |
|
f7eb47b…
|
lmata
|
48 |
const { testRunner, screen, output } = await context.createTestRunner(); |
|
f7eb47b…
|
lmata
|
49 |
const reporter = new import_listModeReporter.default({ screen, includeTestId: true }); |
|
f7eb47b…
|
lmata
|
50 |
await testRunner.listTests(reporter, {}); |
|
f7eb47b…
|
lmata
|
51 |
return { content: output.map((text) => ({ type: "text", text })) }; |
|
f7eb47b…
|
lmata
|
52 |
} |
|
f7eb47b…
|
lmata
|
53 |
}); |
|
f7eb47b…
|
lmata
|
54 |
const runTests = (0, import_testTool.defineTestTool)({ |
|
f7eb47b…
|
lmata
|
55 |
schema: { |
|
f7eb47b…
|
lmata
|
56 |
name: "test_run", |
|
f7eb47b…
|
lmata
|
57 |
title: "Run tests", |
|
f7eb47b…
|
lmata
|
58 |
description: "Run tests", |
|
f7eb47b…
|
lmata
|
59 |
inputSchema: import_mcpBundle.z.object({ |
|
f7eb47b…
|
lmata
|
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"'), |
|
f7eb47b…
|
lmata
|
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') |
|
f7eb47b…
|
lmata
|
62 |
}), |
|
f7eb47b…
|
lmata
|
63 |
type: "readOnly" |
|
f7eb47b…
|
lmata
|
64 |
}, |
|
f7eb47b…
|
lmata
|
65 |
handle: async (context, params) => { |
|
f7eb47b…
|
lmata
|
66 |
const { output } = await context.runTestsWithGlobalSetupAndPossiblePause({ |
|
f7eb47b…
|
lmata
|
67 |
locations: params.locations ?? [], |
|
f7eb47b…
|
lmata
|
68 |
projects: params.projects, |
|
f7eb47b…
|
lmata
|
69 |
disableConfigReporters: true |
|
f7eb47b…
|
lmata
|
70 |
}); |
|
f7eb47b…
|
lmata
|
71 |
return { content: [{ type: "text", text: output }] }; |
|
f7eb47b…
|
lmata
|
72 |
} |
|
f7eb47b…
|
lmata
|
73 |
}); |
|
f7eb47b…
|
lmata
|
74 |
const debugTest = (0, import_testTool.defineTestTool)({ |
|
f7eb47b…
|
lmata
|
75 |
schema: { |
|
f7eb47b…
|
lmata
|
76 |
name: "test_debug", |
|
f7eb47b…
|
lmata
|
77 |
title: "Debug single test", |
|
f7eb47b…
|
lmata
|
78 |
description: "Debug single test", |
|
f7eb47b…
|
lmata
|
79 |
inputSchema: import_mcpBundle.z.object({ |
|
f7eb47b…
|
lmata
|
80 |
test: import_mcpBundle.z.object({ |
|
f7eb47b…
|
lmata
|
81 |
id: import_mcpBundle.z.string().describe("Test ID to debug."), |
|
f7eb47b…
|
lmata
|
82 |
title: import_mcpBundle.z.string().describe("Human readable test title for granting permission to debug the test.") |
|
f7eb47b…
|
lmata
|
83 |
}) |
|
f7eb47b…
|
lmata
|
84 |
}), |
|
f7eb47b…
|
lmata
|
85 |
type: "readOnly" |
|
f7eb47b…
|
lmata
|
86 |
}, |
|
f7eb47b…
|
lmata
|
87 |
handle: async (context, params) => { |
|
f7eb47b…
|
lmata
|
88 |
const { output, status } = await context.runTestsWithGlobalSetupAndPossiblePause({ |
|
f7eb47b…
|
lmata
|
89 |
headed: context.computedHeaded, |
|
f7eb47b…
|
lmata
|
90 |
locations: [], |
|
f7eb47b…
|
lmata
|
91 |
// we can make this faster by passing the test's location, so we don't need to scan all tests to find the ID |
|
f7eb47b…
|
lmata
|
92 |
testIds: [params.test.id], |
|
f7eb47b…
|
lmata
|
93 |
// For automatic recovery |
|
f7eb47b…
|
lmata
|
94 |
timeout: 0, |
|
f7eb47b…
|
lmata
|
95 |
workers: 1, |
|
f7eb47b…
|
lmata
|
96 |
pauseOnError: true, |
|
f7eb47b…
|
lmata
|
97 |
disableConfigReporters: true, |
|
f7eb47b…
|
lmata
|
98 |
actionTimeout: 5e3 |
|
f7eb47b…
|
lmata
|
99 |
}); |
|
f7eb47b…
|
lmata
|
100 |
return { content: [{ type: "text", text: output }], isError: status !== "paused" && status !== "passed" }; |
|
f7eb47b…
|
lmata
|
101 |
} |
|
f7eb47b…
|
lmata
|
102 |
}); |
|
f7eb47b…
|
lmata
|
103 |
// Annotate the CommonJS export names for ESM import in node: |
|
f7eb47b…
|
lmata
|
104 |
0 && (module.exports = { |
|
f7eb47b…
|
lmata
|
105 |
debugTest, |
|
f7eb47b…
|
lmata
|
106 |
listTests, |
|
f7eb47b…
|
lmata
|
107 |
runTests |
|
f7eb47b…
|
lmata
|
108 |
}); |