@stablyai/internal-playwright 0.1.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/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +168 -0
- package/ThirdPartyNotices.txt +6277 -0
- package/cli.js +19 -0
- package/index.d.ts +17 -0
- package/index.js +17 -0
- package/index.mjs +18 -0
- package/jsx-runtime.js +42 -0
- package/jsx-runtime.mjs +21 -0
- package/lib/agents/generateAgents.js +265 -0
- package/lib/agents/generator.md +102 -0
- package/lib/agents/healer.md +78 -0
- package/lib/agents/planner.md +135 -0
- package/lib/cli.js +274 -0
- package/lib/common/config.js +274 -0
- package/lib/common/config.js.map +7 -0
- package/lib/common/configLoader.js +377 -0
- package/lib/common/configLoader.js.map +7 -0
- package/lib/common/esmLoaderHost.js +102 -0
- package/lib/common/esmLoaderHost.js.map +7 -0
- package/lib/common/expectBundle.js +52 -0
- package/lib/common/expectBundle.js.map +7 -0
- package/lib/common/expectBundleImpl.js +389 -0
- package/lib/common/expectBundleImpl.js.map +7 -0
- package/lib/common/fixtures.js +302 -0
- package/lib/common/fixtures.js.map +7 -0
- package/lib/common/globals.js +58 -0
- package/lib/common/globals.js.map +7 -0
- package/lib/common/ipc.js +60 -0
- package/lib/common/ipc.js.map +7 -0
- package/lib/common/poolBuilder.js +85 -0
- package/lib/common/poolBuilder.js.map +7 -0
- package/lib/common/process.js +104 -0
- package/lib/common/process.js.map +7 -0
- package/lib/common/suiteUtils.js +140 -0
- package/lib/common/suiteUtils.js.map +7 -0
- package/lib/common/test.js +321 -0
- package/lib/common/test.js.map +7 -0
- package/lib/common/testLoader.js +100 -0
- package/lib/common/testLoader.js.map +7 -0
- package/lib/common/testType.js +310 -0
- package/lib/common/testType.js.map +7 -0
- package/lib/fsWatcher.js +67 -0
- package/lib/fsWatcher.js.map +7 -0
- package/lib/index.js +696 -0
- package/lib/index.js.map +7 -0
- package/lib/internalsForTest.js +42 -0
- package/lib/internalsForTest.js.map +7 -0
- package/lib/isomorphic/events.js +77 -0
- package/lib/isomorphic/events.js.map +7 -0
- package/lib/isomorphic/folders.js +30 -0
- package/lib/isomorphic/folders.js.map +7 -0
- package/lib/isomorphic/stringInternPool.js +69 -0
- package/lib/isomorphic/stringInternPool.js.map +7 -0
- package/lib/isomorphic/teleReceiver.js +507 -0
- package/lib/isomorphic/teleReceiver.js.map +7 -0
- package/lib/isomorphic/teleSuiteUpdater.js +137 -0
- package/lib/isomorphic/teleSuiteUpdater.js.map +7 -0
- package/lib/isomorphic/testServerConnection.js +211 -0
- package/lib/isomorphic/testServerConnection.js.map +7 -0
- package/lib/isomorphic/testServerInterface.js +16 -0
- package/lib/isomorphic/testServerInterface.js.map +7 -0
- package/lib/isomorphic/testTree.js +334 -0
- package/lib/isomorphic/testTree.js.map +7 -0
- package/lib/isomorphic/types.d.js +16 -0
- package/lib/isomorphic/types.d.js.map +7 -0
- package/lib/loader/loaderMain.js +59 -0
- package/lib/loader/loaderMain.js.map +7 -0
- package/lib/matchers/expect.js +325 -0
- package/lib/matchers/expect.js.map +7 -0
- package/lib/matchers/matcherHint.js +87 -0
- package/lib/matchers/matcherHint.js.map +7 -0
- package/lib/matchers/matchers.js +366 -0
- package/lib/matchers/matchers.js.map +7 -0
- package/lib/matchers/toBeTruthy.js +73 -0
- package/lib/matchers/toBeTruthy.js.map +7 -0
- package/lib/matchers/toEqual.js +99 -0
- package/lib/matchers/toEqual.js.map +7 -0
- package/lib/matchers/toHaveURL.js +102 -0
- package/lib/matchers/toHaveURL.js.map +7 -0
- package/lib/matchers/toMatchAriaSnapshot.js +159 -0
- package/lib/matchers/toMatchAriaSnapshot.js.map +7 -0
- package/lib/matchers/toMatchSnapshot.js +359 -0
- package/lib/matchers/toMatchSnapshot.js.map +7 -0
- package/lib/matchers/toMatchText.js +99 -0
- package/lib/matchers/toMatchText.js.map +7 -0
- package/lib/mcp/browser/actions.d.js +16 -0
- package/lib/mcp/browser/backend.js +93 -0
- package/lib/mcp/browser/backend.js.map +7 -0
- package/lib/mcp/browser/browserContextFactory.js +296 -0
- package/lib/mcp/browser/browserServerBackend.js +76 -0
- package/lib/mcp/browser/codegen.js +66 -0
- package/lib/mcp/browser/config.js +385 -0
- package/lib/mcp/browser/context.js +287 -0
- package/lib/mcp/browser/response.js +228 -0
- package/lib/mcp/browser/sessionLog.js +160 -0
- package/lib/mcp/browser/tab.js +277 -0
- package/lib/mcp/browser/tool.js +30 -0
- package/lib/mcp/browser/tool.js.map +7 -0
- package/lib/mcp/browser/tools/common.js +63 -0
- package/lib/mcp/browser/tools/console.js +44 -0
- package/lib/mcp/browser/tools/dialogs.js +60 -0
- package/lib/mcp/browser/tools/evaluate.js +70 -0
- package/lib/mcp/browser/tools/files.js +58 -0
- package/lib/mcp/browser/tools/form.js +74 -0
- package/lib/mcp/browser/tools/install.js +69 -0
- package/lib/mcp/browser/tools/keyboard.js +85 -0
- package/lib/mcp/browser/tools/mouse.js +107 -0
- package/lib/mcp/browser/tools/navigate.js +62 -0
- package/lib/mcp/browser/tools/network.js +54 -0
- package/lib/mcp/browser/tools/pdf.js +59 -0
- package/lib/mcp/browser/tools/screenshot.js +88 -0
- package/lib/mcp/browser/tools/snapshot.js +182 -0
- package/lib/mcp/browser/tools/tabs.js +67 -0
- package/lib/mcp/browser/tools/tool.js +49 -0
- package/lib/mcp/browser/tools/tracing.js +74 -0
- package/lib/mcp/browser/tools/utils.js +100 -0
- package/lib/mcp/browser/tools/verify.js +154 -0
- package/lib/mcp/browser/tools/wait.js +63 -0
- package/lib/mcp/browser/tools.js +80 -0
- package/lib/mcp/browser/tools.js.map +7 -0
- package/lib/mcp/browser/watchdog.js +44 -0
- package/lib/mcp/config.d.js +16 -0
- package/lib/mcp/extension/cdpRelay.js +351 -0
- package/lib/mcp/extension/extensionContextFactory.js +75 -0
- package/lib/mcp/extension/protocol.js +28 -0
- package/lib/mcp/index.js +61 -0
- package/lib/mcp/log.js +35 -0
- package/lib/mcp/program.js +96 -0
- package/lib/mcp/sdk/bundle.js +81 -0
- package/lib/mcp/sdk/bundle.js.map +7 -0
- package/lib/mcp/sdk/call.js +49 -0
- package/lib/mcp/sdk/call.js.map +7 -0
- package/lib/mcp/sdk/exports.js +32 -0
- package/lib/mcp/sdk/exports.js.map +7 -0
- package/lib/mcp/sdk/http.js +187 -0
- package/lib/mcp/sdk/http.js.map +7 -0
- package/lib/mcp/sdk/inProcessTransport.js +71 -0
- package/lib/mcp/sdk/inProcessTransport.js.map +7 -0
- package/lib/mcp/sdk/mdb.js +206 -0
- package/lib/mcp/sdk/mdb.js.map +7 -0
- package/lib/mcp/sdk/proxyBackend.js +128 -0
- package/lib/mcp/sdk/proxyBackend.js.map +7 -0
- package/lib/mcp/sdk/server.js +189 -0
- package/lib/mcp/sdk/server.js.map +7 -0
- package/lib/mcp/sdk/tool.js +51 -0
- package/lib/mcp/sdk/tool.js.map +7 -0
- package/lib/mcp/test/backend.js +67 -0
- package/lib/mcp/test/backend.js.map +7 -0
- package/lib/mcp/test/browserBackend.js +98 -0
- package/lib/mcp/test/context.js +48 -0
- package/lib/mcp/test/context.js.map +7 -0
- package/lib/mcp/test/generatorTools.js +122 -0
- package/lib/mcp/test/plannerTools.js +46 -0
- package/lib/mcp/test/seed.js +72 -0
- package/lib/mcp/test/streams.js +39 -0
- package/lib/mcp/test/streams.js.map +7 -0
- package/lib/mcp/test/testBackend.js +97 -0
- package/lib/mcp/test/testContext.js +176 -0
- package/lib/mcp/test/testTool.js +30 -0
- package/lib/mcp/test/testTools.js +115 -0
- package/lib/mcp/test/tool.js +30 -0
- package/lib/mcp/test/tool.js.map +7 -0
- package/lib/mcp/test/tools.js +150 -0
- package/lib/mcp/test/tools.js.map +7 -0
- package/lib/mcp/vscode/host.js +187 -0
- package/lib/mcp/vscode/main.js +77 -0
- package/lib/mcpBundleImpl.js +41 -0
- package/lib/mcpBundleImpl.js.map +7 -0
- package/lib/plugins/gitCommitInfoPlugin.js +198 -0
- package/lib/plugins/gitCommitInfoPlugin.js.map +7 -0
- package/lib/plugins/index.js +28 -0
- package/lib/plugins/index.js.map +7 -0
- package/lib/plugins/webServerPlugin.js +209 -0
- package/lib/plugins/webServerPlugin.js.map +7 -0
- package/lib/program.js +412 -0
- package/lib/program.js.map +7 -0
- package/lib/reporters/base.js +609 -0
- package/lib/reporters/base.js.map +7 -0
- package/lib/reporters/blob.js +135 -0
- package/lib/reporters/blob.js.map +7 -0
- package/lib/reporters/dot.js +82 -0
- package/lib/reporters/dot.js.map +7 -0
- package/lib/reporters/empty.js +32 -0
- package/lib/reporters/empty.js.map +7 -0
- package/lib/reporters/github.js +128 -0
- package/lib/reporters/github.js.map +7 -0
- package/lib/reporters/html.js +644 -0
- package/lib/reporters/html.js.map +7 -0
- package/lib/reporters/internalReporter.js +130 -0
- package/lib/reporters/internalReporter.js.map +7 -0
- package/lib/reporters/json.js +254 -0
- package/lib/reporters/json.js.map +7 -0
- package/lib/reporters/junit.js +230 -0
- package/lib/reporters/junit.js.map +7 -0
- package/lib/reporters/line.js +113 -0
- package/lib/reporters/line.js.map +7 -0
- package/lib/reporters/list.js +235 -0
- package/lib/reporters/list.js.map +7 -0
- package/lib/reporters/listModeReporter.js +69 -0
- package/lib/reporters/listModeReporter.js.map +7 -0
- package/lib/reporters/markdown.js +144 -0
- package/lib/reporters/markdown.js.map +7 -0
- package/lib/reporters/merge.js +535 -0
- package/lib/reporters/merge.js.map +7 -0
- package/lib/reporters/multiplexer.js +104 -0
- package/lib/reporters/multiplexer.js.map +7 -0
- package/lib/reporters/reporterV2.js +102 -0
- package/lib/reporters/reporterV2.js.map +7 -0
- package/lib/reporters/teleEmitter.js +297 -0
- package/lib/reporters/teleEmitter.js.map +7 -0
- package/lib/reporters/versions/blobV1.js +16 -0
- package/lib/reporters/versions/blobV1.js.map +7 -0
- package/lib/runner/dispatcher.js +491 -0
- package/lib/runner/dispatcher.js.map +7 -0
- package/lib/runner/failureTracker.js +72 -0
- package/lib/runner/failureTracker.js.map +7 -0
- package/lib/runner/lastRun.js +77 -0
- package/lib/runner/lastRun.js.map +7 -0
- package/lib/runner/loadUtils.js +333 -0
- package/lib/runner/loadUtils.js.map +7 -0
- package/lib/runner/loaderHost.js +89 -0
- package/lib/runner/loaderHost.js.map +7 -0
- package/lib/runner/processHost.js +161 -0
- package/lib/runner/processHost.js.map +7 -0
- package/lib/runner/projectUtils.js +241 -0
- package/lib/runner/projectUtils.js.map +7 -0
- package/lib/runner/rebase.js +189 -0
- package/lib/runner/rebase.js.map +7 -0
- package/lib/runner/reporters.js +137 -0
- package/lib/runner/reporters.js.map +7 -0
- package/lib/runner/runner.js +173 -0
- package/lib/runner/sigIntWatcher.js +96 -0
- package/lib/runner/sigIntWatcher.js.map +7 -0
- package/lib/runner/taskRunner.js +127 -0
- package/lib/runner/taskRunner.js.map +7 -0
- package/lib/runner/tasks.js +410 -0
- package/lib/runner/tasks.js.map +7 -0
- package/lib/runner/testGroups.js +117 -0
- package/lib/runner/testGroups.js.map +7 -0
- package/lib/runner/testRunner.js +390 -0
- package/lib/runner/testRunner.js.map +7 -0
- package/lib/runner/testServer.js +264 -0
- package/lib/runner/testServer.js.map +7 -0
- package/lib/runner/uiMode.js +271 -0
- package/lib/runner/uiModeReporter.js +30 -0
- package/lib/runner/uiModeReporter.js.map +7 -0
- package/lib/runner/vcs.js +72 -0
- package/lib/runner/vcs.js.map +7 -0
- package/lib/runner/watchMode.js +395 -0
- package/lib/runner/watchMode.js.map +7 -0
- package/lib/runner/workerHost.js +95 -0
- package/lib/runner/workerHost.js.map +7 -0
- package/lib/store.js +98 -0
- package/lib/third_party/pirates.js +62 -0
- package/lib/third_party/pirates.js.map +7 -0
- package/lib/third_party/tsconfig-loader.js +103 -0
- package/lib/third_party/tsconfig-loader.js.map +7 -0
- package/lib/transform/babelBundle.js +43 -0
- package/lib/transform/babelBundle.js.map +7 -0
- package/lib/transform/babelBundleImpl.js +461 -0
- package/lib/transform/babelBundleImpl.js.map +7 -0
- package/lib/transform/compilationCache.js +272 -0
- package/lib/transform/compilationCache.js.map +7 -0
- package/lib/transform/esmLoader.js +104 -0
- package/lib/transform/esmLoader.js.map +7 -0
- package/lib/transform/esmUtils.js +32 -0
- package/lib/transform/portTransport.js +67 -0
- package/lib/transform/portTransport.js.map +7 -0
- package/lib/transform/transform.js +293 -0
- package/lib/transform/transform.js.map +7 -0
- package/lib/util.js +403 -0
- package/lib/util.js.map +7 -0
- package/lib/utilsBundle.js +43 -0
- package/lib/utilsBundle.js.map +7 -0
- package/lib/utilsBundleImpl.js +100 -0
- package/lib/utilsBundleImpl.js.map +7 -0
- package/lib/worker/fixtureRunner.js +258 -0
- package/lib/worker/fixtureRunner.js.map +7 -0
- package/lib/worker/stepContext.js +34 -0
- package/lib/worker/testInfo.js +508 -0
- package/lib/worker/testInfo.js.map +7 -0
- package/lib/worker/testTracing.js +344 -0
- package/lib/worker/testTracing.js.map +7 -0
- package/lib/worker/timeoutManager.js +174 -0
- package/lib/worker/timeoutManager.js.map +7 -0
- package/lib/worker/util.js +31 -0
- package/lib/worker/util.js.map +7 -0
- package/lib/worker/workerMain.js +520 -0
- package/lib/worker/workerMain.js.map +7 -0
- package/package.json +74 -0
- package/test.d.ts +18 -0
- package/test.js +24 -0
- package/test.mjs +33 -0
- package/types/test.d.ts +10217 -0
- package/types/testReporter.d.ts +816 -0
package/cli.js
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env node
|
2
|
+
/**
|
3
|
+
* Copyright (c) Microsoft Corporation.
|
4
|
+
*
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
* you may not use this file except in compliance with the License.
|
7
|
+
* You may obtain a copy of the License at
|
8
|
+
*
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
*
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
* See the License for the specific language governing permissions and
|
15
|
+
* limitations under the License.
|
16
|
+
*/
|
17
|
+
|
18
|
+
const { program } = require('./lib/program');
|
19
|
+
program.parse(process.argv);
|
package/index.d.ts
ADDED
@@ -0,0 +1,17 @@
|
|
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
|
+
export * from 'playwright-core';
|
package/index.js
ADDED
@@ -0,0 +1,17 @@
|
|
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
|
+
module.exports = require('playwright-core');
|
package/index.mjs
ADDED
@@ -0,0 +1,18 @@
|
|
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
|
+
export * from 'playwright-core';
|
17
|
+
import playwright from 'playwright-core';
|
18
|
+
export default playwright;
|
package/jsx-runtime.js
ADDED
@@ -0,0 +1,42 @@
|
|
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
|
+
function jsx(type, props, key) {
|
18
|
+
return {
|
19
|
+
__pw_type: 'jsx',
|
20
|
+
type,
|
21
|
+
props,
|
22
|
+
key,
|
23
|
+
};
|
24
|
+
}
|
25
|
+
|
26
|
+
function jsxs(type, props, key) {
|
27
|
+
return {
|
28
|
+
__pw_type: 'jsx',
|
29
|
+
type,
|
30
|
+
props,
|
31
|
+
key,
|
32
|
+
};
|
33
|
+
}
|
34
|
+
|
35
|
+
// this is used in <></> notation
|
36
|
+
const Fragment = { __pw_jsx_fragment: true };
|
37
|
+
|
38
|
+
module.exports = {
|
39
|
+
Fragment,
|
40
|
+
jsx,
|
41
|
+
jsxs,
|
42
|
+
};
|
package/jsx-runtime.mjs
ADDED
@@ -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,265 @@
|
|
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
|
+
initClaudeCodeRepo: () => initClaudeCodeRepo,
|
32
|
+
initOpencodeRepo: () => initOpencodeRepo,
|
33
|
+
initVSCodeRepo: () => initVSCodeRepo
|
34
|
+
});
|
35
|
+
module.exports = __toCommonJS(generateAgents_exports);
|
36
|
+
var import_fs = __toESM(require("fs"));
|
37
|
+
var import_path = __toESM(require("path"));
|
38
|
+
var import_utilsBundle = require("playwright-core/lib/utilsBundle");
|
39
|
+
class AgentParser {
|
40
|
+
static async parseFile(filePath) {
|
41
|
+
const rawMarkdown = await import_fs.default.promises.readFile(filePath, "utf-8");
|
42
|
+
const { header, content } = this.extractYamlAndContent(rawMarkdown);
|
43
|
+
const { instructions, examples } = this.extractInstructionsAndExamples(content);
|
44
|
+
return { header, instructions, examples };
|
45
|
+
}
|
46
|
+
static 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 = import_utilsBundle.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
|
+
static 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
|
+
}
|
87
|
+
const claudeToolMap = /* @__PURE__ */ new Map([
|
88
|
+
["ls", ["Glob"]],
|
89
|
+
["grep", ["Grep"]],
|
90
|
+
["read", ["Read"]],
|
91
|
+
["edit", ["Edit", "MultiEdit"]],
|
92
|
+
["write", ["Write"]]
|
93
|
+
]);
|
94
|
+
const commonMcpServers = {
|
95
|
+
playwrightTest: {
|
96
|
+
type: "local",
|
97
|
+
command: "npx",
|
98
|
+
args: ["playwright", "run-test-mcp-server"]
|
99
|
+
}
|
100
|
+
};
|
101
|
+
function saveAsClaudeCode(agent) {
|
102
|
+
function asClaudeTool(tool) {
|
103
|
+
const [first, second] = tool.split("/");
|
104
|
+
if (!second)
|
105
|
+
return (claudeToolMap.get(first) || [first]).join(", ");
|
106
|
+
return `mcp__${first}__${second}`;
|
107
|
+
}
|
108
|
+
const lines = [];
|
109
|
+
lines.push(`---`);
|
110
|
+
lines.push(`name: playwright-test-${agent.header.name}`);
|
111
|
+
lines.push(`description: ${agent.header.description}. Examples: ${agent.examples.map((example) => `<example>${example}</example>`).join("")}`);
|
112
|
+
lines.push(`tools: ${agent.header.tools.map((tool) => asClaudeTool(tool)).join(", ")}`);
|
113
|
+
lines.push(`model: ${agent.header.model}`);
|
114
|
+
lines.push(`color: ${agent.header.color}`);
|
115
|
+
lines.push(`---`);
|
116
|
+
lines.push("");
|
117
|
+
lines.push(agent.instructions);
|
118
|
+
return lines.join("\n");
|
119
|
+
}
|
120
|
+
const opencodeToolMap = /* @__PURE__ */ new Map([
|
121
|
+
["ls", ["ls", "glob"]],
|
122
|
+
["grep", ["grep"]],
|
123
|
+
["read", ["read"]],
|
124
|
+
["edit", ["edit"]],
|
125
|
+
["write", ["write"]]
|
126
|
+
]);
|
127
|
+
function saveAsOpencodeJson(agents) {
|
128
|
+
function asOpencodeTool(tools, tool) {
|
129
|
+
const [first, second] = tool.split("/");
|
130
|
+
if (!second) {
|
131
|
+
for (const tool2 of opencodeToolMap.get(first) || [first])
|
132
|
+
tools[tool2] = true;
|
133
|
+
} else {
|
134
|
+
tools[`${first}*${second}`] = true;
|
135
|
+
}
|
136
|
+
}
|
137
|
+
const result = {};
|
138
|
+
result["$schema"] = "https://opencode.ai/config.json";
|
139
|
+
result["mcp"] = {};
|
140
|
+
result["tools"] = {
|
141
|
+
"playwright*": false
|
142
|
+
};
|
143
|
+
result["agent"] = {};
|
144
|
+
for (const agent of agents) {
|
145
|
+
const tools = {};
|
146
|
+
result["agent"]["playwright-test-" + agent.header.name] = {
|
147
|
+
description: agent.header.description,
|
148
|
+
mode: "subagent",
|
149
|
+
prompt: `{file:.opencode/prompts/playwright-test-${agent.header.name}.md}`,
|
150
|
+
tools
|
151
|
+
};
|
152
|
+
for (const tool of agent.header.tools)
|
153
|
+
asOpencodeTool(tools, tool);
|
154
|
+
}
|
155
|
+
const server = commonMcpServers.playwrightTest;
|
156
|
+
result["mcp"]["playwright-test"] = {
|
157
|
+
type: server.type,
|
158
|
+
command: [server.command, ...server.args],
|
159
|
+
enabled: true
|
160
|
+
};
|
161
|
+
return JSON.stringify(result, null, 2);
|
162
|
+
}
|
163
|
+
async function loadAgents() {
|
164
|
+
const files = await import_fs.default.promises.readdir(__dirname);
|
165
|
+
return Promise.all(files.filter((file) => file.endsWith(".md")).map((file) => AgentParser.parseFile(import_path.default.join(__dirname, file))));
|
166
|
+
}
|
167
|
+
async function writeFile(filePath, content) {
|
168
|
+
console.log(`Writing file: ${filePath}`);
|
169
|
+
await import_fs.default.promises.writeFile(filePath, content, "utf-8");
|
170
|
+
}
|
171
|
+
async function initClaudeCodeRepo() {
|
172
|
+
const agents = await loadAgents();
|
173
|
+
await import_fs.default.promises.mkdir(".claude/agents", { recursive: true });
|
174
|
+
for (const agent of agents)
|
175
|
+
await writeFile(`.claude/agents/playwright-test-${agent.header.name}.md`, saveAsClaudeCode(agent));
|
176
|
+
await writeFile(".mcp.json", JSON.stringify({
|
177
|
+
mcpServers: {
|
178
|
+
"playwright-test": {
|
179
|
+
command: commonMcpServers.playwrightTest.command,
|
180
|
+
args: commonMcpServers.playwrightTest.args
|
181
|
+
}
|
182
|
+
}
|
183
|
+
}, null, 2));
|
184
|
+
}
|
185
|
+
const vscodeToolMap = /* @__PURE__ */ new Map([
|
186
|
+
["ls", ["search/listDirectory", "search/fileSearch"]],
|
187
|
+
["grep", ["search/textSearch"]],
|
188
|
+
["read", ["search/readFile"]],
|
189
|
+
["edit", ["edit/editFiles"]],
|
190
|
+
["write", ["edit/createFile", "edit/createDirectory"]]
|
191
|
+
]);
|
192
|
+
const vscodeToolsOrder = ["edit/createFile", "edit/createDirectory", "edit/editFiles", "search/fileSearch", "search/textSearch", "search/listDirectory", "search/readFile"];
|
193
|
+
const vscodeMcpName = "playwright-test";
|
194
|
+
function saveAsVSCodeChatmode(agent) {
|
195
|
+
function asVscodeTool(tool) {
|
196
|
+
const [first, second] = tool.split("/");
|
197
|
+
if (second)
|
198
|
+
return `${vscodeMcpName}/${second}`;
|
199
|
+
return vscodeToolMap.get(first) || first;
|
200
|
+
}
|
201
|
+
const tools = agent.header.tools.map(asVscodeTool).flat().sort((a, b) => {
|
202
|
+
const indexA = vscodeToolsOrder.indexOf(a);
|
203
|
+
const indexB = vscodeToolsOrder.indexOf(b);
|
204
|
+
if (indexA === -1 && indexB === -1)
|
205
|
+
return a.localeCompare(b);
|
206
|
+
if (indexA === -1)
|
207
|
+
return 1;
|
208
|
+
if (indexB === -1)
|
209
|
+
return -1;
|
210
|
+
return indexA - indexB;
|
211
|
+
}).map((tool) => `'${tool}'`).join(", ");
|
212
|
+
const lines = [];
|
213
|
+
lines.push(`---`);
|
214
|
+
lines.push(`description: ${agent.header.description}.`);
|
215
|
+
lines.push(`tools: [${tools}]`);
|
216
|
+
lines.push(`---`);
|
217
|
+
lines.push("");
|
218
|
+
lines.push(agent.instructions);
|
219
|
+
for (const example of agent.examples)
|
220
|
+
lines.push(`<example>${example}</example>`);
|
221
|
+
return lines.join("\n");
|
222
|
+
}
|
223
|
+
async function initVSCodeRepo() {
|
224
|
+
const agents = await loadAgents();
|
225
|
+
await import_fs.default.promises.mkdir(".github/chatmodes", { recursive: true });
|
226
|
+
for (const agent of agents)
|
227
|
+
await writeFile(`.github/chatmodes/${agent.header.name === "planner" ? " " : ""}\u{1F3AD} ${agent.header.name}.chatmode.md`, saveAsVSCodeChatmode(agent));
|
228
|
+
await import_fs.default.promises.mkdir(".vscode", { recursive: true });
|
229
|
+
const mcpJsonPath = ".vscode/mcp.json";
|
230
|
+
let mcpJson = {
|
231
|
+
servers: {},
|
232
|
+
inputs: []
|
233
|
+
};
|
234
|
+
try {
|
235
|
+
mcpJson = JSON.parse(import_fs.default.readFileSync(mcpJsonPath, "utf8"));
|
236
|
+
} catch {
|
237
|
+
}
|
238
|
+
if (!mcpJson.servers)
|
239
|
+
mcpJson.servers = {};
|
240
|
+
mcpJson.servers["playwright-test"] = {
|
241
|
+
type: "stdio",
|
242
|
+
command: commonMcpServers.playwrightTest.command,
|
243
|
+
args: commonMcpServers.playwrightTest.args,
|
244
|
+
cwd: "${workspaceFolder}"
|
245
|
+
};
|
246
|
+
await writeFile(mcpJsonPath, JSON.stringify(mcpJson, null, 2));
|
247
|
+
console.log(import_utilsBundle.colors.yellow(`${import_utilsBundle.colors.bold("Note:")} Playwright Test Agents require VSCode version 1.105+ or VSCode Insiders`));
|
248
|
+
}
|
249
|
+
async function initOpencodeRepo() {
|
250
|
+
const agents = await loadAgents();
|
251
|
+
await import_fs.default.promises.mkdir(".opencode/prompts", { recursive: true });
|
252
|
+
for (const agent of agents) {
|
253
|
+
const prompt = [agent.instructions];
|
254
|
+
prompt.push("");
|
255
|
+
prompt.push(...agent.examples.map((example) => `<example>${example}</example>`));
|
256
|
+
await writeFile(`.opencode/prompts/playwright-test-${agent.header.name}.md`, prompt.join("\n"));
|
257
|
+
}
|
258
|
+
await writeFile("opencode.json", saveAsOpencodeJson(agents));
|
259
|
+
}
|
260
|
+
// Annotate the CommonJS export names for ESM import in node:
|
261
|
+
0 && (module.exports = {
|
262
|
+
initClaudeCodeRepo,
|
263
|
+
initOpencodeRepo,
|
264
|
+
initVSCodeRepo
|
265
|
+
});
|
@@ -0,0 +1,102 @@
|
|
1
|
+
---
|
2
|
+
name: 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
|
+
- ls
|
8
|
+
- grep
|
9
|
+
- read
|
10
|
+
- playwright-test/browser_click
|
11
|
+
- playwright-test/browser_drag
|
12
|
+
- playwright-test/browser_evaluate
|
13
|
+
- playwright-test/browser_file_upload
|
14
|
+
- playwright-test/browser_handle_dialog
|
15
|
+
- playwright-test/browser_hover
|
16
|
+
- playwright-test/browser_navigate
|
17
|
+
- playwright-test/browser_press_key
|
18
|
+
- playwright-test/browser_select_option
|
19
|
+
- playwright-test/browser_snapshot
|
20
|
+
- playwright-test/browser_type
|
21
|
+
- playwright-test/browser_verify_element_visible
|
22
|
+
- playwright-test/browser_verify_list_visible
|
23
|
+
- playwright-test/browser_verify_text_visible
|
24
|
+
- playwright-test/browser_verify_value
|
25
|
+
- playwright-test/browser_wait_for
|
26
|
+
- playwright-test/generator_read_log
|
27
|
+
- playwright-test/generator_setup_page
|
28
|
+
- playwright-test/generator_write_test
|
29
|
+
---
|
30
|
+
|
31
|
+
You are a Playwright Test Generator, an expert in browser automation and end-to-end testing.
|
32
|
+
Your specialty is creating robust, reliable Playwright tests that accurately simulate user interactions and validate
|
33
|
+
application behavior.
|
34
|
+
|
35
|
+
# For each test you generate
|
36
|
+
- Obtain the test plan with all the steps and verification specification
|
37
|
+
- Run the `generator_setup_page` tool to set up page for the scenario
|
38
|
+
- For each step and verification in the scenario, do the following:
|
39
|
+
- Use Playwright tool to manually execute it in real-time.
|
40
|
+
- Use the step description as the intent for each Playwright tool call.
|
41
|
+
- Retrieve generator log via `generator_read_log`
|
42
|
+
- Immediately after reading the test log, invoke `generator_write_test` with the generated source code
|
43
|
+
- File should contain single test
|
44
|
+
- File name must be fs-friendly scenario name
|
45
|
+
- Test must be placed in a describe matching the top-level test plan item
|
46
|
+
- Test title must match the scenario name
|
47
|
+
- Includes a comment with the step text before each step execution. Do not duplicate comments if step requires
|
48
|
+
multiple actions.
|
49
|
+
- Always use best practices from the log when generating tests.
|
50
|
+
|
51
|
+
<example-generation>
|
52
|
+
For following plan:
|
53
|
+
|
54
|
+
```markdown file=specs/plan.md
|
55
|
+
### 1. Adding New Todos
|
56
|
+
**Seed:** `tests/seed.spec.ts`
|
57
|
+
|
58
|
+
#### 1.1 Add Valid Todo
|
59
|
+
**Steps:**
|
60
|
+
1. Click in the "What needs to be done?" input field
|
61
|
+
|
62
|
+
#### 1.2 Add Multiple Todos
|
63
|
+
...
|
64
|
+
```
|
65
|
+
|
66
|
+
Following file is generated:
|
67
|
+
|
68
|
+
```ts file=add-valid-todo.spec.ts
|
69
|
+
// spec: specs/plan.md
|
70
|
+
// seed: tests/seed.spec.ts
|
71
|
+
|
72
|
+
test.describe('Adding New Todos', () => {
|
73
|
+
test('Add Valid Todo', async { page } => {
|
74
|
+
// 1. Click in the "What needs to be done?" input field
|
75
|
+
await page.click(...);
|
76
|
+
|
77
|
+
...
|
78
|
+
});
|
79
|
+
});
|
80
|
+
```
|
81
|
+
</example-generation>
|
82
|
+
|
83
|
+
<example>
|
84
|
+
Context: User wants to test a login flow on their web application.
|
85
|
+
user: 'I need a test that logs into my app at localhost:3000 with username admin@test.com and password 123456, then
|
86
|
+
verifies the dashboard page loads'
|
87
|
+
assistant: 'I'll use the generator agent to create and validate this login test for you'
|
88
|
+
<commentary>
|
89
|
+
The user needs a specific browser automation test created, which is exactly what the generator agent
|
90
|
+
is designed for.
|
91
|
+
</commentary>
|
92
|
+
</example>
|
93
|
+
<example>
|
94
|
+
Context: User has built a new checkout flow and wants to ensure it works correctly.
|
95
|
+
user: 'Can you create a test that adds items to cart, proceeds to checkout, fills in payment details, and confirms the
|
96
|
+
order?'
|
97
|
+
assistant: 'I'll use the generator agent to build a comprehensive checkout flow test'
|
98
|
+
<commentary>
|
99
|
+
This is a complex user journey that needs to be automated and tested, perfect for the generator
|
100
|
+
agent.
|
101
|
+
</commentary>
|
102
|
+
</example>
|
@@ -0,0 +1,78 @@
|
|
1
|
+
---
|
2
|
+
name: healer
|
3
|
+
description: Use this agent when you need to debug and fix failing Playwright tests
|
4
|
+
color: red
|
5
|
+
model: sonnet
|
6
|
+
tools:
|
7
|
+
- ls
|
8
|
+
- grep
|
9
|
+
- read
|
10
|
+
- write
|
11
|
+
- edit
|
12
|
+
- playwright-test/browser_console_messages
|
13
|
+
- playwright-test/browser_evaluate
|
14
|
+
- playwright-test/browser_generate_locator
|
15
|
+
- playwright-test/browser_network_requests
|
16
|
+
- playwright-test/browser_snapshot
|
17
|
+
- playwright-test/test_debug
|
18
|
+
- playwright-test/test_list
|
19
|
+
- playwright-test/test_run
|
20
|
+
---
|
21
|
+
|
22
|
+
You are the Playwright Test Healer, an expert test automation engineer specializing in debugging and
|
23
|
+
resolving Playwright test failures. Your mission is to systematically identify, diagnose, and fix
|
24
|
+
broken Playwright tests using a methodical approach.
|
25
|
+
|
26
|
+
Your workflow:
|
27
|
+
1. **Initial Execution**: Run all tests using playwright_test_run_test tool to identify failing tests
|
28
|
+
2. **Debug failed tests**: For each failing test run playwright_test_debug_test.
|
29
|
+
3. **Error Investigation**: When the test pauses on errors, use available Playwright MCP tools to:
|
30
|
+
- Examine the error details
|
31
|
+
- Capture page snapshot to understand the context
|
32
|
+
- Analyze selectors, timing issues, or assertion failures
|
33
|
+
4. **Root Cause Analysis**: Determine the underlying cause of the failure by examining:
|
34
|
+
- Element selectors that may have changed
|
35
|
+
- Timing and synchronization issues
|
36
|
+
- Data dependencies or test environment problems
|
37
|
+
- Application changes that broke test assumptions
|
38
|
+
5. **Code Remediation**: Edit the test code to address identified issues, focusing on:
|
39
|
+
- Updating selectors to match current application state
|
40
|
+
- Fixing assertions and expected values
|
41
|
+
- Improving test reliability and maintainability
|
42
|
+
- For inherently dynamic data, utilize regular expressions to produce resilient locators
|
43
|
+
6. **Verification**: Restart the test after each fix to validate the changes
|
44
|
+
7. **Iteration**: Repeat the investigation and fixing process until the test passes cleanly
|
45
|
+
|
46
|
+
Key principles:
|
47
|
+
- Be systematic and thorough in your debugging approach
|
48
|
+
- Document your findings and reasoning for each fix
|
49
|
+
- Prefer robust, maintainable solutions over quick hacks
|
50
|
+
- Use Playwright best practices for reliable test automation
|
51
|
+
- If multiple errors exist, fix them one at a time and retest
|
52
|
+
- Provide clear explanations of what was broken and how you fixed it
|
53
|
+
- You will continue this process until the test runs successfully without any failures or errors.
|
54
|
+
- If the error persists and you have high level of confidence that the test is correct, mark this test as test.fixme()
|
55
|
+
so that it is skipped during the execution. Add a comment before the failing step explaining what is happening instead
|
56
|
+
of the expected behavior.
|
57
|
+
- Do not ask user questions, you are not interactive tool, do the most reasonable thing possible to pass the test.
|
58
|
+
- Never wait for networkidle or use other discouraged or deprecated apis
|
59
|
+
|
60
|
+
<example>
|
61
|
+
Context: A developer has a failing Playwright test that needs to be debugged and fixed.
|
62
|
+
user: 'The login test is failing, can you fix it?'
|
63
|
+
assistant: 'I'll use the healer agent to debug and fix the failing login test.'
|
64
|
+
<commentary>
|
65
|
+
The user has identified a specific failing test that needs debugging and fixing, which is exactly what the
|
66
|
+
healer agent is designed for.
|
67
|
+
</commentary>
|
68
|
+
</example>
|
69
|
+
|
70
|
+
<example>
|
71
|
+
Context: After running a test suite, several tests are reported as failing.
|
72
|
+
user: 'Test user-registration.spec.ts is broken after the recent changes'
|
73
|
+
assistant: 'Let me use the healer agent to investigate and fix the user-registration test.'
|
74
|
+
<commentary>
|
75
|
+
A specific test file is failing and needs debugging, which requires the systematic approach of the
|
76
|
+
playwright-test-healer agent.
|
77
|
+
</commentary>
|
78
|
+
</example>
|