@playdrop/playdrop-cli 0.14.8 → 0.15.0
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/config/client-meta.json +2 -2
- package/dist/commands/agents.js +1 -1
- package/dist/commands/worker.js +2 -2
- package/node_modules/@playdrop/api-client/dist/client.d.ts +3 -1
- package/node_modules/@playdrop/api-client/dist/client.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts +3 -1
- package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/admin.js +46 -2
- package/node_modules/@playdrop/config/client-meta.json +2 -2
- package/node_modules/@playdrop/types/dist/api.d.ts +96 -1
- package/node_modules/@playdrop/types/dist/api.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/api.js +17 -0
- package/node_modules/@playwright/mcp/LICENSE +201 -0
- package/node_modules/@playwright/mcp/README.md +1592 -0
- package/node_modules/@playwright/mcp/cli.js +32 -0
- package/node_modules/@playwright/mcp/config.d.ts +239 -0
- package/node_modules/@playwright/mcp/index.d.ts +23 -0
- package/node_modules/@playwright/mcp/index.js +19 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/LICENSE +202 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/NOTICE +5 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/README.md +318 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/ThirdPartyNotices.txt +14 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/cli.js +19 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/index.d.ts +17 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/index.js +17 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/index.mjs +18 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/jsx-runtime.js +42 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/jsx-runtime.mjs +21 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/agents/agentParser.js +89 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/agents/copilot-setup-steps.yml +34 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/agents/generateAgents.js +395 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/agents/playwright-test-coverage.prompt.md +31 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/agents/playwright-test-generate.prompt.md +8 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/agents/playwright-test-generator.agent.md +88 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/agents/playwright-test-heal.prompt.md +6 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/agents/playwright-test-healer.agent.md +56 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/agents/playwright-test-plan.prompt.md +9 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/agents/playwright-test-planner.agent.md +74 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/cli/reportActions.js +78 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/cli/testActions.js +213 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/common/index.js +2966 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/common/index.js.txt +34 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/errorContext.js +129 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/globals.js +58 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/index.js +783 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/isomorphic.js +260 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/isomorphic.js.txt +9 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/loader/loaderProcessEntry.js +34 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/loader/loaderProcessEntry.js.txt +9 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/matchers/expect.js +13480 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/matchers/expect.js.LICENSE +640 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/matchers/expect.js.txt +67 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/mcp/test/browserBackend.js +125 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/mcp/test/generatorTools.js +122 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/mcp/test/plannerTools.js +150 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/mcp/test/seed.js +82 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/mcp/test/streams.js +44 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/mcp/test/testBackend.js +99 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/mcp/test/testContext.js +306 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/mcp/test/testTool.js +30 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/mcp/test/testTools.js +98 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/package.js +47 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/program.js +237 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/runner/index.js +8154 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/runner/index.js.txt +59 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/transform/babelBundle.js +72275 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/transform/babelBundle.js.LICENSE +2384 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/transform/babelBundle.js.txt +325 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/transform/esmLoader.js +8060 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/transform/esmLoader.js.LICENSE +355 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/transform/esmLoader.js.txt +60 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/util.js +373 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/worker/workerProcessEntry.js +1850 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/lib/worker/workerProcessEntry.js.txt +19 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/package.json +58 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/test.d.ts +18 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/test.js +24 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/test.mjs +35 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/types/test.d.ts +10709 -0
- package/node_modules/@playwright/mcp/node_modules/playwright/types/testReporter.d.ts +908 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/LICENSE +202 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/NOTICE +5 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/README.md +3 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/ThirdPartyNotices.txt +13 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/bin/install_media_pack.ps1 +5 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/bin/install_webkit_wsl.ps1 +33 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/bin/reinstall_chrome_beta_linux.sh +42 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/bin/reinstall_chrome_beta_mac.sh +13 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/bin/reinstall_chrome_beta_win.ps1 +24 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/bin/reinstall_chrome_stable_linux.sh +42 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/bin/reinstall_chrome_stable_mac.sh +12 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/bin/reinstall_chrome_stable_win.ps1 +24 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/bin/reinstall_msedge_beta_linux.sh +48 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/bin/reinstall_msedge_beta_mac.sh +11 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/bin/reinstall_msedge_beta_win.ps1 +23 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/bin/reinstall_msedge_dev_linux.sh +48 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/bin/reinstall_msedge_dev_mac.sh +11 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/bin/reinstall_msedge_dev_win.ps1 +23 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/bin/reinstall_msedge_stable_linux.sh +48 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/bin/reinstall_msedge_stable_mac.sh +11 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/bin/reinstall_msedge_stable_win.ps1 +24 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/browsers.json +81 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/cli.js +21 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/index.d.ts +17 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/index.js +17 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/index.mjs +28 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/bootstrap.js +88 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/coreBundle.js +74495 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/entry/cliDaemon.js +5 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/entry/dashboardApp.js +3 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/entry/mcp.js +10 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/entry/oopBrowserDownload.js +3 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/package.js +50 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/server/chromium/appIcon.png +0 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/server/electron/loader.js +118 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/serverRegistry.js +7347 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/serverRegistry.js.LICENSE +354 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/tools/cli-client/channelSessions.js +141 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/tools/cli-client/cli.js +6 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/tools/cli-client/help.json +707 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/tools/cli-client/minimist.js +128 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/tools/cli-client/output.js +343 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/tools/cli-client/program.js +404 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/tools/cli-client/registry.js +176 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/tools/cli-client/session.js +258 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/tools/cli-client/skill/SKILL.md +420 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/tools/cli-client/skill/references/element-attributes.md +23 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/tools/cli-client/skill/references/playwright-tests.md +39 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/tools/cli-client/skill/references/request-mocking.md +87 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/tools/cli-client/skill/references/running-code.md +241 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/tools/cli-client/skill/references/session-management.md +225 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/tools/cli-client/skill/references/storage-state.md +275 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/tools/cli-client/skill/references/test-generation.md +433 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/tools/cli-client/skill/references/tracing.md +139 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/tools/cli-client/skill/references/video-recording.md +143 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/tools/dashboard/appIcon.png +0 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/tools/trace/SKILL.md +171 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/tools/utils/extension.js +78 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/tools/utils/socketConnection.js +108 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/utilsBundle.js +90764 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/utilsBundle.js.LICENSE +2179 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/dashboard/assets/codicon-DCmgc-ay.ttf +0 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-1bWoP6pv.svg +1 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-beta-k3eOH_eK.svg +1 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-nightly-Cp5nfeDT.svg +1 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/dashboard/assets/index-CyWAfh-p.js +11 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/dashboard/assets/index-DhC616m4.css +1 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/dashboard/assets/safari-na3_-uQk.svg +1 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/dashboard/index.html +29 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/dashboard/playwright-logo.svg +24 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/htmlReport/index.html +16 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/htmlReport/report.css +2 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/htmlReport/report.js +32 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule--QdMvsKi.css +1 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-BVGIAA-i.js +32 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/recorder/assets/index-BQ57a3QC.js +129 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/recorder/assets/index-l_lX622x.css +1 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/recorder/index.html +29 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/recorder/playwright-logo.svg +9 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/traceViewer/assets/codeMirrorModule-BSEO6m_i.js +32 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-CT5oRh4X.js +181 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/traceViewer/assets/urlMatch-L3liM589.js +1 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/traceViewer/assets/xtermModule-BN2nOuEV.js +7 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.-QdMvsKi.css +1 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/traceViewer/defaultSettingsView.BLFoOugd.css +1 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/traceViewer/index.B_TqY17P.css +1 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/traceViewer/index.DLSGjmWZ.js +1 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/traceViewer/index.html +44 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/traceViewer/manifest.webmanifest +16 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/traceViewer/playwright-logo.svg +9 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/traceViewer/snapshot.B_Jk1wbt.js +1 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/traceViewer/snapshot.html +10 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/traceViewer/sw.bundle.js +4 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/traceViewer/uiMode.C7UW1sC9.css +1 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/traceViewer/uiMode.CZvydVOh.js +5 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +18 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.kHJ-D0s7.css +1 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/lib/xdg-open +1267 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/package.json +34 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/types/protocol.d.ts +24842 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/types/structs.d.ts +45 -0
- package/node_modules/@playwright/mcp/node_modules/playwright-core/types/types.d.ts +26088 -0
- package/node_modules/@playwright/mcp/package.json +51 -0
- package/package.json +3 -1
|
@@ -0,0 +1,99 @@
|
|
|
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 testBackend_exports = {};
|
|
30
|
+
__export(testBackend_exports, {
|
|
31
|
+
TestServerBackend: () => TestServerBackend,
|
|
32
|
+
testServerBackendTools: () => testServerBackendTools
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(testBackend_exports);
|
|
35
|
+
var import_events = __toESM(require("events"));
|
|
36
|
+
var import_coreBundle = require("playwright-core/lib/coreBundle");
|
|
37
|
+
var import_testContext = require("./testContext");
|
|
38
|
+
var testTools = __toESM(require("./testTools.js"));
|
|
39
|
+
var generatorTools = __toESM(require("./generatorTools.js"));
|
|
40
|
+
var plannerTools = __toESM(require("./plannerTools.js"));
|
|
41
|
+
const zod = require("playwright-core/lib/utilsBundle").z;
|
|
42
|
+
const typesWithIntent = ["action", "assertion", "input"];
|
|
43
|
+
const testServerBackendTools = [
|
|
44
|
+
plannerTools.saveTestPlan,
|
|
45
|
+
plannerTools.setupPage,
|
|
46
|
+
plannerTools.submitTestPlan,
|
|
47
|
+
generatorTools.setupPage,
|
|
48
|
+
generatorTools.generatorReadLog,
|
|
49
|
+
generatorTools.generatorWriteTest,
|
|
50
|
+
testTools.listTests,
|
|
51
|
+
testTools.runTests,
|
|
52
|
+
testTools.debugTest,
|
|
53
|
+
...import_coreBundle.tools.browserTools.map((tool) => wrapBrowserTool(tool))
|
|
54
|
+
];
|
|
55
|
+
class TestServerBackend extends import_events.default {
|
|
56
|
+
constructor(configPath, options) {
|
|
57
|
+
super();
|
|
58
|
+
this.name = "Playwright";
|
|
59
|
+
this.version = "0.0.1";
|
|
60
|
+
this._options = options || {};
|
|
61
|
+
this._configPath = configPath;
|
|
62
|
+
}
|
|
63
|
+
async initialize(clientInfo) {
|
|
64
|
+
this._context = new import_testContext.TestContext(clientInfo, this._configPath, this._options);
|
|
65
|
+
}
|
|
66
|
+
async callTool(name, args, signal) {
|
|
67
|
+
const tool = testServerBackendTools.find((tool2) => tool2.schema.name === name);
|
|
68
|
+
if (!tool)
|
|
69
|
+
throw new Error(`Tool not found: ${name}. Available tools: ${testServerBackendTools.map((tool2) => tool2.schema.name).join(", ")}`);
|
|
70
|
+
try {
|
|
71
|
+
return await tool.handle(this._context, tool.schema.inputSchema.parse(args || {}), signal);
|
|
72
|
+
} catch (e) {
|
|
73
|
+
return { content: [{ type: "text", text: String(e) }], isError: true };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async dispose() {
|
|
77
|
+
await this._context?.close();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function wrapBrowserTool(tool) {
|
|
81
|
+
const inputSchema = typesWithIntent.includes(tool.schema.type) ? tool.schema.inputSchema.extend({
|
|
82
|
+
intent: zod.string().describe("The intent of the call, for example the test step description plan idea")
|
|
83
|
+
}) : tool.schema.inputSchema;
|
|
84
|
+
return {
|
|
85
|
+
schema: {
|
|
86
|
+
...tool.schema,
|
|
87
|
+
inputSchema
|
|
88
|
+
},
|
|
89
|
+
handle: async (context, params, _signal) => {
|
|
90
|
+
const response = await context.sendMessageToPausedTest({ callTool: { name: tool.schema.name, arguments: params } });
|
|
91
|
+
return response.callTool;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
96
|
+
0 && (module.exports = {
|
|
97
|
+
TestServerBackend,
|
|
98
|
+
testServerBackendTools
|
|
99
|
+
});
|
|
@@ -0,0 +1,306 @@
|
|
|
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 testContext_exports = {};
|
|
30
|
+
__export(testContext_exports, {
|
|
31
|
+
GeneratorJournal: () => GeneratorJournal,
|
|
32
|
+
TestContext: () => TestContext,
|
|
33
|
+
createScreen: () => createScreen
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(testContext_exports);
|
|
36
|
+
var import_fs = __toESM(require("fs"));
|
|
37
|
+
var import_os = __toESM(require("os"));
|
|
38
|
+
var import_path = __toESM(require("path"));
|
|
39
|
+
var import_coreBundle = require("playwright-core/lib/coreBundle");
|
|
40
|
+
var import_runner = require("../../runner");
|
|
41
|
+
var import_streams = require("./streams");
|
|
42
|
+
var import_util = require("../../util");
|
|
43
|
+
var import_seed = require("./seed");
|
|
44
|
+
var import_common = require("../../common");
|
|
45
|
+
const debug = require("playwright-core/lib/utilsBundle").debug;
|
|
46
|
+
const { noColors } = require("playwright-core/lib/coreBundle").iso;
|
|
47
|
+
const { ManualPromise, signalToPromise } = require("playwright-core/lib/coreBundle").iso;
|
|
48
|
+
const { escapeRegExp } = require("playwright-core/lib/coreBundle").iso;
|
|
49
|
+
const { toPosixPath } = require("playwright-core/lib/coreBundle").utils;
|
|
50
|
+
class GeneratorJournal {
|
|
51
|
+
constructor(rootPath, plan, seed) {
|
|
52
|
+
this._rootPath = rootPath;
|
|
53
|
+
this._plan = plan;
|
|
54
|
+
this._seed = seed;
|
|
55
|
+
this._steps = [];
|
|
56
|
+
}
|
|
57
|
+
logStep(title, code) {
|
|
58
|
+
if (title)
|
|
59
|
+
this._steps.push({ title, code });
|
|
60
|
+
}
|
|
61
|
+
journal() {
|
|
62
|
+
const result = [];
|
|
63
|
+
result.push(`# Plan`);
|
|
64
|
+
result.push(this._plan);
|
|
65
|
+
result.push(`# Seed file: ${toPosixPath(import_path.default.relative(this._rootPath, this._seed.file))}`);
|
|
66
|
+
result.push("```ts");
|
|
67
|
+
result.push(this._seed.content);
|
|
68
|
+
result.push("```");
|
|
69
|
+
result.push(`# Steps`);
|
|
70
|
+
result.push(this._steps.map((step) => `### ${step.title}
|
|
71
|
+
\`\`\`ts
|
|
72
|
+
${step.code}
|
|
73
|
+
\`\`\``).join("\n\n"));
|
|
74
|
+
result.push(bestPracticesMarkdown);
|
|
75
|
+
return result.join("\n\n");
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
class TestContext {
|
|
79
|
+
constructor(clientInfo, configPath, options) {
|
|
80
|
+
this._testOpQueue = Promise.resolve();
|
|
81
|
+
this._clientInfo = clientInfo;
|
|
82
|
+
this._configLocation = import_common.configLoader.resolveConfigLocation(configPath || clientInfo.cwd);
|
|
83
|
+
this.rootPath = clientInfo.cwd || this._configLocation.configDir;
|
|
84
|
+
if (options?.headless !== void 0)
|
|
85
|
+
this.computedHeaded = !options.headless;
|
|
86
|
+
else
|
|
87
|
+
this.computedHeaded = !process.env.CI && !(import_os.default.platform() === "linux" && !process.env.DISPLAY);
|
|
88
|
+
}
|
|
89
|
+
async _enqueue(fn) {
|
|
90
|
+
const next = this._testOpQueue.then(fn);
|
|
91
|
+
this._testOpQueue = next.then(() => {
|
|
92
|
+
}, () => {
|
|
93
|
+
});
|
|
94
|
+
return await next;
|
|
95
|
+
}
|
|
96
|
+
existingTestRunner() {
|
|
97
|
+
return this._testRunnerAndScreen?.testRunner;
|
|
98
|
+
}
|
|
99
|
+
async _cleanupTestRunner() {
|
|
100
|
+
if (!this._testRunnerAndScreen)
|
|
101
|
+
return;
|
|
102
|
+
await this._testRunnerAndScreen.testRunner.stopTests();
|
|
103
|
+
this._testRunnerAndScreen.claimStdio();
|
|
104
|
+
try {
|
|
105
|
+
await this._testRunnerAndScreen.testRunner.runGlobalTeardown();
|
|
106
|
+
} finally {
|
|
107
|
+
this._testRunnerAndScreen.releaseStdio();
|
|
108
|
+
this._testRunnerAndScreen = void 0;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
async createTestRunner() {
|
|
112
|
+
await this._cleanupTestRunner();
|
|
113
|
+
const runner = new import_runner.testRunner.TestRunner(this._configLocation, {});
|
|
114
|
+
await runner.initialize({});
|
|
115
|
+
const testPaused = new ManualPromise();
|
|
116
|
+
const testRunnerAndScreen = {
|
|
117
|
+
...createScreen(),
|
|
118
|
+
testRunner: runner,
|
|
119
|
+
waitForTestPaused: () => testPaused
|
|
120
|
+
};
|
|
121
|
+
this._testRunnerAndScreen = testRunnerAndScreen;
|
|
122
|
+
runner.on(import_runner.testRunner.TestRunnerEvent.TestPaused, (params) => {
|
|
123
|
+
testRunnerAndScreen.sendMessageToPausedTest = params.sendMessage;
|
|
124
|
+
testPaused.resolve();
|
|
125
|
+
});
|
|
126
|
+
return testRunnerAndScreen;
|
|
127
|
+
}
|
|
128
|
+
async getOrCreateSeedFile(seedFile, projectName) {
|
|
129
|
+
const configDir = this._configLocation.configDir;
|
|
130
|
+
const { testRunner: runner } = await this.createTestRunner();
|
|
131
|
+
const config = await runner.loadConfig();
|
|
132
|
+
const project = (0, import_seed.seedProject)(config, projectName);
|
|
133
|
+
if (!seedFile) {
|
|
134
|
+
seedFile = await (0, import_seed.ensureSeedFile)(project);
|
|
135
|
+
} else {
|
|
136
|
+
const candidateFiles = [];
|
|
137
|
+
const testDir = project.project.testDir;
|
|
138
|
+
candidateFiles.push(import_path.default.resolve(testDir, seedFile));
|
|
139
|
+
candidateFiles.push(import_path.default.resolve(configDir, seedFile));
|
|
140
|
+
candidateFiles.push(import_path.default.resolve(this.rootPath, seedFile));
|
|
141
|
+
let resolvedSeedFile;
|
|
142
|
+
for (const candidateFile of candidateFiles) {
|
|
143
|
+
if (await (0, import_util.fileExistsAsync)(candidateFile)) {
|
|
144
|
+
resolvedSeedFile = candidateFile;
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (!resolvedSeedFile)
|
|
149
|
+
throw new Error("seed test not found.");
|
|
150
|
+
seedFile = resolvedSeedFile;
|
|
151
|
+
}
|
|
152
|
+
const seedFileContent = await import_fs.default.promises.readFile(seedFile, "utf8");
|
|
153
|
+
return {
|
|
154
|
+
file: seedFile,
|
|
155
|
+
content: seedFileContent,
|
|
156
|
+
projectName: project.project.name
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
async runSeedTest(seedFile, projectName, signal) {
|
|
160
|
+
const result = await this.runTestsWithGlobalSetupAndPossiblePause({
|
|
161
|
+
headed: this.computedHeaded,
|
|
162
|
+
locations: ["/" + escapeRegExp(seedFile) + "/"],
|
|
163
|
+
projects: [projectName],
|
|
164
|
+
timeout: 0,
|
|
165
|
+
workers: 1,
|
|
166
|
+
pauseAtEnd: true,
|
|
167
|
+
disableConfigReporters: true,
|
|
168
|
+
failOnLoadErrors: true
|
|
169
|
+
}, signal);
|
|
170
|
+
if (result.status === "passed")
|
|
171
|
+
result.output += "\nError: seed test not found.";
|
|
172
|
+
else if (result.status !== "paused")
|
|
173
|
+
result.output += "\nError while running the seed test.";
|
|
174
|
+
return result;
|
|
175
|
+
}
|
|
176
|
+
async runTestsWithGlobalSetupAndPossiblePause(params, signal) {
|
|
177
|
+
return this._enqueue(() => this._runTestsImpl(params, signal));
|
|
178
|
+
}
|
|
179
|
+
async _runTestsImpl(params, signal) {
|
|
180
|
+
const configDir = this._configLocation.configDir;
|
|
181
|
+
const testRunnerAndScreen = await this.createTestRunner();
|
|
182
|
+
const { testRunner: runner, screen, claimStdio, releaseStdio } = testRunnerAndScreen;
|
|
183
|
+
claimStdio();
|
|
184
|
+
try {
|
|
185
|
+
const setupReporter = new MCPListReporter({ configDir, screen, includeTestId: true });
|
|
186
|
+
const { status: status2 } = await runner.runGlobalSetup([setupReporter]);
|
|
187
|
+
if (status2 !== "passed")
|
|
188
|
+
return { output: testRunnerAndScreen.output.join("\n"), status: status2 };
|
|
189
|
+
} finally {
|
|
190
|
+
releaseStdio();
|
|
191
|
+
}
|
|
192
|
+
let status = "passed";
|
|
193
|
+
const cleanup = async () => {
|
|
194
|
+
claimStdio();
|
|
195
|
+
try {
|
|
196
|
+
const result = await runner.runGlobalTeardown();
|
|
197
|
+
if (status === "passed")
|
|
198
|
+
status = result.status;
|
|
199
|
+
} finally {
|
|
200
|
+
releaseStdio();
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
const abort = signal ? signalToPromise(signal) : void 0;
|
|
204
|
+
const abortPromise = abort ? abort.promise.then(() => "interrupted") : new Promise(() => {
|
|
205
|
+
});
|
|
206
|
+
try {
|
|
207
|
+
const reporter = new MCPListReporter({ configDir, screen, includeTestId: true });
|
|
208
|
+
status = await Promise.race([
|
|
209
|
+
runner.runTests(reporter, params).then((result) => result.status),
|
|
210
|
+
testRunnerAndScreen.waitForTestPaused().then(() => "paused"),
|
|
211
|
+
abortPromise
|
|
212
|
+
]);
|
|
213
|
+
if (status === "interrupted") {
|
|
214
|
+
await runner.stopTests();
|
|
215
|
+
await cleanup();
|
|
216
|
+
return { output: testRunnerAndScreen.output.join("\n"), status };
|
|
217
|
+
}
|
|
218
|
+
if (status === "paused") {
|
|
219
|
+
const response = await testRunnerAndScreen.sendMessageToPausedTest({ request: { initialize: { clientInfo: this._clientInfo } } });
|
|
220
|
+
if (response.error)
|
|
221
|
+
throw new Error(response.error.message);
|
|
222
|
+
testRunnerAndScreen.output.push(response.response.initialize.pausedMessage);
|
|
223
|
+
return { output: testRunnerAndScreen.output.join("\n"), status };
|
|
224
|
+
}
|
|
225
|
+
} catch (e) {
|
|
226
|
+
status = "failed";
|
|
227
|
+
testRunnerAndScreen.output.push(String(e));
|
|
228
|
+
await cleanup();
|
|
229
|
+
return { output: testRunnerAndScreen.output.join("\n"), status };
|
|
230
|
+
} finally {
|
|
231
|
+
abort?.dispose();
|
|
232
|
+
}
|
|
233
|
+
await cleanup();
|
|
234
|
+
return { output: testRunnerAndScreen.output.join("\n"), status };
|
|
235
|
+
}
|
|
236
|
+
async close() {
|
|
237
|
+
await this._enqueue(() => this._cleanupTestRunner()).catch((e) => debug("pw:mcp:error")(e));
|
|
238
|
+
}
|
|
239
|
+
async sendMessageToPausedTest(request) {
|
|
240
|
+
const sendMessage = this._testRunnerAndScreen?.sendMessageToPausedTest;
|
|
241
|
+
if (!sendMessage)
|
|
242
|
+
throw new Error("Must setup test before interacting with the page");
|
|
243
|
+
const result = await sendMessage({ request });
|
|
244
|
+
if (result.error)
|
|
245
|
+
throw new Error(result.error.message);
|
|
246
|
+
if (typeof request?.callTool?.arguments?.["intent"] === "string") {
|
|
247
|
+
const response = import_coreBundle.tools.parseResponse(result.response.callTool);
|
|
248
|
+
if (response && !response.isError && response.code)
|
|
249
|
+
this.generatorJournal?.logStep(request.callTool.arguments["intent"], response.code);
|
|
250
|
+
}
|
|
251
|
+
return result.response;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
function createScreen() {
|
|
255
|
+
const output = [];
|
|
256
|
+
const stdout = new import_streams.StringWriteStream(output, "stdout");
|
|
257
|
+
const stderr = new import_streams.StringWriteStream(output, "stderr");
|
|
258
|
+
const screen = {
|
|
259
|
+
...import_runner.base.terminalScreen,
|
|
260
|
+
isTTY: false,
|
|
261
|
+
colors: noColors,
|
|
262
|
+
stdout,
|
|
263
|
+
stderr
|
|
264
|
+
};
|
|
265
|
+
const originalStdoutWrite = process.stdout.write;
|
|
266
|
+
const originalStderrWrite = process.stderr.write;
|
|
267
|
+
const claimStdio = () => {
|
|
268
|
+
process.stdout.write = (chunk) => {
|
|
269
|
+
stdout.write(chunk);
|
|
270
|
+
return true;
|
|
271
|
+
};
|
|
272
|
+
process.stderr.write = (chunk) => {
|
|
273
|
+
stderr.write(chunk);
|
|
274
|
+
return true;
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
const releaseStdio = () => {
|
|
278
|
+
process.stdout.write = originalStdoutWrite;
|
|
279
|
+
process.stderr.write = originalStderrWrite;
|
|
280
|
+
};
|
|
281
|
+
return { screen, claimStdio, releaseStdio, output };
|
|
282
|
+
}
|
|
283
|
+
const bestPracticesMarkdown = `
|
|
284
|
+
# Best practices
|
|
285
|
+
- Do not improvise, do not add directives that were not asked for
|
|
286
|
+
- Use clear, descriptive assertions to validate the expected behavior
|
|
287
|
+
- Use reliable locators from this log
|
|
288
|
+
- Use local variables for locators that are used multiple times
|
|
289
|
+
- Use Playwright waiting assertions and best practices from this log
|
|
290
|
+
- NEVER! use page.waitForLoadState()
|
|
291
|
+
- NEVER! use page.waitForNavigation()
|
|
292
|
+
- NEVER! use page.waitForTimeout()
|
|
293
|
+
- NEVER! use page.evaluate()
|
|
294
|
+
`;
|
|
295
|
+
class MCPListReporter extends import_runner.ListReporter {
|
|
296
|
+
async onTestPaused() {
|
|
297
|
+
await new Promise(() => {
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
302
|
+
0 && (module.exports = {
|
|
303
|
+
GeneratorJournal,
|
|
304
|
+
TestContext,
|
|
305
|
+
createScreen
|
|
306
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
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 testTool_exports = {};
|
|
20
|
+
__export(testTool_exports, {
|
|
21
|
+
defineTestTool: () => defineTestTool
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(testTool_exports);
|
|
24
|
+
function defineTestTool(tool) {
|
|
25
|
+
return tool;
|
|
26
|
+
}
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
defineTestTool
|
|
30
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
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 testTools_exports = {};
|
|
20
|
+
__export(testTools_exports, {
|
|
21
|
+
debugTest: () => debugTest,
|
|
22
|
+
listTests: () => listTests,
|
|
23
|
+
runTests: () => runTests
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(testTools_exports);
|
|
26
|
+
var import_runner = require("../../runner");
|
|
27
|
+
var import_testTool = require("./testTool");
|
|
28
|
+
const z = require("playwright-core/lib/utilsBundle").z;
|
|
29
|
+
const listTests = (0, import_testTool.defineTestTool)({
|
|
30
|
+
schema: {
|
|
31
|
+
name: "test_list",
|
|
32
|
+
title: "List tests",
|
|
33
|
+
description: "List tests",
|
|
34
|
+
inputSchema: z.object({}),
|
|
35
|
+
type: "readOnly"
|
|
36
|
+
},
|
|
37
|
+
handle: async (context) => {
|
|
38
|
+
const { testRunner, screen, output } = await context.createTestRunner();
|
|
39
|
+
const reporter = new import_runner.ListModeReporter({ screen, includeTestId: true });
|
|
40
|
+
await testRunner.listTests(reporter, {});
|
|
41
|
+
return { content: output.map((text) => ({ type: "text", text })) };
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
const runTests = (0, import_testTool.defineTestTool)({
|
|
45
|
+
schema: {
|
|
46
|
+
name: "test_run",
|
|
47
|
+
title: "Run tests",
|
|
48
|
+
description: "Run tests",
|
|
49
|
+
inputSchema: z.object({
|
|
50
|
+
locations: z.array(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"'),
|
|
51
|
+
projects: z.array(z.string()).optional().describe('Projects to run, projects from playwright.config.ts, by default runs all projects. Running with "chromium" is a good start')
|
|
52
|
+
}),
|
|
53
|
+
type: "readOnly"
|
|
54
|
+
},
|
|
55
|
+
handle: async (context, params, signal) => {
|
|
56
|
+
const { output } = await context.runTestsWithGlobalSetupAndPossiblePause({
|
|
57
|
+
locations: params.locations ?? [],
|
|
58
|
+
projects: params.projects,
|
|
59
|
+
disableConfigReporters: true
|
|
60
|
+
}, signal);
|
|
61
|
+
return { content: [{ type: "text", text: output }] };
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
const debugTest = (0, import_testTool.defineTestTool)({
|
|
65
|
+
schema: {
|
|
66
|
+
name: "test_debug",
|
|
67
|
+
title: "Debug single test",
|
|
68
|
+
description: "Debug single test",
|
|
69
|
+
inputSchema: z.object({
|
|
70
|
+
test: z.object({
|
|
71
|
+
id: z.string().describe("Test ID to debug."),
|
|
72
|
+
title: z.string().describe("Human readable test title for granting permission to debug the test.")
|
|
73
|
+
})
|
|
74
|
+
}),
|
|
75
|
+
type: "readOnly"
|
|
76
|
+
},
|
|
77
|
+
handle: async (context, params, signal) => {
|
|
78
|
+
const { output, status } = await context.runTestsWithGlobalSetupAndPossiblePause({
|
|
79
|
+
headed: context.computedHeaded,
|
|
80
|
+
locations: [],
|
|
81
|
+
// we can make this faster by passing the test's location, so we don't need to scan all tests to find the ID
|
|
82
|
+
testIds: [params.test.id],
|
|
83
|
+
// For automatic recovery
|
|
84
|
+
timeout: 0,
|
|
85
|
+
workers: 1,
|
|
86
|
+
pauseOnError: true,
|
|
87
|
+
disableConfigReporters: true,
|
|
88
|
+
actionTimeout: 5e3
|
|
89
|
+
}, signal);
|
|
90
|
+
return { content: [{ type: "text", text: output }], isError: status !== "paused" && status !== "passed" };
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
94
|
+
0 && (module.exports = {
|
|
95
|
+
debugTest,
|
|
96
|
+
listTests,
|
|
97
|
+
runTests
|
|
98
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
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 package_exports = {};
|
|
30
|
+
__export(package_exports, {
|
|
31
|
+
libPath: () => libPath,
|
|
32
|
+
packageJSON: () => packageJSON,
|
|
33
|
+
packageRoot: () => packageRoot
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(package_exports);
|
|
36
|
+
var import_path = __toESM(require("path"));
|
|
37
|
+
const packageRoot = import_path.default.join(__dirname, "..");
|
|
38
|
+
const packageJSON = require(import_path.default.join(packageRoot, "package.json"));
|
|
39
|
+
function libPath(...parts) {
|
|
40
|
+
return import_path.default.join(packageRoot, "lib", ...parts);
|
|
41
|
+
}
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
libPath,
|
|
45
|
+
packageJSON,
|
|
46
|
+
packageRoot
|
|
47
|
+
});
|