aws-runtime-bridge 1.9.103 → 1.9.105
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/node_modules/playwright/LICENSE +202 -0
- package/node_modules/playwright/NOTICE +5 -0
- package/node_modules/playwright/README.md +318 -0
- package/node_modules/playwright/ThirdPartyNotices.txt +14 -0
- package/node_modules/playwright/cli.js +19 -0
- package/node_modules/playwright/index.d.ts +17 -0
- package/node_modules/playwright/index.js +17 -0
- package/node_modules/playwright/index.mjs +18 -0
- package/node_modules/playwright/jsx-runtime.js +42 -0
- package/node_modules/playwright/jsx-runtime.mjs +21 -0
- package/node_modules/playwright/lib/agents/agentParser.js +89 -0
- package/node_modules/playwright/lib/agents/copilot-setup-steps.yml +34 -0
- package/node_modules/playwright/lib/agents/generateAgents.js +395 -0
- package/node_modules/playwright/lib/agents/playwright-test-coverage.prompt.md +31 -0
- package/node_modules/playwright/lib/agents/playwright-test-generate.prompt.md +8 -0
- package/node_modules/playwright/lib/agents/playwright-test-generator.agent.md +88 -0
- package/node_modules/playwright/lib/agents/playwright-test-heal.prompt.md +6 -0
- package/node_modules/playwright/lib/agents/playwright-test-healer.agent.md +56 -0
- package/node_modules/playwright/lib/agents/playwright-test-plan.prompt.md +9 -0
- package/node_modules/playwright/lib/agents/playwright-test-planner.agent.md +74 -0
- package/node_modules/playwright/lib/cli/reportActions.js +78 -0
- package/node_modules/playwright/lib/cli/testActions.js +213 -0
- package/node_modules/playwright/lib/common/index.js +2957 -0
- package/node_modules/playwright/lib/common/index.js.txt +34 -0
- package/node_modules/playwright/lib/errorContext.js +129 -0
- package/node_modules/playwright/lib/globals.js +58 -0
- package/node_modules/playwright/lib/index.js +806 -0
- package/node_modules/playwright/lib/isomorphic.js +260 -0
- package/node_modules/playwright/lib/isomorphic.js.txt +9 -0
- package/node_modules/playwright/lib/loader/loaderProcessEntry.js +34 -0
- package/node_modules/playwright/lib/loader/loaderProcessEntry.js.txt +9 -0
- package/node_modules/playwright/lib/matchers/expect.js +13486 -0
- package/node_modules/playwright/lib/matchers/expect.js.LICENSE +640 -0
- package/node_modules/playwright/lib/matchers/expect.js.txt +67 -0
- package/node_modules/playwright/lib/mcp/test/browserBackend.js +125 -0
- package/node_modules/playwright/lib/mcp/test/generatorTools.js +122 -0
- package/node_modules/playwright/lib/mcp/test/plannerTools.js +150 -0
- package/node_modules/playwright/lib/mcp/test/seed.js +82 -0
- package/node_modules/playwright/lib/mcp/test/streams.js +44 -0
- package/node_modules/playwright/lib/mcp/test/testBackend.js +99 -0
- package/node_modules/playwright/lib/mcp/test/testContext.js +306 -0
- package/node_modules/playwright/lib/mcp/test/testTool.js +30 -0
- package/node_modules/playwright/lib/mcp/test/testTools.js +98 -0
- package/node_modules/playwright/lib/package.js +47 -0
- package/node_modules/playwright/lib/program.js +242 -0
- package/node_modules/playwright/lib/runner/index.js +8241 -0
- package/node_modules/playwright/lib/runner/index.js.txt +60 -0
- package/node_modules/playwright/lib/transform/babelBundle.js +72275 -0
- package/node_modules/playwright/lib/transform/babelBundle.js.LICENSE +2384 -0
- package/node_modules/playwright/lib/transform/babelBundle.js.txt +325 -0
- package/node_modules/playwright/lib/transform/esmLoader.js +8078 -0
- package/node_modules/playwright/lib/transform/esmLoader.js.LICENSE +355 -0
- package/node_modules/playwright/lib/transform/esmLoader.js.txt +60 -0
- package/node_modules/playwright/lib/util.js +373 -0
- package/node_modules/playwright/lib/worker/workerProcessEntry.js +1850 -0
- package/node_modules/playwright/lib/worker/workerProcessEntry.js.txt +19 -0
- package/node_modules/playwright/package.json +55 -0
- package/node_modules/playwright/test.d.ts +18 -0
- package/node_modules/playwright/test.js +24 -0
- package/node_modules/playwright/test.mjs +35 -0
- package/node_modules/playwright/types/test.d.ts +10848 -0
- package/node_modules/playwright/types/testReporter.d.ts +899 -0
- package/node_modules/playwright-core/LICENSE +202 -0
- package/node_modules/playwright-core/NOTICE +5 -0
- package/node_modules/playwright-core/README.md +3 -0
- package/node_modules/playwright-core/ThirdPartyNotices.txt +13 -0
- package/node_modules/playwright-core/bin/install_media_pack.ps1 +5 -0
- package/node_modules/playwright-core/bin/install_webkit_wsl.ps1 +33 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_beta_linux.sh +42 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_beta_mac.sh +13 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_beta_win.ps1 +24 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_stable_linux.sh +42 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_stable_mac.sh +12 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_stable_win.ps1 +24 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_beta_linux.sh +48 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_beta_mac.sh +11 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_beta_win.ps1 +23 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_dev_linux.sh +48 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_dev_mac.sh +11 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_dev_win.ps1 +23 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_stable_linux.sh +48 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_stable_mac.sh +11 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_stable_win.ps1 +24 -0
- package/node_modules/playwright-core/browsers.json +75 -0
- package/node_modules/playwright-core/cli.js +21 -0
- package/node_modules/playwright-core/index.d.ts +17 -0
- package/node_modules/playwright-core/index.js +17 -0
- package/node_modules/playwright-core/index.mjs +28 -0
- package/node_modules/playwright-core/lib/bootstrap.js +88 -0
- package/node_modules/playwright-core/lib/coreBundle.js +74830 -0
- package/node_modules/playwright-core/lib/entry/cliDaemon.js +5 -0
- package/node_modules/playwright-core/lib/entry/dashboardApp.js +3 -0
- package/node_modules/playwright-core/lib/entry/mcp.js +10 -0
- package/node_modules/playwright-core/lib/entry/oopBrowserDownload.js +3 -0
- package/node_modules/playwright-core/lib/package.js +50 -0
- package/node_modules/playwright-core/lib/server/chromium/appIcon.png +0 -0
- package/node_modules/playwright-core/lib/server/electron/loader.js +118 -0
- package/node_modules/playwright-core/lib/serverRegistry.js +7347 -0
- package/node_modules/playwright-core/lib/serverRegistry.js.LICENSE +354 -0
- package/node_modules/playwright-core/lib/tools/cli-client/channelSessions.js +141 -0
- package/node_modules/playwright-core/lib/tools/cli-client/cli.js +6 -0
- package/node_modules/playwright-core/lib/tools/cli-client/help.json +708 -0
- package/node_modules/playwright-core/lib/tools/cli-client/minimist.js +128 -0
- package/node_modules/playwright-core/lib/tools/cli-client/output.js +343 -0
- package/node_modules/playwright-core/lib/tools/cli-client/program.js +404 -0
- package/node_modules/playwright-core/lib/tools/cli-client/registry.js +176 -0
- package/node_modules/playwright-core/lib/tools/cli-client/session.js +258 -0
- package/node_modules/playwright-core/lib/tools/dashboard/appIcon.png +0 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/SKILL.md +420 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/element-attributes.md +23 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/request-mocking.md +87 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/running-code.md +241 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/session-management.md +225 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/storage-state.md +275 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/test-generation.md +433 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/tracing.md +139 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/video-recording.md +143 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/SKILL.md +143 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/gallery-spec.md +144 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/migration.md +85 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/react.md +67 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/vue.md +75 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-trace/SKILL.md +171 -0
- package/node_modules/playwright-core/lib/tools/utils/extension.js +101 -0
- package/node_modules/playwright-core/lib/tools/utils/socketConnection.js +108 -0
- package/node_modules/playwright-core/lib/utilsBundle.js +90764 -0
- package/node_modules/playwright-core/lib/utilsBundle.js.LICENSE +2179 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/codicon-DCmgc-ay.ttf +0 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-1bWoP6pv.svg +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-beta-k3eOH_eK.svg +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-nightly-Cp5nfeDT.svg +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-CyWAfh-p.js +11 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-DhC616m4.css +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/safari-na3_-uQk.svg +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/index.html +29 -0
- package/node_modules/playwright-core/lib/vite/dashboard/playwright-logo.svg +24 -0
- package/node_modules/playwright-core/lib/vite/htmlReport/index.html +16 -0
- package/node_modules/playwright-core/lib/vite/htmlReport/report.css +2 -0
- package/node_modules/playwright-core/lib/vite/htmlReport/report.js +32 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule--QdMvsKi.css +1 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-CwYYHbcZ.js +32 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-DYjdXIbE.js +129 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-l_lX622x.css +1 -0
- package/node_modules/playwright-core/lib/vite/recorder/index.html +29 -0
- package/node_modules/playwright-core/lib/vite/recorder/playwright-logo.svg +9 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/codeMirrorModule-By56iMx7.js +32 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-B34OrIms.js +181 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/urlMatch-L3liM589.js +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/xtermModule-COQkjINf.js +7 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.-QdMvsKi.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/defaultSettingsView.BLFoOugd.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.B_TqY17P.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.Dl36UVQT.js +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.html +44 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/manifest.webmanifest +16 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/playwright-logo.svg +9 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/snapshot.B_Jk1wbt.js +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/snapshot.html +10 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/sw.bundle.js +4 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.C7UW1sC9.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.D962mr9b.js +5 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +18 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.kHJ-D0s7.css +1 -0
- package/node_modules/playwright-core/lib/webp_codec.LICENSE +173 -0
- package/node_modules/playwright-core/lib/webp_codec.wasm +0 -0
- package/node_modules/playwright-core/lib/xdg-open +1267 -0
- package/node_modules/playwright-core/package.json +34 -0
- package/node_modules/playwright-core/types/protocol.d.ts +24842 -0
- package/node_modules/playwright-core/types/structs.d.ts +47 -0
- package/node_modules/playwright-core/types/types.d.ts +26188 -0
- package/package.json +3 -2
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import jsxRuntime from './jsx-runtime.js';
|
|
18
|
+
|
|
19
|
+
export const jsx = jsxRuntime.jsx;
|
|
20
|
+
export const jsxs = jsxRuntime.jsxs;
|
|
21
|
+
export const Fragment = jsxRuntime.Fragment;
|
|
@@ -0,0 +1,89 @@
|
|
|
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 agentParser_exports = {};
|
|
30
|
+
__export(agentParser_exports, {
|
|
31
|
+
parseAgentSpec: () => parseAgentSpec
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(agentParser_exports);
|
|
34
|
+
var import_fs = __toESM(require("fs"));
|
|
35
|
+
const yaml = require("playwright-core/lib/utilsBundle").yaml;
|
|
36
|
+
async function parseAgentSpec(filePath) {
|
|
37
|
+
const source = await import_fs.default.promises.readFile(filePath, "utf-8");
|
|
38
|
+
const { header, content } = extractYamlAndContent(source);
|
|
39
|
+
const { instructions, examples } = extractInstructionsAndExamples(content);
|
|
40
|
+
return {
|
|
41
|
+
...header,
|
|
42
|
+
instructions,
|
|
43
|
+
examples
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function extractYamlAndContent(markdown) {
|
|
47
|
+
const lines = markdown.split("\n");
|
|
48
|
+
if (lines[0] !== "---")
|
|
49
|
+
throw new Error("Markdown file must start with YAML front matter (---)");
|
|
50
|
+
let yamlEndIndex = -1;
|
|
51
|
+
for (let i = 1; i < lines.length; i++) {
|
|
52
|
+
if (lines[i] === "---") {
|
|
53
|
+
yamlEndIndex = i;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (yamlEndIndex === -1)
|
|
58
|
+
throw new Error("YAML front matter must be closed with ---");
|
|
59
|
+
const yamlLines = lines.slice(1, yamlEndIndex);
|
|
60
|
+
const yamlRaw = yamlLines.join("\n");
|
|
61
|
+
const contentLines = lines.slice(yamlEndIndex + 1);
|
|
62
|
+
const content = contentLines.join("\n");
|
|
63
|
+
let header;
|
|
64
|
+
try {
|
|
65
|
+
header = yaml.parse(yamlRaw);
|
|
66
|
+
} catch (error) {
|
|
67
|
+
throw new Error(`Failed to parse YAML header: ${error.message}`);
|
|
68
|
+
}
|
|
69
|
+
if (!header.name)
|
|
70
|
+
throw new Error('YAML header must contain a "name" field');
|
|
71
|
+
if (!header.description)
|
|
72
|
+
throw new Error('YAML header must contain a "description" field');
|
|
73
|
+
return { header, content };
|
|
74
|
+
}
|
|
75
|
+
function extractInstructionsAndExamples(content) {
|
|
76
|
+
const examples = [];
|
|
77
|
+
const instructions = content.split("<example>")[0].trim();
|
|
78
|
+
const exampleRegex = /<example>([\s\S]*?)<\/example>/g;
|
|
79
|
+
let match;
|
|
80
|
+
while ((match = exampleRegex.exec(content)) !== null) {
|
|
81
|
+
const example = match[1].trim();
|
|
82
|
+
examples.push(example.replace(/[\n]/g, " ").replace(/ +/g, " "));
|
|
83
|
+
}
|
|
84
|
+
return { instructions, examples };
|
|
85
|
+
}
|
|
86
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
87
|
+
0 && (module.exports = {
|
|
88
|
+
parseAgentSpec
|
|
89
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: "Copilot Setup Steps"
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
push:
|
|
6
|
+
paths:
|
|
7
|
+
- .github/workflows/copilot-setup-steps.yml
|
|
8
|
+
pull_request:
|
|
9
|
+
paths:
|
|
10
|
+
- .github/workflows/copilot-setup-steps.yml
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
copilot-setup-steps:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v6
|
|
21
|
+
|
|
22
|
+
- uses: actions/setup-node@v6
|
|
23
|
+
with:
|
|
24
|
+
node-version: lts/*
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: npm ci
|
|
28
|
+
|
|
29
|
+
- name: Install Playwright Browsers
|
|
30
|
+
run: npx playwright install --with-deps
|
|
31
|
+
|
|
32
|
+
# Customize this step as needed
|
|
33
|
+
- name: Build application
|
|
34
|
+
run: npx run build
|
|
@@ -0,0 +1,395 @@
|
|
|
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 generateAgents_exports = {};
|
|
30
|
+
__export(generateAgents_exports, {
|
|
31
|
+
ClaudeGenerator: () => ClaudeGenerator,
|
|
32
|
+
CodexGenerator: () => CodexGenerator,
|
|
33
|
+
CopilotGenerator: () => CopilotGenerator,
|
|
34
|
+
OpencodeGenerator: () => OpencodeGenerator,
|
|
35
|
+
VSCodeGenerator: () => VSCodeGenerator
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(generateAgents_exports);
|
|
38
|
+
var import_fs = __toESM(require("fs"));
|
|
39
|
+
var import_path = __toESM(require("path"));
|
|
40
|
+
var import_seed = require("../mcp/test/seed");
|
|
41
|
+
var import_agentParser = require("./agentParser");
|
|
42
|
+
const colors = require("playwright-core/lib/utilsBundle").colors;
|
|
43
|
+
const yaml = require("playwright-core/lib/utilsBundle").yaml;
|
|
44
|
+
const { tomlArray, tomlBasicString, tomlMultilineBasicString } = require("playwright-core/lib/coreBundle").iso;
|
|
45
|
+
const { mkdirIfNeeded } = require("playwright-core/lib/coreBundle").utils;
|
|
46
|
+
async function loadAgentSpecs() {
|
|
47
|
+
const files = await import_fs.default.promises.readdir(__dirname);
|
|
48
|
+
return Promise.all(files.filter((file) => file.endsWith(".agent.md")).map((file) => (0, import_agentParser.parseAgentSpec)(import_path.default.join(__dirname, file))));
|
|
49
|
+
}
|
|
50
|
+
class ClaudeGenerator {
|
|
51
|
+
static async init(fullConfig, projectName, prompts) {
|
|
52
|
+
await initRepo(fullConfig, projectName, {
|
|
53
|
+
promptsFolder: prompts ? ".claude/prompts" : void 0
|
|
54
|
+
});
|
|
55
|
+
const agents = await loadAgentSpecs();
|
|
56
|
+
await import_fs.default.promises.mkdir(".claude/agents", { recursive: true });
|
|
57
|
+
for (const agent of agents)
|
|
58
|
+
await writeFile(`.claude/agents/${agent.name}.md`, ClaudeGenerator.agentSpec(agent), "\u{1F916}", "agent definition");
|
|
59
|
+
const mcpServer = process.platform === "win32" ? { command: "cmd", args: ["/c", "npx", "playwright", "run-test-mcp-server"] } : { command: "npx", args: ["playwright", "run-test-mcp-server"] };
|
|
60
|
+
await writeFile(".mcp.json", JSON.stringify({
|
|
61
|
+
mcpServers: {
|
|
62
|
+
"playwright-test": mcpServer
|
|
63
|
+
}
|
|
64
|
+
}, null, 2), "\u{1F527}", "mcp configuration");
|
|
65
|
+
initRepoDone();
|
|
66
|
+
}
|
|
67
|
+
static agentSpec(agent) {
|
|
68
|
+
const claudeToolMap = /* @__PURE__ */ new Map([
|
|
69
|
+
["search", ["Glob", "Grep", "Read", "LS"]],
|
|
70
|
+
["edit", ["Edit", "MultiEdit", "Write"]]
|
|
71
|
+
]);
|
|
72
|
+
function asClaudeTool(tool) {
|
|
73
|
+
const [first, second] = tool.split("/");
|
|
74
|
+
if (!second)
|
|
75
|
+
return (claudeToolMap.get(first) || [first]).join(", ");
|
|
76
|
+
return `mcp__${first}__${second}`;
|
|
77
|
+
}
|
|
78
|
+
const examples = agent.examples.length ? ` Examples: ${agent.examples.map((example) => `<example>${example}</example>`).join("")}` : "";
|
|
79
|
+
const lines = [];
|
|
80
|
+
const header = {
|
|
81
|
+
name: agent.name,
|
|
82
|
+
description: agent.description + examples,
|
|
83
|
+
tools: agent.tools.map((tool) => asClaudeTool(tool)).join(", "),
|
|
84
|
+
model: agent.model,
|
|
85
|
+
color: agent.color
|
|
86
|
+
};
|
|
87
|
+
lines.push(`---`);
|
|
88
|
+
lines.push(yaml.stringify(header, { lineWidth: 1e5 }) + `---`);
|
|
89
|
+
lines.push("");
|
|
90
|
+
lines.push(agent.instructions);
|
|
91
|
+
return lines.join("\n");
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
class CodexGenerator {
|
|
95
|
+
static async init(fullConfig, projectName, prompts) {
|
|
96
|
+
await initRepo(fullConfig, projectName, {
|
|
97
|
+
promptsFolder: prompts ? ".codex/prompts" : void 0
|
|
98
|
+
});
|
|
99
|
+
const agents = await loadAgentSpecs();
|
|
100
|
+
await import_fs.default.promises.mkdir(".codex/agents", { recursive: true });
|
|
101
|
+
for (const agent of agents)
|
|
102
|
+
await writeFile(`.codex/agents/${CodexGenerator.codexName(agent)}.toml`, CodexGenerator.agentSpec(agent), "\u{1F916}", "agent definition");
|
|
103
|
+
initRepoDone();
|
|
104
|
+
}
|
|
105
|
+
// Codex's subagent registry rejects hyphenated identifiers at spawn time with
|
|
106
|
+
// `error=unknown agent_type '<name>'`. Codex's own documentation only shows
|
|
107
|
+
// snake_case names (`pr_explorer`, `reviewer`, `docs_researcher`, ...), see
|
|
108
|
+
// https://developers.openai.com/codex/subagents. Translate the shared agent
|
|
109
|
+
// name into snake_case so the filename and the `name` field stay in sync.
|
|
110
|
+
static codexName(agent) {
|
|
111
|
+
return agent.name.replace(/-/g, "_");
|
|
112
|
+
}
|
|
113
|
+
static agentSpec(agent) {
|
|
114
|
+
const mcpName = "playwright-test";
|
|
115
|
+
const enabledTools = [];
|
|
116
|
+
for (const tool of agent.tools) {
|
|
117
|
+
const [first, second] = tool.split("/");
|
|
118
|
+
if (second && first === mcpName)
|
|
119
|
+
enabledTools.push(second);
|
|
120
|
+
}
|
|
121
|
+
const sandboxMode = agent.tools.includes("edit") ? "workspace-write" : "read-only";
|
|
122
|
+
const mcpServer = process.platform === "win32" ? { command: "cmd", args: ["/c", "npx", "playwright", "run-test-mcp-server"] } : { command: "npx", args: ["playwright", "run-test-mcp-server"] };
|
|
123
|
+
const examples = agent.examples.length ? ` Examples: ${agent.examples.map((example) => `<example>${example}</example>`).join("")}` : "";
|
|
124
|
+
const lines = [];
|
|
125
|
+
lines.push(`name = ${tomlBasicString(CodexGenerator.codexName(agent))}`);
|
|
126
|
+
lines.push(`description = ${tomlBasicString(agent.description + examples)}`);
|
|
127
|
+
lines.push(`sandbox_mode = ${tomlBasicString(sandboxMode)}`);
|
|
128
|
+
lines.push(`developer_instructions = ${tomlMultilineBasicString(agent.instructions)}`);
|
|
129
|
+
lines.push("");
|
|
130
|
+
lines.push(`[mcp_servers.${mcpName}]`);
|
|
131
|
+
lines.push(`command = ${tomlBasicString(mcpServer.command)}`);
|
|
132
|
+
lines.push(`args = ${tomlArray(mcpServer.args)}`);
|
|
133
|
+
if (enabledTools.length)
|
|
134
|
+
lines.push(`enabled_tools = ${tomlArray(enabledTools)}`);
|
|
135
|
+
lines.push("");
|
|
136
|
+
return lines.join("\n");
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
class OpencodeGenerator {
|
|
140
|
+
static async init(fullConfig, projectName, prompts) {
|
|
141
|
+
await initRepo(fullConfig, projectName, {
|
|
142
|
+
defaultAgentName: "Build",
|
|
143
|
+
promptsFolder: prompts ? ".opencode/prompts" : void 0
|
|
144
|
+
});
|
|
145
|
+
const agents = await loadAgentSpecs();
|
|
146
|
+
for (const agent of agents) {
|
|
147
|
+
const prompt = [agent.instructions];
|
|
148
|
+
prompt.push("");
|
|
149
|
+
prompt.push(...agent.examples.map((example) => `<example>${example}</example>`));
|
|
150
|
+
await writeFile(`.opencode/prompts/${agent.name}.md`, prompt.join("\n"), "\u{1F916}", "agent definition");
|
|
151
|
+
}
|
|
152
|
+
await writeFile("opencode.json", OpencodeGenerator.configuration(agents), "\u{1F527}", "opencode configuration");
|
|
153
|
+
initRepoDone();
|
|
154
|
+
}
|
|
155
|
+
static configuration(agents) {
|
|
156
|
+
const opencodeToolMap = /* @__PURE__ */ new Map([
|
|
157
|
+
["search", ["ls", "glob", "grep", "read"]],
|
|
158
|
+
["edit", ["edit", "write"]]
|
|
159
|
+
]);
|
|
160
|
+
const asOpencodeTool = (tools, tool) => {
|
|
161
|
+
const [first, second] = tool.split("/");
|
|
162
|
+
if (!second) {
|
|
163
|
+
for (const tool2 of opencodeToolMap.get(first) || [first])
|
|
164
|
+
tools[tool2] = true;
|
|
165
|
+
} else {
|
|
166
|
+
tools[`${first}*${second}`] = true;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
const result = {};
|
|
170
|
+
result["$schema"] = "https://opencode.ai/config.json";
|
|
171
|
+
result["mcp"] = {};
|
|
172
|
+
result["tools"] = {
|
|
173
|
+
"playwright*": false
|
|
174
|
+
};
|
|
175
|
+
result["agent"] = {};
|
|
176
|
+
for (const agent of agents) {
|
|
177
|
+
const tools = {};
|
|
178
|
+
result["agent"][agent.name] = {
|
|
179
|
+
description: agent.description,
|
|
180
|
+
mode: "subagent",
|
|
181
|
+
prompt: `{file:.opencode/prompts/${agent.name}.md}`,
|
|
182
|
+
tools
|
|
183
|
+
};
|
|
184
|
+
for (const tool of agent.tools)
|
|
185
|
+
asOpencodeTool(tools, tool);
|
|
186
|
+
}
|
|
187
|
+
result["mcp"]["playwright-test"] = {
|
|
188
|
+
type: "local",
|
|
189
|
+
command: ["npx", "playwright", "run-test-mcp-server"],
|
|
190
|
+
enabled: true
|
|
191
|
+
};
|
|
192
|
+
return JSON.stringify(result, null, 2);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
class CopilotGenerator {
|
|
196
|
+
static async init(fullConfig, projectName, prompts) {
|
|
197
|
+
await initRepo(fullConfig, projectName, {
|
|
198
|
+
defaultAgentName: "agent",
|
|
199
|
+
promptsFolder: prompts ? ".github/prompts" : void 0,
|
|
200
|
+
promptSuffix: "prompt"
|
|
201
|
+
});
|
|
202
|
+
const agents = await loadAgentSpecs();
|
|
203
|
+
await import_fs.default.promises.mkdir(".github/agents", { recursive: true });
|
|
204
|
+
for (const agent of agents)
|
|
205
|
+
await writeFile(`.github/agents/${agent.name}.agent.md`, CopilotGenerator.agentSpec(agent), "\u{1F916}", "agent definition");
|
|
206
|
+
await deleteFile(`.github/chatmodes/ \u{1F3AD} planner.chatmode.md`, "legacy planner chatmode");
|
|
207
|
+
await deleteFile(`.github/chatmodes/\u{1F3AD} generator.chatmode.md`, "legacy generator chatmode");
|
|
208
|
+
await deleteFile(`.github/chatmodes/\u{1F3AD} healer.chatmode.md`, "legacy healer chatmode");
|
|
209
|
+
await deleteFile(`.github/agents/ \u{1F3AD} planner.agent.md`, "legacy planner agent");
|
|
210
|
+
await deleteFile(`.github/agents/\u{1F3AD} generator.agent.md`, "legacy generator agent");
|
|
211
|
+
await deleteFile(`.github/agents/\u{1F3AD} healer.agent.md`, "legacy healer agent");
|
|
212
|
+
await VSCodeGenerator.appendToMCPJson();
|
|
213
|
+
const mcpConfig = { mcpServers: CopilotGenerator.mcpServers };
|
|
214
|
+
if (!import_fs.default.existsSync(".github/copilot-setup-steps.yml")) {
|
|
215
|
+
const yaml2 = import_fs.default.readFileSync(import_path.default.join(__dirname, "copilot-setup-steps.yml"), "utf-8");
|
|
216
|
+
await writeFile(".github/workflows/copilot-setup-steps.yml", yaml2, "\u{1F527}", "GitHub Copilot setup steps");
|
|
217
|
+
}
|
|
218
|
+
console.log("");
|
|
219
|
+
console.log("");
|
|
220
|
+
console.log(" \u{1F527} TODO: GitHub > Settings > Copilot > Coding agent > MCP configuration");
|
|
221
|
+
console.log("------------------------------------------------------------------");
|
|
222
|
+
console.log(JSON.stringify(mcpConfig, null, 2));
|
|
223
|
+
console.log("------------------------------------------------------------------");
|
|
224
|
+
initRepoDone();
|
|
225
|
+
}
|
|
226
|
+
static agentSpec(agent) {
|
|
227
|
+
const examples = agent.examples.length ? ` Examples: ${agent.examples.map((example) => `<example>${example}</example>`).join("")}` : "";
|
|
228
|
+
const lines = [];
|
|
229
|
+
const header = {
|
|
230
|
+
"name": agent.name,
|
|
231
|
+
"description": agent.description + examples,
|
|
232
|
+
"tools": agent.tools,
|
|
233
|
+
"model": "Claude Sonnet 4.6",
|
|
234
|
+
"mcp-servers": CopilotGenerator.mcpServers
|
|
235
|
+
};
|
|
236
|
+
lines.push(`---`);
|
|
237
|
+
lines.push(yaml.stringify(header, { lineWidth: 1e5 }) + `---`);
|
|
238
|
+
lines.push("");
|
|
239
|
+
lines.push(agent.instructions);
|
|
240
|
+
lines.push("");
|
|
241
|
+
return lines.join("\n");
|
|
242
|
+
}
|
|
243
|
+
static {
|
|
244
|
+
this.mcpServers = {
|
|
245
|
+
"playwright-test": {
|
|
246
|
+
"type": "stdio",
|
|
247
|
+
"command": "npx",
|
|
248
|
+
"args": [
|
|
249
|
+
"playwright",
|
|
250
|
+
"run-test-mcp-server"
|
|
251
|
+
],
|
|
252
|
+
"tools": ["*"]
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
class VSCodeGenerator {
|
|
258
|
+
static async init(fullConfig, projectName) {
|
|
259
|
+
await initRepo(fullConfig, projectName, {
|
|
260
|
+
promptsFolder: void 0
|
|
261
|
+
});
|
|
262
|
+
const agents = await loadAgentSpecs();
|
|
263
|
+
const nameMap = /* @__PURE__ */ new Map([
|
|
264
|
+
["playwright-test-planner", " \u{1F3AD} planner"],
|
|
265
|
+
["playwright-test-generator", "\u{1F3AD} generator"],
|
|
266
|
+
["playwright-test-healer", "\u{1F3AD} healer"]
|
|
267
|
+
]);
|
|
268
|
+
await import_fs.default.promises.mkdir(".github/chatmodes", { recursive: true });
|
|
269
|
+
for (const agent of agents)
|
|
270
|
+
await writeFile(`.github/chatmodes/${nameMap.get(agent.name)}.chatmode.md`, VSCodeGenerator.agentSpec(agent), "\u{1F916}", "chatmode definition");
|
|
271
|
+
await VSCodeGenerator.appendToMCPJson();
|
|
272
|
+
initRepoDone();
|
|
273
|
+
}
|
|
274
|
+
static async appendToMCPJson() {
|
|
275
|
+
await import_fs.default.promises.mkdir(".vscode", { recursive: true });
|
|
276
|
+
const mcpJsonPath = ".vscode/mcp.json";
|
|
277
|
+
let mcpJson = {
|
|
278
|
+
servers: {},
|
|
279
|
+
inputs: []
|
|
280
|
+
};
|
|
281
|
+
try {
|
|
282
|
+
mcpJson = JSON.parse(import_fs.default.readFileSync(mcpJsonPath, "utf8"));
|
|
283
|
+
} catch {
|
|
284
|
+
}
|
|
285
|
+
if (!mcpJson.servers)
|
|
286
|
+
mcpJson.servers = {};
|
|
287
|
+
mcpJson.servers["playwright-test"] = {
|
|
288
|
+
type: "stdio",
|
|
289
|
+
command: "npx",
|
|
290
|
+
args: ["playwright", "run-test-mcp-server"]
|
|
291
|
+
};
|
|
292
|
+
await writeFile(mcpJsonPath, JSON.stringify(mcpJson, null, 2), "\u{1F527}", "mcp configuration");
|
|
293
|
+
}
|
|
294
|
+
static agentSpec(agent) {
|
|
295
|
+
const vscodeToolMap = /* @__PURE__ */ new Map([
|
|
296
|
+
["search", ["search/listDirectory", "search/fileSearch", "search/textSearch"]],
|
|
297
|
+
["read", ["search/readFile"]],
|
|
298
|
+
["edit", ["edit/editFiles"]],
|
|
299
|
+
["write", ["edit/createFile", "edit/createDirectory"]]
|
|
300
|
+
]);
|
|
301
|
+
const vscodeToolsOrder = ["edit/createFile", "edit/createDirectory", "edit/editFiles", "search/fileSearch", "search/textSearch", "search/listDirectory", "search/readFile"];
|
|
302
|
+
const vscodeMcpName = "playwright-test";
|
|
303
|
+
function asVscodeTool(tool) {
|
|
304
|
+
const [first, second] = tool.split("/");
|
|
305
|
+
if (second)
|
|
306
|
+
return `${vscodeMcpName}/${second}`;
|
|
307
|
+
return vscodeToolMap.get(first) || first;
|
|
308
|
+
}
|
|
309
|
+
const tools = agent.tools.map(asVscodeTool).flat().sort((a, b) => {
|
|
310
|
+
const indexA = vscodeToolsOrder.indexOf(a);
|
|
311
|
+
const indexB = vscodeToolsOrder.indexOf(b);
|
|
312
|
+
if (indexA === -1 && indexB === -1)
|
|
313
|
+
return a.localeCompare(b);
|
|
314
|
+
if (indexA === -1)
|
|
315
|
+
return 1;
|
|
316
|
+
if (indexB === -1)
|
|
317
|
+
return -1;
|
|
318
|
+
return indexA - indexB;
|
|
319
|
+
}).map((tool) => `'${tool}'`).join(", ");
|
|
320
|
+
const lines = [];
|
|
321
|
+
lines.push(`---`);
|
|
322
|
+
lines.push(`description: ${agent.description}.`);
|
|
323
|
+
lines.push(`tools: [${tools}]`);
|
|
324
|
+
lines.push(`---`);
|
|
325
|
+
lines.push("");
|
|
326
|
+
lines.push(agent.instructions);
|
|
327
|
+
for (const example of agent.examples)
|
|
328
|
+
lines.push(`<example>${example}</example>`);
|
|
329
|
+
lines.push("");
|
|
330
|
+
return lines.join("\n");
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
async function writeFile(filePath, content, icon, description) {
|
|
334
|
+
console.log(` ${icon} ${import_path.default.relative(process.cwd(), filePath)} ${colors.dim("- " + description)}`);
|
|
335
|
+
await mkdirIfNeeded(filePath);
|
|
336
|
+
await import_fs.default.promises.writeFile(filePath, content, "utf-8");
|
|
337
|
+
}
|
|
338
|
+
async function deleteFile(filePath, description) {
|
|
339
|
+
try {
|
|
340
|
+
if (!import_fs.default.existsSync(filePath))
|
|
341
|
+
return;
|
|
342
|
+
} catch {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
console.log(` \u2702\uFE0F ${import_path.default.relative(process.cwd(), filePath)} ${colors.dim("- " + description)}`);
|
|
346
|
+
await import_fs.default.promises.unlink(filePath);
|
|
347
|
+
}
|
|
348
|
+
async function initRepo(fullConfig, projectName, options) {
|
|
349
|
+
const project = (0, import_seed.seedProject)(fullConfig, projectName);
|
|
350
|
+
console.log(` \u{1F3AD} Using project "${project.project.name}" as a primary project`);
|
|
351
|
+
if (!import_fs.default.existsSync("specs")) {
|
|
352
|
+
await import_fs.default.promises.mkdir("specs");
|
|
353
|
+
await writeFile(import_path.default.join("specs", "README.md"), `# Specs
|
|
354
|
+
|
|
355
|
+
This is a directory for test plans.
|
|
356
|
+
`, "\u{1F4DD}", "directory for test plans");
|
|
357
|
+
}
|
|
358
|
+
let seedFile = await (0, import_seed.findSeedFile)(project);
|
|
359
|
+
if (!seedFile) {
|
|
360
|
+
seedFile = (0, import_seed.defaultSeedFile)(project);
|
|
361
|
+
await writeFile(seedFile, import_seed.seedFileContent, "\u{1F331}", "default environment seed file");
|
|
362
|
+
}
|
|
363
|
+
if (options.promptsFolder) {
|
|
364
|
+
await import_fs.default.promises.mkdir(options.promptsFolder, { recursive: true });
|
|
365
|
+
for (const promptFile of await import_fs.default.promises.readdir(__dirname)) {
|
|
366
|
+
if (!promptFile.endsWith(".prompt.md"))
|
|
367
|
+
continue;
|
|
368
|
+
const shortName = promptFile.replace(".prompt.md", "");
|
|
369
|
+
const fileName = options.promptSuffix ? `${shortName}.${options.promptSuffix}.md` : `${shortName}.md`;
|
|
370
|
+
const content = await loadPrompt(promptFile, {
|
|
371
|
+
defaultAgentName: "default",
|
|
372
|
+
...options,
|
|
373
|
+
seedFile: import_path.default.relative(process.cwd(), seedFile)
|
|
374
|
+
});
|
|
375
|
+
await writeFile(import_path.default.join(options.promptsFolder, fileName), content, "\u{1F4DD}", "prompt template");
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
function initRepoDone() {
|
|
380
|
+
console.log(" \u2705 Done.");
|
|
381
|
+
}
|
|
382
|
+
async function loadPrompt(file, params) {
|
|
383
|
+
const content = await import_fs.default.promises.readFile(import_path.default.join(__dirname, file), "utf-8");
|
|
384
|
+
return Object.entries(params).reduce((acc, [key, value]) => {
|
|
385
|
+
return acc.replace(new RegExp(`\\\${${key}}`, "g"), value);
|
|
386
|
+
}, content);
|
|
387
|
+
}
|
|
388
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
389
|
+
0 && (module.exports = {
|
|
390
|
+
ClaudeGenerator,
|
|
391
|
+
CodexGenerator,
|
|
392
|
+
CopilotGenerator,
|
|
393
|
+
OpencodeGenerator,
|
|
394
|
+
VSCodeGenerator
|
|
395
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
agent: ${defaultAgentName}
|
|
3
|
+
description: Produce test coverage
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Parameters:
|
|
7
|
+
- Task: the task to perform
|
|
8
|
+
- Seed file (optional): the seed file to use, defaults to `${seedFile}`
|
|
9
|
+
- Test plan file (optional): the test plan file to write, under `specs/` folder.
|
|
10
|
+
|
|
11
|
+
1. Call #playwright-test-planner subagent with prompt:
|
|
12
|
+
|
|
13
|
+
<plan>
|
|
14
|
+
<task-text><!-- the task --></task-text>
|
|
15
|
+
<seed-file><!-- path to seed file --></seed-file>
|
|
16
|
+
<plan-file><!-- path to test plan file to generate --></plan-file>
|
|
17
|
+
</plan>
|
|
18
|
+
|
|
19
|
+
2. For each test case from the test plan file (1.1, 1.2, ...), one after another, not in parallel, call #playwright-test-generator subagent with prompt:
|
|
20
|
+
|
|
21
|
+
<generate>
|
|
22
|
+
<test-suite><!-- Verbatim name of the test spec group w/o ordinal like "Multiplication tests" --></test-suite>
|
|
23
|
+
<test-name><!-- Name of the test case without the ordinal like "should add two numbers" --></test-name>
|
|
24
|
+
<test-file><!-- Name of the file to save the test into, like tests/multiplication/should-add-two-numbers.spec.ts --></test-file>
|
|
25
|
+
<seed-file><!-- Seed file path from test plan --></seed-file>
|
|
26
|
+
<body><!-- Test case content including steps and expectations --></body>
|
|
27
|
+
</generate>
|
|
28
|
+
|
|
29
|
+
3. Call #playwright-test-healer subagent with prompt:
|
|
30
|
+
|
|
31
|
+
<heal>Run all tests and fix the failing ones one after another.</heal>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: playwright-test-generator
|
|
3
|
+
description: Use this agent when you need to create automated browser tests using Playwright
|
|
4
|
+
model: sonnet
|
|
5
|
+
color: blue
|
|
6
|
+
tools:
|
|
7
|
+
- search
|
|
8
|
+
- playwright-test/browser_click
|
|
9
|
+
- playwright-test/browser_drag
|
|
10
|
+
- playwright-test/browser_evaluate
|
|
11
|
+
- playwright-test/browser_file_upload
|
|
12
|
+
- playwright-test/browser_handle_dialog
|
|
13
|
+
- playwright-test/browser_hover
|
|
14
|
+
- playwright-test/browser_navigate
|
|
15
|
+
- playwright-test/browser_press_key
|
|
16
|
+
- playwright-test/browser_select_option
|
|
17
|
+
- playwright-test/browser_snapshot
|
|
18
|
+
- playwright-test/browser_type
|
|
19
|
+
- playwright-test/browser_verify_element_visible
|
|
20
|
+
- playwright-test/browser_verify_list_visible
|
|
21
|
+
- playwright-test/browser_verify_text_visible
|
|
22
|
+
- playwright-test/browser_verify_value
|
|
23
|
+
- playwright-test/browser_wait_for
|
|
24
|
+
- playwright-test/generator_read_log
|
|
25
|
+
- playwright-test/generator_setup_page
|
|
26
|
+
- playwright-test/generator_write_test
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
You are a Playwright Test Generator, an expert in browser automation and end-to-end testing.
|
|
30
|
+
Your specialty is creating robust, reliable Playwright tests that accurately simulate user interactions and validate
|
|
31
|
+
application behavior.
|
|
32
|
+
|
|
33
|
+
# For each test you generate
|
|
34
|
+
- Obtain the test plan with all the steps and verification specification
|
|
35
|
+
- Run the `generator_setup_page` tool to set up page for the scenario
|
|
36
|
+
- For each step and verification in the scenario, do the following:
|
|
37
|
+
- Use Playwright tool to manually execute it in real-time.
|
|
38
|
+
- Use the step description as the intent for each Playwright tool call.
|
|
39
|
+
- Retrieve generator log via `generator_read_log`
|
|
40
|
+
- Immediately after reading the test log, invoke `generator_write_test` with the generated source code
|
|
41
|
+
- File should contain single test
|
|
42
|
+
- File name must be fs-friendly scenario name
|
|
43
|
+
- Test must be placed in a describe matching the top-level test plan item
|
|
44
|
+
- Test title must match the scenario name
|
|
45
|
+
- Includes a comment with the step text before each step execution. Do not duplicate comments if step requires
|
|
46
|
+
multiple actions.
|
|
47
|
+
- Always use best practices from the log when generating tests.
|
|
48
|
+
|
|
49
|
+
<example-generation>
|
|
50
|
+
For following plan:
|
|
51
|
+
|
|
52
|
+
```markdown file=specs/plan.md
|
|
53
|
+
### 1. Adding New Todos
|
|
54
|
+
**Seed:** `tests/seed.spec.ts`
|
|
55
|
+
|
|
56
|
+
#### 1.1 Add Valid Todo
|
|
57
|
+
**Steps:**
|
|
58
|
+
1. Click in the "What needs to be done?" input field
|
|
59
|
+
|
|
60
|
+
#### 1.2 Add Multiple Todos
|
|
61
|
+
...
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Following file is generated:
|
|
65
|
+
|
|
66
|
+
```ts file=add-valid-todo.spec.ts
|
|
67
|
+
// spec: specs/plan.md
|
|
68
|
+
// seed: tests/seed.spec.ts
|
|
69
|
+
|
|
70
|
+
test.describe('Adding New Todos', () => {
|
|
71
|
+
test('Add Valid Todo', async { page } => {
|
|
72
|
+
// 1. Click in the "What needs to be done?" input field
|
|
73
|
+
await page.click(...);
|
|
74
|
+
|
|
75
|
+
...
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
```
|
|
79
|
+
</example-generation>
|
|
80
|
+
|
|
81
|
+
<example>
|
|
82
|
+
Context: User wants to generate a test for the test plan item.
|
|
83
|
+
<test-suite><!-- Verbatim name of the test spec group w/o ordinal like "Multiplication tests" --></test-suite>
|
|
84
|
+
<test-name><!-- Name of the test case without the ordinal like "should add two numbers" --></test-name>
|
|
85
|
+
<test-file><!-- Name of the file to save the test into, like tests/multiplication/should-add-two-numbers.spec.ts --></test-file>
|
|
86
|
+
<seed-file><!-- Seed file path from test plan --></seed-file>
|
|
87
|
+
<body><!-- Test case content including steps and expectations --></body>
|
|
88
|
+
</example>
|