@skyramp/mcp 0.0.63 → 0.0.64-rc.2
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/build/index.js +23 -6
- package/build/playwright/PlaywrightTraceService.js +74 -0
- package/build/playwright/index.js +3 -0
- package/build/playwright/registerPlaywrightTools.js +117 -0
- package/build/playwright/traceRecordingPrompt.js +54 -0
- package/build/prompts/startTraceCollectionPrompts.js +4 -2
- package/build/prompts/test-recommendation/recommendationSections.js +88 -212
- package/build/prompts/test-recommendation/test-recommendation-prompt.js +336 -85
- package/build/prompts/test-recommendation/test-recommendation-prompt.test.js +58 -15
- package/build/prompts/testGenerationPrompt.js +1 -1
- package/build/prompts/testbot/testbot-prompts.js +44 -22
- package/build/services/ModularizationService.js +1 -1
- package/build/services/TestExecutionService.js +1 -1
- package/build/services/TestGenerationService.js +8 -1
- package/build/services/TestGenerationService.test.js +11 -11
- package/build/tools/code-refactor/modularizationTool.js +50 -8
- package/build/tools/generate-tests/generateContractRestTool.js +125 -12
- package/build/tools/generate-tests/generateIntegrationRestTool.js +83 -1
- package/build/tools/generate-tests/generateUIRestTool.js +10 -2
- package/build/tools/submitReportTool.js +26 -7
- package/build/tools/submitReportTool.test.js +1 -1
- package/build/tools/test-management/analyzeChangesTool.js +9 -4
- package/build/tools/trace/startTraceCollectionTool.js +6 -9
- package/build/tools/trace/stopTraceCollectionTool.js +2 -2
- package/build/types/RepositoryAnalysis.js +3 -1
- package/build/utils/normalizeParams.js +45 -0
- package/build/utils/scenarioDrafting.js +418 -93
- package/build/utils/scenarioDrafting.test.js +190 -2
- package/build/utils/trace-parser.js +49 -22
- package/node_modules/playwright/ThirdPartyNotices.txt +7456 -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 +348 -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 +55 -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 +73 -0
- package/node_modules/playwright/lib/common/config.js +282 -0
- package/node_modules/playwright/lib/common/configLoader.js +344 -0
- package/node_modules/playwright/lib/common/esmLoaderHost.js +104 -0
- package/node_modules/playwright/lib/common/expectBundle.js +28 -0
- package/node_modules/playwright/lib/common/expectBundleImpl.js +407 -0
- package/node_modules/playwright/lib/common/fixtures.js +302 -0
- package/node_modules/playwright/lib/common/globals.js +58 -0
- package/node_modules/playwright/lib/common/ipc.js +60 -0
- package/node_modules/playwright/lib/common/poolBuilder.js +85 -0
- package/node_modules/playwright/lib/common/process.js +132 -0
- package/node_modules/playwright/lib/common/suiteUtils.js +140 -0
- package/node_modules/playwright/lib/common/test.js +321 -0
- package/node_modules/playwright/lib/common/testLoader.js +101 -0
- package/node_modules/playwright/lib/common/testType.js +298 -0
- package/node_modules/playwright/lib/common/validators.js +68 -0
- package/node_modules/playwright/lib/fsWatcher.js +67 -0
- package/node_modules/playwright/lib/index.js +726 -0
- package/node_modules/playwright/lib/internalsForTest.js +42 -0
- package/node_modules/playwright/lib/isomorphic/events.js +77 -0
- package/node_modules/playwright/lib/isomorphic/folders.js +30 -0
- package/node_modules/playwright/lib/isomorphic/stringInternPool.js +69 -0
- package/node_modules/playwright/lib/isomorphic/teleReceiver.js +521 -0
- package/node_modules/playwright/lib/isomorphic/teleSuiteUpdater.js +157 -0
- package/node_modules/playwright/lib/isomorphic/testServerConnection.js +225 -0
- package/node_modules/playwright/lib/isomorphic/testServerInterface.js +16 -0
- package/node_modules/playwright/lib/isomorphic/testTree.js +329 -0
- package/node_modules/playwright/lib/isomorphic/types.d.js +16 -0
- package/node_modules/playwright/lib/loader/loaderMain.js +59 -0
- package/node_modules/playwright/lib/matchers/expect.js +311 -0
- package/node_modules/playwright/lib/matchers/matcherHint.js +44 -0
- package/node_modules/playwright/lib/matchers/matchers.js +383 -0
- package/node_modules/playwright/lib/matchers/toBeTruthy.js +75 -0
- package/node_modules/playwright/lib/matchers/toEqual.js +100 -0
- package/node_modules/playwright/lib/matchers/toHaveURL.js +101 -0
- package/node_modules/playwright/lib/matchers/toMatchAriaSnapshot.js +159 -0
- package/node_modules/playwright/lib/matchers/toMatchSnapshot.js +342 -0
- package/node_modules/playwright/lib/matchers/toMatchText.js +99 -0
- package/node_modules/playwright/lib/mcp/browser/browserContextFactory.js +329 -0
- package/node_modules/playwright/lib/mcp/browser/browserServerBackend.js +84 -0
- package/node_modules/playwright/lib/mcp/browser/config.js +421 -0
- package/node_modules/playwright/lib/mcp/browser/context.js +296 -0
- package/node_modules/playwright/lib/mcp/browser/response.js +278 -0
- package/node_modules/playwright/lib/mcp/browser/sessionLog.js +75 -0
- package/node_modules/playwright/lib/mcp/browser/tab.js +343 -0
- package/node_modules/playwright/lib/mcp/browser/tools/common.js +65 -0
- package/node_modules/playwright/lib/mcp/browser/tools/console.js +46 -0
- package/node_modules/playwright/lib/mcp/browser/tools/dialogs.js +60 -0
- package/node_modules/playwright/lib/mcp/browser/tools/evaluate.js +61 -0
- package/node_modules/playwright/lib/mcp/browser/tools/files.js +58 -0
- package/node_modules/playwright/lib/mcp/browser/tools/form.js +63 -0
- package/node_modules/playwright/lib/mcp/browser/tools/install.js +72 -0
- package/node_modules/playwright/lib/mcp/browser/tools/keyboard.js +107 -0
- package/node_modules/playwright/lib/mcp/browser/tools/mouse.js +107 -0
- package/node_modules/playwright/lib/mcp/browser/tools/navigate.js +71 -0
- package/node_modules/playwright/lib/mcp/browser/tools/network.js +63 -0
- package/node_modules/playwright/lib/mcp/browser/tools/open.js +57 -0
- package/node_modules/playwright/lib/mcp/browser/tools/pdf.js +49 -0
- package/node_modules/playwright/lib/mcp/browser/tools/runCode.js +78 -0
- package/node_modules/playwright/lib/mcp/browser/tools/screenshot.js +93 -0
- package/node_modules/playwright/lib/mcp/browser/tools/snapshot.js +173 -0
- package/node_modules/playwright/lib/mcp/browser/tools/tabs.js +67 -0
- package/node_modules/playwright/lib/mcp/browser/tools/tool.js +47 -0
- package/node_modules/playwright/lib/mcp/browser/tools/tracing.js +74 -0
- package/node_modules/playwright/lib/mcp/browser/tools/utils.js +94 -0
- package/node_modules/playwright/lib/mcp/browser/tools/verify.js +143 -0
- package/node_modules/playwright/lib/mcp/browser/tools/wait.js +63 -0
- package/node_modules/playwright/lib/mcp/browser/tools.js +84 -0
- package/node_modules/playwright/lib/mcp/browser/watchdog.js +44 -0
- package/node_modules/playwright/lib/mcp/config.d.js +16 -0
- package/node_modules/playwright/lib/mcp/extension/cdpRelay.js +351 -0
- package/node_modules/playwright/lib/mcp/extension/extensionContextFactory.js +76 -0
- package/node_modules/playwright/lib/mcp/extension/protocol.js +28 -0
- package/node_modules/playwright/lib/mcp/index.js +61 -0
- package/node_modules/playwright/lib/mcp/log.js +35 -0
- package/node_modules/playwright/lib/mcp/program.js +111 -0
- package/node_modules/playwright/lib/mcp/sdk/exports.js +28 -0
- package/node_modules/playwright/lib/mcp/sdk/http.js +152 -0
- package/node_modules/playwright/lib/mcp/sdk/inProcessTransport.js +71 -0
- package/node_modules/playwright/lib/mcp/sdk/server.js +223 -0
- package/node_modules/playwright/lib/mcp/sdk/tool.js +47 -0
- package/node_modules/playwright/lib/mcp/skyramp/exportTool.js +88 -0
- package/node_modules/playwright/lib/mcp/skyramp/index.js +36 -0
- package/node_modules/playwright/lib/mcp/skyramp/traceRecordingBackend.js +236 -0
- package/node_modules/playwright/lib/mcp/skyramp/types.js +31 -0
- package/node_modules/playwright/lib/mcp/terminal/cli.js +296 -0
- package/node_modules/playwright/lib/mcp/terminal/command.js +56 -0
- package/node_modules/playwright/lib/mcp/terminal/commands.js +333 -0
- package/node_modules/playwright/lib/mcp/terminal/daemon.js +129 -0
- package/node_modules/playwright/lib/mcp/terminal/help.json +32 -0
- package/node_modules/playwright/lib/mcp/terminal/helpGenerator.js +88 -0
- package/node_modules/playwright/lib/mcp/terminal/socketConnection.js +80 -0
- package/node_modules/playwright/lib/mcp/test/browserBackend.js +98 -0
- package/node_modules/playwright/lib/mcp/test/generatorTools.js +122 -0
- package/node_modules/playwright/lib/mcp/test/plannerTools.js +145 -0
- package/node_modules/playwright/lib/mcp/test/seed.js +82 -0
- package/node_modules/playwright/lib/mcp/test/skyRampExport.js +313 -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 +285 -0
- package/node_modules/playwright/lib/mcp/test/testTool.js +30 -0
- package/node_modules/playwright/lib/mcp/test/testTools.js +108 -0
- package/node_modules/playwright/lib/plugins/gitCommitInfoPlugin.js +198 -0
- package/node_modules/playwright/lib/plugins/index.js +28 -0
- package/node_modules/playwright/lib/plugins/webServerPlugin.js +237 -0
- package/node_modules/playwright/lib/program.js +417 -0
- package/node_modules/playwright/lib/reporters/base.js +634 -0
- package/node_modules/playwright/lib/reporters/blob.js +138 -0
- package/node_modules/playwright/lib/reporters/dot.js +99 -0
- package/node_modules/playwright/lib/reporters/empty.js +32 -0
- package/node_modules/playwright/lib/reporters/github.js +128 -0
- package/node_modules/playwright/lib/reporters/html.js +633 -0
- package/node_modules/playwright/lib/reporters/internalReporter.js +138 -0
- package/node_modules/playwright/lib/reporters/json.js +254 -0
- package/node_modules/playwright/lib/reporters/junit.js +232 -0
- package/node_modules/playwright/lib/reporters/line.js +131 -0
- package/node_modules/playwright/lib/reporters/list.js +253 -0
- package/node_modules/playwright/lib/reporters/listModeReporter.js +69 -0
- package/node_modules/playwright/lib/reporters/markdown.js +144 -0
- package/node_modules/playwright/lib/reporters/merge.js +558 -0
- package/node_modules/playwright/lib/reporters/multiplexer.js +112 -0
- package/node_modules/playwright/lib/reporters/reporterV2.js +102 -0
- package/node_modules/playwright/lib/reporters/teleEmitter.js +317 -0
- package/node_modules/playwright/lib/reporters/versions/blobV1.js +16 -0
- package/node_modules/playwright/lib/runner/dispatcher.js +530 -0
- package/node_modules/playwright/lib/runner/failureTracker.js +72 -0
- package/node_modules/playwright/lib/runner/lastRun.js +77 -0
- package/node_modules/playwright/lib/runner/loadUtils.js +334 -0
- package/node_modules/playwright/lib/runner/loaderHost.js +89 -0
- package/node_modules/playwright/lib/runner/processHost.js +180 -0
- package/node_modules/playwright/lib/runner/projectUtils.js +241 -0
- package/node_modules/playwright/lib/runner/rebase.js +189 -0
- package/node_modules/playwright/lib/runner/reporters.js +138 -0
- package/node_modules/playwright/lib/runner/sigIntWatcher.js +96 -0
- package/node_modules/playwright/lib/runner/storage.js +91 -0
- package/node_modules/playwright/lib/runner/taskRunner.js +127 -0
- package/node_modules/playwright/lib/runner/tasks.js +410 -0
- package/node_modules/playwright/lib/runner/testGroups.js +125 -0
- package/node_modules/playwright/lib/runner/testRunner.js +398 -0
- package/node_modules/playwright/lib/runner/testServer.js +269 -0
- package/node_modules/playwright/lib/runner/uiModeReporter.js +30 -0
- package/node_modules/playwright/lib/runner/vcs.js +72 -0
- package/node_modules/playwright/lib/runner/watchMode.js +396 -0
- package/node_modules/playwright/lib/runner/workerHost.js +104 -0
- package/node_modules/playwright/lib/third_party/pirates.js +62 -0
- package/node_modules/playwright/lib/third_party/tsconfig-loader.js +103 -0
- package/node_modules/playwright/lib/transform/babelBundle.js +46 -0
- package/node_modules/playwright/lib/transform/babelBundleImpl.js +461 -0
- package/node_modules/playwright/lib/transform/compilationCache.js +274 -0
- package/node_modules/playwright/lib/transform/esmLoader.js +103 -0
- package/node_modules/playwright/lib/transform/md.js +221 -0
- package/node_modules/playwright/lib/transform/portTransport.js +67 -0
- package/node_modules/playwright/lib/transform/transform.js +303 -0
- package/node_modules/playwright/lib/util.js +400 -0
- package/node_modules/playwright/lib/utilsBundle.js +50 -0
- package/node_modules/playwright/lib/utilsBundleImpl.js +103 -0
- package/node_modules/playwright/lib/worker/fixtureRunner.js +262 -0
- package/node_modules/playwright/lib/worker/testInfo.js +536 -0
- package/node_modules/playwright/lib/worker/testTracing.js +345 -0
- package/node_modules/playwright/lib/worker/timeoutManager.js +174 -0
- package/node_modules/playwright/lib/worker/util.js +31 -0
- package/node_modules/playwright/lib/worker/workerMain.js +530 -0
- package/node_modules/playwright/package.json +73 -0
- package/node_modules/playwright/test.d.ts +18 -0
- package/node_modules/playwright/test.js +24 -0
- package/node_modules/playwright/test.mjs +34 -0
- package/node_modules/playwright/types/test.d.ts +10251 -0
- package/node_modules/playwright/types/testReporter.d.ts +822 -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 +4076 -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 +79 -0
- package/node_modules/playwright-core/cli.js +18 -0
- package/node_modules/playwright-core/index.d.ts +17 -0
- package/node_modules/playwright-core/index.js +32 -0
- package/node_modules/playwright-core/index.mjs +28 -0
- package/node_modules/playwright-core/lib/androidServerImpl.js +65 -0
- package/node_modules/playwright-core/lib/browserServerImpl.js +120 -0
- package/node_modules/playwright-core/lib/cli/driver.js +97 -0
- package/node_modules/playwright-core/lib/cli/program.js +589 -0
- package/node_modules/playwright-core/lib/cli/programWithTestStub.js +74 -0
- package/node_modules/playwright-core/lib/client/android.js +361 -0
- package/node_modules/playwright-core/lib/client/api.js +137 -0
- package/node_modules/playwright-core/lib/client/artifact.js +79 -0
- package/node_modules/playwright-core/lib/client/browser.js +161 -0
- package/node_modules/playwright-core/lib/client/browserContext.js +582 -0
- package/node_modules/playwright-core/lib/client/browserType.js +185 -0
- package/node_modules/playwright-core/lib/client/cdpSession.js +51 -0
- package/node_modules/playwright-core/lib/client/channelOwner.js +194 -0
- package/node_modules/playwright-core/lib/client/clientHelper.js +64 -0
- package/node_modules/playwright-core/lib/client/clientInstrumentation.js +55 -0
- package/node_modules/playwright-core/lib/client/clientStackTrace.js +69 -0
- package/node_modules/playwright-core/lib/client/clock.js +68 -0
- package/node_modules/playwright-core/lib/client/connection.js +318 -0
- package/node_modules/playwright-core/lib/client/consoleMessage.js +58 -0
- package/node_modules/playwright-core/lib/client/coverage.js +44 -0
- package/node_modules/playwright-core/lib/client/dialog.js +56 -0
- package/node_modules/playwright-core/lib/client/download.js +62 -0
- package/node_modules/playwright-core/lib/client/electron.js +138 -0
- package/node_modules/playwright-core/lib/client/elementHandle.js +284 -0
- package/node_modules/playwright-core/lib/client/errors.js +77 -0
- package/node_modules/playwright-core/lib/client/eventEmitter.js +314 -0
- package/node_modules/playwright-core/lib/client/events.js +103 -0
- package/node_modules/playwright-core/lib/client/fetch.js +368 -0
- package/node_modules/playwright-core/lib/client/fileChooser.js +46 -0
- package/node_modules/playwright-core/lib/client/fileUtils.js +34 -0
- package/node_modules/playwright-core/lib/client/frame.js +409 -0
- package/node_modules/playwright-core/lib/client/harRouter.js +87 -0
- package/node_modules/playwright-core/lib/client/input.js +84 -0
- package/node_modules/playwright-core/lib/client/jsHandle.js +109 -0
- package/node_modules/playwright-core/lib/client/jsonPipe.js +39 -0
- package/node_modules/playwright-core/lib/client/localUtils.js +60 -0
- package/node_modules/playwright-core/lib/client/locator.js +369 -0
- package/node_modules/playwright-core/lib/client/network.js +747 -0
- package/node_modules/playwright-core/lib/client/page.js +745 -0
- package/node_modules/playwright-core/lib/client/pageAgent.js +64 -0
- package/node_modules/playwright-core/lib/client/platform.js +77 -0
- package/node_modules/playwright-core/lib/client/playwright.js +71 -0
- package/node_modules/playwright-core/lib/client/selectors.js +55 -0
- package/node_modules/playwright-core/lib/client/stream.js +39 -0
- package/node_modules/playwright-core/lib/client/timeoutSettings.js +79 -0
- package/node_modules/playwright-core/lib/client/tracing.js +119 -0
- package/node_modules/playwright-core/lib/client/types.js +28 -0
- package/node_modules/playwright-core/lib/client/video.js +59 -0
- package/node_modules/playwright-core/lib/client/waiter.js +142 -0
- package/node_modules/playwright-core/lib/client/webError.js +39 -0
- package/node_modules/playwright-core/lib/client/webSocket.js +93 -0
- package/node_modules/playwright-core/lib/client/worker.js +85 -0
- package/node_modules/playwright-core/lib/client/writableStream.js +39 -0
- package/node_modules/playwright-core/lib/generated/bindingsControllerSource.js +28 -0
- package/node_modules/playwright-core/lib/generated/clockSource.js +28 -0
- package/node_modules/playwright-core/lib/generated/injectedScriptSource.js +28 -0
- package/node_modules/playwright-core/lib/generated/pollingRecorderSource.js +28 -0
- package/node_modules/playwright-core/lib/generated/storageScriptSource.js +28 -0
- package/node_modules/playwright-core/lib/generated/utilityScriptSource.js +28 -0
- package/node_modules/playwright-core/lib/generated/webSocketMockSource.js +336 -0
- package/node_modules/playwright-core/lib/inProcessFactory.js +60 -0
- package/node_modules/playwright-core/lib/inprocess.js +3 -0
- package/node_modules/playwright-core/lib/mcpBundle.js +84 -0
- package/node_modules/playwright-core/lib/mcpBundleImpl/index.js +147 -0
- package/node_modules/playwright-core/lib/outofprocess.js +76 -0
- package/node_modules/playwright-core/lib/protocol/serializers.js +197 -0
- package/node_modules/playwright-core/lib/protocol/validator.js +2969 -0
- package/node_modules/playwright-core/lib/protocol/validatorPrimitives.js +193 -0
- package/node_modules/playwright-core/lib/remote/playwrightConnection.js +129 -0
- package/node_modules/playwright-core/lib/remote/playwrightServer.js +334 -0
- package/node_modules/playwright-core/lib/server/agent/actionRunner.js +335 -0
- package/node_modules/playwright-core/lib/server/agent/actions.js +128 -0
- package/node_modules/playwright-core/lib/server/agent/codegen.js +111 -0
- package/node_modules/playwright-core/lib/server/agent/context.js +150 -0
- package/node_modules/playwright-core/lib/server/agent/expectTools.js +156 -0
- package/node_modules/playwright-core/lib/server/agent/pageAgent.js +204 -0
- package/node_modules/playwright-core/lib/server/agent/performTools.js +262 -0
- package/node_modules/playwright-core/lib/server/agent/tool.js +109 -0
- package/node_modules/playwright-core/lib/server/android/android.js +465 -0
- package/node_modules/playwright-core/lib/server/android/backendAdb.js +177 -0
- package/node_modules/playwright-core/lib/server/artifact.js +127 -0
- package/node_modules/playwright-core/lib/server/bidi/bidiBrowser.js +549 -0
- package/node_modules/playwright-core/lib/server/bidi/bidiChromium.js +149 -0
- package/node_modules/playwright-core/lib/server/bidi/bidiConnection.js +213 -0
- package/node_modules/playwright-core/lib/server/bidi/bidiDeserializer.js +116 -0
- package/node_modules/playwright-core/lib/server/bidi/bidiExecutionContext.js +267 -0
- package/node_modules/playwright-core/lib/server/bidi/bidiFirefox.js +128 -0
- package/node_modules/playwright-core/lib/server/bidi/bidiInput.js +146 -0
- package/node_modules/playwright-core/lib/server/bidi/bidiNetworkManager.js +383 -0
- package/node_modules/playwright-core/lib/server/bidi/bidiOverCdp.js +102 -0
- package/node_modules/playwright-core/lib/server/bidi/bidiPage.js +583 -0
- package/node_modules/playwright-core/lib/server/bidi/bidiPdf.js +106 -0
- package/node_modules/playwright-core/lib/server/bidi/third_party/bidiCommands.d.js +22 -0
- package/node_modules/playwright-core/lib/server/bidi/third_party/bidiKeyboard.js +256 -0
- package/node_modules/playwright-core/lib/server/bidi/third_party/bidiProtocol.js +24 -0
- package/node_modules/playwright-core/lib/server/bidi/third_party/bidiProtocolCore.js +180 -0
- package/node_modules/playwright-core/lib/server/bidi/third_party/bidiProtocolPermissions.js +42 -0
- package/node_modules/playwright-core/lib/server/bidi/third_party/bidiSerializer.js +148 -0
- package/node_modules/playwright-core/lib/server/bidi/third_party/firefoxPrefs.js +259 -0
- package/node_modules/playwright-core/lib/server/browser.js +149 -0
- package/node_modules/playwright-core/lib/server/browserContext.js +702 -0
- package/node_modules/playwright-core/lib/server/browserType.js +336 -0
- package/node_modules/playwright-core/lib/server/callLog.js +82 -0
- package/node_modules/playwright-core/lib/server/chromium/appIcon.png +0 -0
- package/node_modules/playwright-core/lib/server/chromium/chromium.js +397 -0
- package/node_modules/playwright-core/lib/server/chromium/chromiumSwitches.js +104 -0
- package/node_modules/playwright-core/lib/server/chromium/crBrowser.js +520 -0
- package/node_modules/playwright-core/lib/server/chromium/crConnection.js +197 -0
- package/node_modules/playwright-core/lib/server/chromium/crCoverage.js +235 -0
- package/node_modules/playwright-core/lib/server/chromium/crDevTools.js +111 -0
- package/node_modules/playwright-core/lib/server/chromium/crDragDrop.js +131 -0
- package/node_modules/playwright-core/lib/server/chromium/crExecutionContext.js +146 -0
- package/node_modules/playwright-core/lib/server/chromium/crInput.js +187 -0
- package/node_modules/playwright-core/lib/server/chromium/crNetworkManager.js +707 -0
- package/node_modules/playwright-core/lib/server/chromium/crPage.js +1001 -0
- package/node_modules/playwright-core/lib/server/chromium/crPdf.js +121 -0
- package/node_modules/playwright-core/lib/server/chromium/crProtocolHelper.js +145 -0
- package/node_modules/playwright-core/lib/server/chromium/crServiceWorker.js +136 -0
- package/node_modules/playwright-core/lib/server/chromium/defaultFontFamilies.js +162 -0
- package/node_modules/playwright-core/lib/server/chromium/protocol.d.js +16 -0
- package/node_modules/playwright-core/lib/server/clock.js +149 -0
- package/node_modules/playwright-core/lib/server/codegen/csharp.js +327 -0
- package/node_modules/playwright-core/lib/server/codegen/java.js +274 -0
- package/node_modules/playwright-core/lib/server/codegen/javascript.js +247 -0
- package/node_modules/playwright-core/lib/server/codegen/jsonl.js +52 -0
- package/node_modules/playwright-core/lib/server/codegen/language.js +132 -0
- package/node_modules/playwright-core/lib/server/codegen/languages.js +68 -0
- package/node_modules/playwright-core/lib/server/codegen/python.js +279 -0
- package/node_modules/playwright-core/lib/server/codegen/types.js +16 -0
- package/node_modules/playwright-core/lib/server/console.js +57 -0
- package/node_modules/playwright-core/lib/server/cookieStore.js +206 -0
- package/node_modules/playwright-core/lib/server/debugController.js +191 -0
- package/node_modules/playwright-core/lib/server/debugger.js +119 -0
- package/node_modules/playwright-core/lib/server/deviceDescriptors.js +39 -0
- package/node_modules/playwright-core/lib/server/deviceDescriptorsSource.json +1779 -0
- package/node_modules/playwright-core/lib/server/dialog.js +116 -0
- package/node_modules/playwright-core/lib/server/dispatchers/androidDispatcher.js +325 -0
- package/node_modules/playwright-core/lib/server/dispatchers/artifactDispatcher.js +118 -0
- package/node_modules/playwright-core/lib/server/dispatchers/browserContextDispatcher.js +384 -0
- package/node_modules/playwright-core/lib/server/dispatchers/browserDispatcher.js +118 -0
- package/node_modules/playwright-core/lib/server/dispatchers/browserTypeDispatcher.js +64 -0
- package/node_modules/playwright-core/lib/server/dispatchers/cdpSessionDispatcher.js +44 -0
- package/node_modules/playwright-core/lib/server/dispatchers/debugControllerDispatcher.js +78 -0
- package/node_modules/playwright-core/lib/server/dispatchers/dialogDispatcher.js +47 -0
- package/node_modules/playwright-core/lib/server/dispatchers/dispatcher.js +364 -0
- package/node_modules/playwright-core/lib/server/dispatchers/electronDispatcher.js +89 -0
- package/node_modules/playwright-core/lib/server/dispatchers/elementHandlerDispatcher.js +181 -0
- package/node_modules/playwright-core/lib/server/dispatchers/frameDispatcher.js +227 -0
- package/node_modules/playwright-core/lib/server/dispatchers/jsHandleDispatcher.js +85 -0
- package/node_modules/playwright-core/lib/server/dispatchers/jsonPipeDispatcher.js +58 -0
- package/node_modules/playwright-core/lib/server/dispatchers/localUtilsDispatcher.js +149 -0
- package/node_modules/playwright-core/lib/server/dispatchers/networkDispatchers.js +213 -0
- package/node_modules/playwright-core/lib/server/dispatchers/pageAgentDispatcher.js +96 -0
- package/node_modules/playwright-core/lib/server/dispatchers/pageDispatcher.js +393 -0
- package/node_modules/playwright-core/lib/server/dispatchers/playwrightDispatcher.js +108 -0
- package/node_modules/playwright-core/lib/server/dispatchers/streamDispatcher.js +67 -0
- package/node_modules/playwright-core/lib/server/dispatchers/tracingDispatcher.js +68 -0
- package/node_modules/playwright-core/lib/server/dispatchers/webSocketRouteDispatcher.js +165 -0
- package/node_modules/playwright-core/lib/server/dispatchers/writableStreamDispatcher.js +79 -0
- package/node_modules/playwright-core/lib/server/dom.js +815 -0
- package/node_modules/playwright-core/lib/server/download.js +70 -0
- package/node_modules/playwright-core/lib/server/electron/electron.js +273 -0
- package/node_modules/playwright-core/lib/server/electron/loader.js +29 -0
- package/node_modules/playwright-core/lib/server/errors.js +69 -0
- package/node_modules/playwright-core/lib/server/fetch.js +621 -0
- package/node_modules/playwright-core/lib/server/fileChooser.js +43 -0
- package/node_modules/playwright-core/lib/server/fileUploadUtils.js +84 -0
- package/node_modules/playwright-core/lib/server/firefox/ffBrowser.js +418 -0
- package/node_modules/playwright-core/lib/server/firefox/ffConnection.js +142 -0
- package/node_modules/playwright-core/lib/server/firefox/ffExecutionContext.js +150 -0
- package/node_modules/playwright-core/lib/server/firefox/ffInput.js +159 -0
- package/node_modules/playwright-core/lib/server/firefox/ffNetworkManager.js +256 -0
- package/node_modules/playwright-core/lib/server/firefox/ffPage.js +497 -0
- package/node_modules/playwright-core/lib/server/firefox/firefox.js +114 -0
- package/node_modules/playwright-core/lib/server/firefox/protocol.d.js +16 -0
- package/node_modules/playwright-core/lib/server/formData.js +147 -0
- package/node_modules/playwright-core/lib/server/frameSelectors.js +160 -0
- package/node_modules/playwright-core/lib/server/frames.js +1471 -0
- package/node_modules/playwright-core/lib/server/har/harRecorder.js +147 -0
- package/node_modules/playwright-core/lib/server/har/harTracer.js +607 -0
- package/node_modules/playwright-core/lib/server/harBackend.js +157 -0
- package/node_modules/playwright-core/lib/server/helper.js +96 -0
- package/node_modules/playwright-core/lib/server/index.js +58 -0
- package/node_modules/playwright-core/lib/server/input.js +277 -0
- package/node_modules/playwright-core/lib/server/instrumentation.js +72 -0
- package/node_modules/playwright-core/lib/server/javascript.js +291 -0
- package/node_modules/playwright-core/lib/server/launchApp.js +128 -0
- package/node_modules/playwright-core/lib/server/localUtils.js +214 -0
- package/node_modules/playwright-core/lib/server/macEditingCommands.js +143 -0
- package/node_modules/playwright-core/lib/server/network.js +667 -0
- package/node_modules/playwright-core/lib/server/page.js +830 -0
- package/node_modules/playwright-core/lib/server/pipeTransport.js +89 -0
- package/node_modules/playwright-core/lib/server/playwright.js +69 -0
- package/node_modules/playwright-core/lib/server/progress.js +132 -0
- package/node_modules/playwright-core/lib/server/protocolError.js +52 -0
- package/node_modules/playwright-core/lib/server/recorder/chat.js +161 -0
- package/node_modules/playwright-core/lib/server/recorder/recorderApp.js +366 -0
- package/node_modules/playwright-core/lib/server/recorder/recorderRunner.js +138 -0
- package/node_modules/playwright-core/lib/server/recorder/recorderSignalProcessor.js +83 -0
- package/node_modules/playwright-core/lib/server/recorder/recorderUtils.js +157 -0
- package/node_modules/playwright-core/lib/server/recorder/throttledFile.js +57 -0
- package/node_modules/playwright-core/lib/server/recorder.js +499 -0
- package/node_modules/playwright-core/lib/server/registry/browserFetcher.js +177 -0
- package/node_modules/playwright-core/lib/server/registry/dependencies.js +371 -0
- package/node_modules/playwright-core/lib/server/registry/index.js +1422 -0
- package/node_modules/playwright-core/lib/server/registry/nativeDeps.js +1280 -0
- package/node_modules/playwright-core/lib/server/registry/oopDownloadBrowserMain.js +127 -0
- package/node_modules/playwright-core/lib/server/screencast.js +190 -0
- package/node_modules/playwright-core/lib/server/screenshotter.js +333 -0
- package/node_modules/playwright-core/lib/server/selectors.js +112 -0
- package/node_modules/playwright-core/lib/server/socksClientCertificatesInterceptor.js +383 -0
- package/node_modules/playwright-core/lib/server/socksInterceptor.js +95 -0
- package/node_modules/playwright-core/lib/server/trace/recorder/snapshotter.js +147 -0
- package/node_modules/playwright-core/lib/server/trace/recorder/snapshotterInjected.js +561 -0
- package/node_modules/playwright-core/lib/server/trace/recorder/tracing.js +604 -0
- package/node_modules/playwright-core/lib/server/trace/viewer/traceParser.js +72 -0
- package/node_modules/playwright-core/lib/server/trace/viewer/traceViewer.js +245 -0
- package/node_modules/playwright-core/lib/server/transport.js +181 -0
- package/node_modules/playwright-core/lib/server/types.js +28 -0
- package/node_modules/playwright-core/lib/server/usKeyboardLayout.js +145 -0
- package/node_modules/playwright-core/lib/server/utils/ascii.js +44 -0
- package/node_modules/playwright-core/lib/server/utils/comparators.js +139 -0
- package/node_modules/playwright-core/lib/server/utils/crypto.js +216 -0
- package/node_modules/playwright-core/lib/server/utils/debug.js +42 -0
- package/node_modules/playwright-core/lib/server/utils/debugLogger.js +122 -0
- package/node_modules/playwright-core/lib/server/utils/env.js +73 -0
- package/node_modules/playwright-core/lib/server/utils/eventsHelper.js +39 -0
- package/node_modules/playwright-core/lib/server/utils/expectUtils.js +123 -0
- package/node_modules/playwright-core/lib/server/utils/fileUtils.js +191 -0
- package/node_modules/playwright-core/lib/server/utils/happyEyeballs.js +207 -0
- package/node_modules/playwright-core/lib/server/utils/hostPlatform.js +138 -0
- package/node_modules/playwright-core/lib/server/utils/httpServer.js +203 -0
- package/node_modules/playwright-core/lib/server/utils/imageUtils.js +141 -0
- package/node_modules/playwright-core/lib/server/utils/image_tools/colorUtils.js +89 -0
- package/node_modules/playwright-core/lib/server/utils/image_tools/compare.js +109 -0
- package/node_modules/playwright-core/lib/server/utils/image_tools/imageChannel.js +78 -0
- package/node_modules/playwright-core/lib/server/utils/image_tools/stats.js +102 -0
- package/node_modules/playwright-core/lib/server/utils/linuxUtils.js +71 -0
- package/node_modules/playwright-core/lib/server/utils/network.js +242 -0
- package/node_modules/playwright-core/lib/server/utils/nodePlatform.js +154 -0
- package/node_modules/playwright-core/lib/server/utils/pipeTransport.js +84 -0
- package/node_modules/playwright-core/lib/server/utils/processLauncher.js +241 -0
- package/node_modules/playwright-core/lib/server/utils/profiler.js +65 -0
- package/node_modules/playwright-core/lib/server/utils/socksProxy.js +511 -0
- package/node_modules/playwright-core/lib/server/utils/spawnAsync.js +41 -0
- package/node_modules/playwright-core/lib/server/utils/task.js +51 -0
- package/node_modules/playwright-core/lib/server/utils/userAgent.js +98 -0
- package/node_modules/playwright-core/lib/server/utils/wsServer.js +121 -0
- package/node_modules/playwright-core/lib/server/utils/zipFile.js +74 -0
- package/node_modules/playwright-core/lib/server/utils/zones.js +57 -0
- package/node_modules/playwright-core/lib/server/videoRecorder.js +124 -0
- package/node_modules/playwright-core/lib/server/webkit/protocol.d.js +16 -0
- package/node_modules/playwright-core/lib/server/webkit/webkit.js +108 -0
- package/node_modules/playwright-core/lib/server/webkit/wkBrowser.js +335 -0
- package/node_modules/playwright-core/lib/server/webkit/wkConnection.js +144 -0
- package/node_modules/playwright-core/lib/server/webkit/wkExecutionContext.js +154 -0
- package/node_modules/playwright-core/lib/server/webkit/wkInput.js +181 -0
- package/node_modules/playwright-core/lib/server/webkit/wkInterceptableRequest.js +197 -0
- package/node_modules/playwright-core/lib/server/webkit/wkPage.js +1159 -0
- package/node_modules/playwright-core/lib/server/webkit/wkProvisionalPage.js +83 -0
- package/node_modules/playwright-core/lib/server/webkit/wkWorkers.js +105 -0
- package/node_modules/playwright-core/lib/third_party/pixelmatch.js +255 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/ariaSnapshot.js +455 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/assert.js +31 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/colors.js +72 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/cssParser.js +245 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/cssTokenizer.js +1051 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/headers.js +53 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/locatorGenerators.js +689 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/locatorParser.js +176 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/locatorUtils.js +81 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/lruCache.js +51 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/manualPromise.js +114 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/mimeType.js +459 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/multimap.js +80 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/protocolFormatter.js +81 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/protocolMetainfo.js +330 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/rtti.js +43 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/selectorParser.js +386 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/semaphore.js +54 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/stackTrace.js +158 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/stringUtils.js +204 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/time.js +49 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/timeoutRunner.js +66 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/trace/entries.js +16 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/trace/snapshotRenderer.js +499 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/trace/snapshotServer.js +120 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/trace/snapshotStorage.js +89 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/trace/traceLoader.js +131 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/trace/traceModel.js +365 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/trace/traceModernizer.js +400 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/trace/versions/traceV3.js +16 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/trace/versions/traceV4.js +16 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/trace/versions/traceV5.js +16 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/trace/versions/traceV6.js +16 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/trace/versions/traceV7.js +16 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/trace/versions/traceV8.js +16 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/traceUtils.js +58 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/types.js +16 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/urlMatch.js +190 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/utilityScriptSerializers.js +251 -0
- package/node_modules/playwright-core/lib/utils/isomorphic/yaml.js +84 -0
- package/node_modules/playwright-core/lib/utils.js +111 -0
- package/node_modules/playwright-core/lib/utilsBundle.js +109 -0
- package/node_modules/playwright-core/lib/utilsBundleImpl/index.js +218 -0
- package/node_modules/playwright-core/lib/utilsBundleImpl/xdg-open +1066 -0
- package/node_modules/playwright-core/lib/vite/htmlReport/index.html +84 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-DYBRYzYX.css +1 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-DadYNm1I.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-BSjZa4pk.css +1 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-BhTWtUlo.js +193 -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-a5XoALAZ.js +32 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-CJSZINFr.js +266 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/xtermModule-CsJ4vdCR.js +9 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.DYBRYzYX.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.7ch9cixO.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.BDwrLSGN.js +2 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.BVu7tZDe.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.html +43 -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.html +21 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/sw.bundle.js +5 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.Btcz36p_.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.CQJ9SCIQ.js +5 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +17 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.DYP7pi_n.css +32 -0
- package/node_modules/playwright-core/lib/zipBundle.js +34 -0
- package/node_modules/playwright-core/lib/zipBundleImpl.js +5 -0
- package/node_modules/playwright-core/package.json +43 -0
- package/node_modules/playwright-core/types/protocol.d.ts +23824 -0
- package/node_modules/playwright-core/types/structs.d.ts +45 -0
- package/node_modules/playwright-core/types/types.d.ts +22843 -0
- package/package.json +6 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import * as crypto from "crypto";
|
|
1
2
|
import { WorkspaceAuthType } from "../../utils/workspaceAuth.js";
|
|
2
|
-
import {
|
|
3
|
+
import { buildToolWorkflows, buildTestPatternGuidelines, buildTestQualityCriteria, buildTestExamples, buildGenerationRules, getAuthSnippets, MAX_TESTS_TO_GENERATE, MAX_RECOMMENDATIONS, MAX_CRITICAL_TESTS, } from "./recommendationSections.js";
|
|
3
4
|
function formatTestLocations(locs) {
|
|
4
5
|
const entries = Object.entries(locs || {});
|
|
5
6
|
if (entries.length === 0)
|
|
@@ -7,7 +8,221 @@ function formatTestLocations(locs) {
|
|
|
7
8
|
return "\n**Existing test files (do NOT duplicate these):**\n" +
|
|
8
9
|
entries.map(([type, files]) => " - [" + type + "] " + files).join("\n");
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
+
const CATEGORY_PRIORITY = {
|
|
12
|
+
new_endpoint: "CRITICAL", // diff-direct scenarios always fill GENERATE slots first
|
|
13
|
+
security_boundary: "HIGH",
|
|
14
|
+
business_rule: "HIGH",
|
|
15
|
+
data_integrity: "HIGH",
|
|
16
|
+
breaking_change: "HIGH",
|
|
17
|
+
auth: "HIGH",
|
|
18
|
+
workflow: "MEDIUM",
|
|
19
|
+
"error-handling": "MEDIUM",
|
|
20
|
+
"data-validation": "MEDIUM",
|
|
21
|
+
crud: "LOW",
|
|
22
|
+
};
|
|
23
|
+
const PRIORITY_ORDER = { CRITICAL: 4, HIGH: 3, MEDIUM: 2, LOW: 1 };
|
|
24
|
+
const NOVELTY_ORDER = { new: 3, modified: 2, existing: 1 };
|
|
25
|
+
function classifyNovelty(scenario, diffContext) {
|
|
26
|
+
if (!diffContext)
|
|
27
|
+
return "existing";
|
|
28
|
+
const paths = scenario.steps.map(s => s.path);
|
|
29
|
+
const newPaths = new Set((diffContext.newEndpoints || []).map(ep => ep.path));
|
|
30
|
+
const modPaths = new Set((diffContext.modifiedEndpoints || []).map(ep => ep.path));
|
|
31
|
+
if (paths.some(p => newPaths.has(p)))
|
|
32
|
+
return "new";
|
|
33
|
+
if (paths.some(p => modPaths.has(p)))
|
|
34
|
+
return "modified";
|
|
35
|
+
return "existing";
|
|
36
|
+
}
|
|
37
|
+
function prioritiseCandidate(scenario, diffContext) {
|
|
38
|
+
const priority = CATEGORY_PRIORITY[scenario.category] ?? "LOW";
|
|
39
|
+
const novelty = classifyNovelty(scenario, diffContext);
|
|
40
|
+
return { priority, novelty };
|
|
41
|
+
}
|
|
42
|
+
function computeTiebreakerSeed(endpoints, diffFiles) {
|
|
43
|
+
const canonical = [...endpoints].sort().join("|") + "::" + [...diffFiles].sort().join("|");
|
|
44
|
+
return crypto.createHash("sha256").update(canonical).digest("hex").slice(0, 8);
|
|
45
|
+
}
|
|
46
|
+
// ── Execution Plan (replaces pre-ranked + scenarios + heuristic sections) ──
|
|
47
|
+
function buildExecutionPlan(scored, maxGen, topN, baseUrl, authHeaderValue, authSchemeSnippet, authTypeValue, seed, endpointCount, isUIOnlyPR, hasFrontendChanges = false, hasTraces = false) {
|
|
48
|
+
const generateItems = scored.slice(0, Math.min(maxGen, scored.length));
|
|
49
|
+
const additionalItems = scored.slice(maxGen, topN);
|
|
50
|
+
const authRef = authHeaderValue
|
|
51
|
+
? `, authHeader: "${authHeaderValue}"${authSchemeSnippet}`
|
|
52
|
+
: `, authHeader: <check OpenAPI securitySchemes or auth middleware; "" if confirmed unauthenticated>`;
|
|
53
|
+
const hasWorkspaceAuthType = !!authTypeValue && authTypeValue !== "none";
|
|
54
|
+
// For skyramp_scenario_test_generation: always embed full auth so the generated test file
|
|
55
|
+
// includes the correct Authorization header at execution time.
|
|
56
|
+
// The workspace authType conflict only applies to skyramp_integration_test_generation (not scenario gen).
|
|
57
|
+
const scenarioAuthRef = authRef;
|
|
58
|
+
// For skyramp_integration_test_generation with scenarioFile:
|
|
59
|
+
// - If workspace has authType set: omit auth entirely — workspace handles Bearer prefix.
|
|
60
|
+
// - If no authType: pass authHeader only (no authScheme).
|
|
61
|
+
const authHeaderOnlyRef = hasWorkspaceAuthType
|
|
62
|
+
? ""
|
|
63
|
+
: authHeaderValue
|
|
64
|
+
? `, authHeader: "${authHeaderValue}"`
|
|
65
|
+
: `, authHeader: <check OpenAPI securitySchemes or auth middleware; "" if confirmed unauthenticated>`;
|
|
66
|
+
const generateBlocks = generateItems.map((item, i) => {
|
|
67
|
+
const rank = i + 1;
|
|
68
|
+
const s = item.scenario;
|
|
69
|
+
const testType = s.testType ?? (s.steps.length === 1 ? "contract" : "integration");
|
|
70
|
+
if (testType === "contract") {
|
|
71
|
+
const step = s.steps[0];
|
|
72
|
+
const endpointURL = `${baseUrl}${step.path}`;
|
|
73
|
+
const isBodyMethod = ["POST", "PUT", "PATCH"].includes(step.method);
|
|
74
|
+
const dataParam = isBodyMethod
|
|
75
|
+
? `, requestData: <${step.method} ${step.path} body from source code schemas>`
|
|
76
|
+
: "";
|
|
77
|
+
return (`**#${rank} — GENERATE** | ${testType} | ${s.category} | priority=${item.priority} | ${item.novelty}\n` +
|
|
78
|
+
`${step.method} ${step.path} → ${step.expectedStatusCode}\n` +
|
|
79
|
+
`Tool: skyramp_contract_test_generation({ endpointURL: "${endpointURL}", method: "${step.method}"${authRef}${dataParam} })\n` + // contract tests always use full authRef
|
|
80
|
+
`From source: authScheme (OpenAPI securitySchemes or auth middleware)${isBodyMethod ? "; requestData field shapes" : ""}`);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
// integration / e2e / ui — multi-step scenario pipeline
|
|
84
|
+
const stepLines = s.steps.map((st) => {
|
|
85
|
+
const chains = st.chainsFrom
|
|
86
|
+
? ` (chains: ${Array.isArray(st.chainsFrom)
|
|
87
|
+
? st.chainsFrom.map(c => `${c.sourceField} from step ${c.sourceStep}`).join(", ")
|
|
88
|
+
: `${st.chainsFrom.sourceField} from step ${st.chainsFrom.sourceStep}`})`
|
|
89
|
+
: "";
|
|
90
|
+
return ` ${st.order}. ${st.method} ${st.path} → ${st.expectedStatusCode}: ${st.description}${chains}`;
|
|
91
|
+
}).join("\n");
|
|
92
|
+
const toolCalls = s.steps.map((st) => {
|
|
93
|
+
const isBodyMethod = ["POST", "PUT", "PATCH"].includes(st.method);
|
|
94
|
+
const dataParam = isBodyMethod
|
|
95
|
+
? `, requestBody: <${st.method} ${st.path} body from source code schemas>`
|
|
96
|
+
: "";
|
|
97
|
+
return ` skyramp_scenario_test_generation({ scenarioName: "${s.scenarioName}", destination: "${s.scenarioName}", baseURL: "${baseUrl}", method: "${st.method}", path: "${st.path}", statusCode: ${st.expectedStatusCode}${scenarioAuthRef}${dataParam} })`;
|
|
98
|
+
}).join("\n");
|
|
99
|
+
const prereqNote = s.category === "new_endpoint"
|
|
100
|
+
? `\nPrerequisite discovery (MANDATORY for new_endpoint): Before executing these tool calls, read the source code for the new endpoint's request body. Look for FK fields (e.g. \`product_id\`, \`user_id\`, \`order_id\`). For each FK field found, prepend one \`skyramp_scenario_test_generation\` call to create that prerequisite resource first, then chain its \`id\` into the dependent step. If no FK fields exist, proceed with the steps above as-is.`
|
|
101
|
+
: "";
|
|
102
|
+
return (`**#${rank} — GENERATE** | ${testType} | ${s.category} | priority=${item.priority} | ${item.novelty}\n` +
|
|
103
|
+
`Scenario: ${s.scenarioName} (${s.steps.length} steps)\n` +
|
|
104
|
+
`${stepLines}\n` +
|
|
105
|
+
`Tool calls:\n` +
|
|
106
|
+
`${toolCalls}\n` +
|
|
107
|
+
` skyramp_integration_test_generation({ scenarioFile: "scenario_${s.scenarioName}.json"${authHeaderOnlyRef} })\n` +
|
|
108
|
+
`From source: requestBody shapes for POST/PUT/PATCH steps; responseBody shapes; authScheme` +
|
|
109
|
+
prereqNote);
|
|
110
|
+
}
|
|
111
|
+
}).join("\n\n");
|
|
112
|
+
// For mixed PRs, always reserve slots for UI and E2E recommendations regardless of whether
|
|
113
|
+
// traces already exist — the user can record them later or the bot can record during the run.
|
|
114
|
+
const needsE2ESlot = hasFrontendChanges && !isUIOnlyPR;
|
|
115
|
+
const needsUISlot = hasFrontendChanges && !isUIOnlyPR;
|
|
116
|
+
const frontendSlots = (needsE2ESlot ? 1 : 0) + (needsUISlot ? 1 : 0);
|
|
117
|
+
const backendAdditionalItems = frontendSlots > 0
|
|
118
|
+
? additionalItems.slice(0, Math.max(additionalItems.length - frontendSlots, 0))
|
|
119
|
+
: additionalItems;
|
|
120
|
+
// Additional items — compact listing, no tool calls needed
|
|
121
|
+
const additionalLines = backendAdditionalItems.map((item, i) => {
|
|
122
|
+
const rank = maxGen + i + 1;
|
|
123
|
+
const s = item.scenario;
|
|
124
|
+
const testType = s.testType ?? (s.steps.length === 1 ? "contract" : "integration");
|
|
125
|
+
const target = s.steps.length === 1
|
|
126
|
+
? `${s.steps[0].method} ${s.steps[0].path} → ${s.steps[0].expectedStatusCode}`
|
|
127
|
+
: `Scenario: ${s.scenarioName} (${s.steps.map(st => `${st.method} ${st.path}`).join(" → ")})`;
|
|
128
|
+
return `#${rank} [ADDITIONAL] | ${testType} | ${s.category} | priority=${item.priority} | ${item.novelty}\n ${target}\n Validates: ${s.description}`;
|
|
129
|
+
}).join("\n\n");
|
|
130
|
+
const uiSlotLine = needsUISlot ? (() => {
|
|
131
|
+
const rank = maxGen + backendAdditionalItems.length + 1;
|
|
132
|
+
const traceNote = hasTraces
|
|
133
|
+
? "Use an existing Playwright `.zip` trace from the repo."
|
|
134
|
+
: "Record a trace using `browser_navigate` + `browser_snapshot` + `skyramp_export_zip`, then call `skyramp_ui_test_generation`.";
|
|
135
|
+
return `\n\n#${rank} [ADDITIONAL] | UI | workflow | priority=HIGH | new\n Scenario: ui-interaction-for-changed-components (frontend files changed in this diff)\n Validates: Component-level interaction flow for the changed UI — derive the scenario name and steps from the actual changed frontend files. ${traceNote}`;
|
|
136
|
+
})() : "";
|
|
137
|
+
const e2eSlotLine = needsE2ESlot ? (() => {
|
|
138
|
+
const rank = maxGen + backendAdditionalItems.length + (needsUISlot ? 1 : 0) + 1;
|
|
139
|
+
const traceNote = hasTraces
|
|
140
|
+
? "Call `skyramp_e2e_test_generation` with the discovered trace/recording files."
|
|
141
|
+
: "No traces exist yet — record a backend trace via `skyramp_start_trace_collection` + `skyramp_stop_trace_collection` and a UI trace via Playwright browser tools, then call `skyramp_e2e_test_generation`.";
|
|
142
|
+
return `\n\n#${rank} [ADDITIONAL] | E2E | workflow | priority=HIGH | new\n Scenario: e2e-flow-for-changed-feature (frontend + backend files changed in this diff)\n Validates: Full browser-level flow for the changed UI components end-to-end — derive the scenario name and steps from the actual changed frontend files. ${traceNote}`;
|
|
143
|
+
})() : "";
|
|
144
|
+
const supplementCount = topN - generateItems.length - backendAdditionalItems.length - frontendSlots;
|
|
145
|
+
const supplementNote = supplementCount > 0
|
|
146
|
+
? `\n**REQUIRED — You MUST add ${supplementCount} more to reach the total of ${topN}.** Draft them from endpoint interactions and source code patterns not yet covered. Use the same 5-dimension rubric and quality gate to assign priority (HIGH/MEDIUM/LOW), testType, and category.${hasFrontendChanges && !isUIOnlyPR ? " Since this PR has frontend changes, at least 1 of these should be a UI or E2E test targeting the changed components." : ""} Do NOT produce fewer than ${topN} total.`
|
|
147
|
+
: "";
|
|
148
|
+
return `## Execution Plan
|
|
149
|
+
Seed: ${seed} | Endpoints: ${endpointCount} | Budget: ${generateItems.length} generate + ${Math.max(topN - generateItems.length, 0)} additional = ${topN} total
|
|
150
|
+
|
|
151
|
+
**Step 1 — Source-Code Enrichment (MANDATORY before executing anything)**
|
|
152
|
+
Read the source code for ALL changed files. Look for:
|
|
153
|
+
- **Auth middleware** (passport, jwt.verify, authMiddleware, @requires_auth, Depends(get_current_user), @UseGuards, EnsureSessionDep, session middleware) — if found, override \`authHeader\` and \`authScheme\` in scenario and contract tool calls even if workspace.yml says authType: none. Exception: for \`skyramp_integration_test_generation\` with \`scenarioFile\`, omit auth params entirely if workspace has \`api.authType\` set (workspace handles it); if workspace has no \`authType\`, pass \`authHeader\` only.
|
|
154
|
+
- Business rules and formulas (e.g. total_cost = compute * rate + memory * rate)
|
|
155
|
+
- State transitions and domain constraints (e.g. budget cannot drop below current spend)
|
|
156
|
+
- Validation logic (field constraints, cross-field dependencies)
|
|
157
|
+
- Security boundaries not covered by the structural candidates below
|
|
158
|
+
|
|
159
|
+
For each one found, evaluate it against these 5 dimensions and assign priority:
|
|
160
|
+
| Dimension | What to assess |
|
|
161
|
+
| Production Safety | Guards a critical boundary (auth, unique constraint, cascade delete, data integrity, breaking migration)? → HIGH |
|
|
162
|
+
| Bug-Finding Potential | Targets a known failure mode (race condition, data consistency, state transition, cascade effect)? → HIGH |
|
|
163
|
+
| User Journey Relevance | Reflects how real users interact (from traces, business flows, critical paths)? → HIGH or MEDIUM |
|
|
164
|
+
| Coverage Gap | Addresses an area with zero existing test coverage? → bump up one tier |
|
|
165
|
+
| Code Insight | Derived from actual implementation (spotted middleware pattern, N+1 risk, unique constraint)? → bump up one tier |
|
|
166
|
+
|
|
167
|
+
Quality gate — ask both questions:
|
|
168
|
+
1. "Would this test prevent a production incident?" → YES = HIGH priority regardless of other dimensions
|
|
169
|
+
2. "Does this test exercise a real workflow or catch a real bug?" → YES = at least MEDIUM
|
|
170
|
+
|
|
171
|
+
Assign category: security_boundary | business_rule | data_integrity | breaking_change | auth | workflow | error-handling | data-validation | crud
|
|
172
|
+
|
|
173
|
+
${buildTestPatternGuidelines()}
|
|
174
|
+
|
|
175
|
+
${buildTestExamples()}
|
|
176
|
+
|
|
177
|
+
INSERT a source-code-derived candidate into the ranked list **only if ALL three conditions are met**:
|
|
178
|
+
1. Priority is HIGH (it guards a critical boundary or would prevent a production incident)
|
|
179
|
+
2. It is specific to THIS codebase — derived from a concrete business rule, formula, or constraint found in the changed files (not a general pattern that applies to any API)
|
|
180
|
+
3. It is not already covered by a structural candidate in the list below
|
|
181
|
+
|
|
182
|
+
If these conditions are not met, add it to ADDITIONAL only — do NOT displace a pre-ranked GENERATE item.
|
|
183
|
+
|
|
184
|
+
When a qualifying candidate is inserted: place it HIGH before MEDIUM before LOW; within the same priority, source-code-derived candidates go BEFORE structural ones. Re-number ranks after insertion. The top ${generateItems.length} become GENERATE items.
|
|
185
|
+
|
|
186
|
+
**Cascade vs referential integrity:** If both a \`cascade-delete\` and a \`delete-blocked\` scenario appear for the same resource pair, keep only the one that matches the source code's FK delete policy (e.g. \`ON DELETE CASCADE\`, \`cascade=True\`, or \`onDelete: 'CASCADE'\` → keep cascade-delete; \`RESTRICT\`/\`PROTECT\`/no cascade → keep delete-blocked). Remove the inapplicable variant before executing.
|
|
187
|
+
|
|
188
|
+
**Unique constraints:** Unique-constraint scenarios (duplicate POST → expect 409) are pre-drafted for all resources. Before keeping them, check whether the storage backend actually enforces uniqueness — look for SQL \`UNIQUE\` indexes, Mongoose \`unique: true\`, Prisma \`@unique\`, or explicit duplicate-check logic in the source. If the backend is Redis, an in-memory store, or a schema-less DB with no explicit unique constraint in the changed files, move the unique-constraint scenario to ADDITIONAL with a note that enforcement is unconfirmed — do NOT generate it as a GENERATE item.
|
|
189
|
+
|
|
190
|
+
**Step 2 — Execute merged plan in rank order**
|
|
191
|
+
Replace any scenario that pairs unrelated resources with one reflecting actual FK relationships in the codebase.
|
|
192
|
+
Use realistic request bodies from source code schemas; verify response data (not just status codes).
|
|
193
|
+
|
|
194
|
+
${buildTestQualityCriteria()}
|
|
195
|
+
|
|
196
|
+
${buildGenerationRules(isUIOnlyPR)}
|
|
197
|
+
|
|
198
|
+
**Per-recommendation format** (apply to all items — GENERATE and ADDITIONAL):
|
|
199
|
+
1. Test type 2. Category 3. Priority (HIGH/MEDIUM/LOW) 4. Target endpoint/scenario
|
|
200
|
+
5. What it validates (business logic — not just "tests the endpoint")
|
|
201
|
+
6. Exact tool call with key params for zero-editing execution
|
|
202
|
+
7. For integration/E2E: reference draftedScenario by scenarioName
|
|
203
|
+
8. Reasoning — the specific production risk prevented or business rule enforced
|
|
204
|
+
|
|
205
|
+
**Never mark a recommendation "blocked":** No OpenAPI spec → use source code for shapes. No traces → provide \`skyramp_start_trace_collection\` instructions. No backend trace → use the scenario pipeline.
|
|
206
|
+
|
|
207
|
+
**Critical-category minimum:** At least ${Math.min(MAX_CRITICAL_TESTS, maxGen)} of the ${maxGen} GENERATE items MUST be from HIGH-priority categories (security_boundary, business_rule, data_integrity, breaking_change). The pre-ranked plan below already prioritises this — only override if source-code enrichment reveals a higher-value candidate.
|
|
208
|
+
|
|
209
|
+
### GENERATE (execute these in order after Step 1 insertion, one retry on failure then skip)
|
|
210
|
+
|
|
211
|
+
${generateBlocks || " (no pre-ranked generate items — draft your own based on endpoint analysis)"}
|
|
212
|
+
|
|
213
|
+
### ADDITIONAL (list in additionalRecommendations in this order after Step 1 insertion)
|
|
214
|
+
|
|
215
|
+
${additionalLines || " (none pre-ranked)"}${uiSlotLine}${e2eSlotLine}
|
|
216
|
+
${supplementNote}
|
|
217
|
+
|
|
218
|
+
**You MUST produce EXACTLY ${topN} total recommendations: ${generateItems.length} to generate + ${Math.max(topN - generateItems.length, 0)} as additionalRecommendations. Do NOT produce fewer. Generate recommendations now.**
|
|
219
|
+
|
|
220
|
+
## Recommendation Stability
|
|
221
|
+
- **Carry forward** previous additionalRecommendations that still apply — match by scenarioName (multi-step) or endpoint (single-endpoint). Re-derive category and priority from test content.
|
|
222
|
+
- **Only drop** a previous recommendation if its target endpoint was removed, its business logic changed, or it is now covered by a generated test.
|
|
223
|
+
- **Only add** new recommendations for code paths introduced since the last run.`;
|
|
224
|
+
}
|
|
225
|
+
export function buildRecommendationPrompt(analysis, analysisScope = "full_repo", topN = MAX_RECOMMENDATIONS, prContext, workspaceAuthHeader, workspaceAuthType) {
|
|
11
226
|
const isDiffScope = analysisScope === "current_branch_diff";
|
|
12
227
|
const diffContext = analysis.branchDiffContext;
|
|
13
228
|
const openApiSpec = analysis.artifacts?.openApiSpecs?.[0];
|
|
@@ -30,12 +245,14 @@ export function buildRecommendationPrompt(analysis, analysisScope = "full_repo",
|
|
|
30
245
|
? (diffContext.newEndpoints.length > 0 || diffContext.modifiedEndpoints.length > 0)
|
|
31
246
|
: false;
|
|
32
247
|
const isUIOnlyPR = hasFrontendChanges && !hasApiChanges;
|
|
248
|
+
const hasTraces = (analysis.artifacts?.traceFiles?.length ?? 0) > 0 ||
|
|
249
|
+
(analysis.artifacts?.playwrightRecordings?.length ?? 0) > 0;
|
|
33
250
|
// ── Mode preamble ──
|
|
34
251
|
const modePreamble = isDiffScope
|
|
35
252
|
? `You are in **PR mode**. Maximize test coverage for the branch changes.
|
|
36
253
|
Focus on tests that validate the changed fields, endpoints, and their interactions.
|
|
37
254
|
${isUIOnlyPR ? `\n**UI-only PR** — no backend changes. UI and E2E tests are most relevant.`
|
|
38
|
-
: hasFrontendChanges ? `\n**Mixed PR** — both frontend and backend changes detected.`
|
|
255
|
+
: hasFrontendChanges ? `\n**Mixed PR** — both frontend and backend changes detected. Backend and E2E/UI tests are both required.`
|
|
39
256
|
: ``}
|
|
40
257
|
Output should be concise and immediately actionable.`
|
|
41
258
|
: `You are in **Repo mode**. Comprehensive test strategy across all endpoints.`;
|
|
@@ -58,7 +275,7 @@ Output should be concise and immediately actionable.`
|
|
|
58
275
|
: /api[_-]?key/i.test(authMethod) ? "X-API-Key"
|
|
59
276
|
: "Authorization";
|
|
60
277
|
}
|
|
61
|
-
const { authSchemeSnippet
|
|
278
|
+
const { authSchemeSnippet } = getAuthSnippets(authHeaderValue, authTypeValue);
|
|
62
279
|
const sourcePriority = `
|
|
63
280
|
## Source Priority
|
|
64
281
|
When information conflicts, prefer: **Traces** (actual behavior) > **Code** (implemented behavior) > **Spec/Docs** (documented behavior).
|
|
@@ -123,80 +340,120 @@ ${isDiffScope ? "Changed endpoints only. " : ""}Use source code schemas (Zod/Pyd
|
|
|
123
340
|
${detailBlocks}
|
|
124
341
|
`;
|
|
125
342
|
}
|
|
126
|
-
// ──
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
343
|
+
// ── Scoring ──
|
|
344
|
+
const endpointCount = allEndpoints.reduce((acc, ep) => acc + (ep.methods ?? []).length, 0);
|
|
345
|
+
const maxGen = isUIOnlyPR ? (hasTraces ? MAX_TESTS_TO_GENERATE : 0) : MAX_TESTS_TO_GENERATE;
|
|
346
|
+
const scenarios = analysis.businessContext.draftedScenarios;
|
|
347
|
+
let scored = [];
|
|
348
|
+
let seed = "";
|
|
349
|
+
if (!isUIOnlyPR && scenarios.length > 0) {
|
|
350
|
+
const diffFiles = filteredChangedFiles; // use filtered list so bot-committed test files don't shift the seed
|
|
351
|
+
const endpointPaths = allEndpoints.map(ep => ep.path);
|
|
352
|
+
seed = computeTiebreakerSeed(endpointPaths, diffFiles);
|
|
353
|
+
scored = scenarios.map(s => {
|
|
354
|
+
const result = prioritiseCandidate(s, diffContext ?? undefined);
|
|
355
|
+
return { scenario: s, ...result };
|
|
356
|
+
});
|
|
357
|
+
scored.sort((a, b) => {
|
|
358
|
+
const pa = PRIORITY_ORDER[a.priority], pb = PRIORITY_ORDER[b.priority];
|
|
359
|
+
if (pb !== pa)
|
|
360
|
+
return pb - pa;
|
|
361
|
+
const na = NOVELTY_ORDER[a.novelty], nb = NOVELTY_ORDER[b.novelty];
|
|
362
|
+
if (nb !== na)
|
|
363
|
+
return nb - na;
|
|
364
|
+
const crossA = a.scenario.steps.length > 2 ? 1 : 0;
|
|
365
|
+
const crossB = b.scenario.steps.length > 2 ? 1 : 0;
|
|
366
|
+
if (crossB !== crossA)
|
|
367
|
+
return crossB - crossA;
|
|
368
|
+
if (b.scenario.steps.length !== a.scenario.steps.length)
|
|
369
|
+
return b.scenario.steps.length - a.scenario.steps.length;
|
|
370
|
+
const errorA = a.scenario.steps.some(s => s.interactionType === "error" || s.interactionType === "edge-case") ? 1 : 0;
|
|
371
|
+
const errorB = b.scenario.steps.some(s => s.interactionType === "error" || s.interactionType === "edge-case") ? 1 : 0;
|
|
372
|
+
if (errorB !== errorA)
|
|
373
|
+
return errorB - errorA;
|
|
374
|
+
// Use locale-independent comparison to avoid runtime-locale non-determinism
|
|
375
|
+
const nameA = a.scenario.scenarioName;
|
|
376
|
+
const nameB = b.scenario.scenarioName;
|
|
377
|
+
if (nameA < nameB)
|
|
378
|
+
return -1;
|
|
379
|
+
if (nameA > nameB)
|
|
380
|
+
return 1;
|
|
381
|
+
const hashA = parseInt(crypto.createHash("sha256").update(seed + a.scenario.scenarioName).digest("hex").slice(0, 8), 16);
|
|
382
|
+
const hashB = parseInt(crypto.createHash("sha256").update(seed + b.scenario.scenarioName).digest("hex").slice(0, 8), 16);
|
|
383
|
+
return hashA - hashB;
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
// ── Main section: execution plan, UI-only guidance, or draft-your-own ──
|
|
387
|
+
let mainSection;
|
|
388
|
+
if (isUIOnlyPR) {
|
|
389
|
+
mainSection = hasTraces ? `
|
|
390
|
+
## Test Recommendations (UI-only PR — traces available)
|
|
391
|
+
|
|
392
|
+
**Budget: ${maxGen} generate + ${Math.max(topN - maxGen, 0)} additional = ${topN} total**
|
|
393
|
+
|
|
394
|
+
No backend API changes detected. Generate UI/E2E tests from the available traces. Do NOT generate integration or contract tests.
|
|
395
|
+
|
|
396
|
+
**Generate from traces:**
|
|
397
|
+
1. Call \`skyramp_ui_test_generation\` or \`skyramp_e2e_test_generation\` using the trace files
|
|
398
|
+
2. Generate exactly ${maxGen} tests targeting the changed UI flows
|
|
399
|
+
|
|
400
|
+
**You MUST produce EXACTLY ${topN} total recommendations: ${maxGen} to generate + ${topN - maxGen} as additionalRecommendations. Do NOT produce fewer. Generate recommendations now.**
|
|
172
401
|
|
|
173
|
-
|
|
174
|
-
|
|
402
|
+
Do not churn recommendations without cause.
|
|
403
|
+
` : `
|
|
404
|
+
## Test Recommendations (UI-only PR)
|
|
175
405
|
|
|
176
|
-
**
|
|
177
|
-
verification (not just status codes), realistic test data (not "test product").
|
|
178
|
-
**Query vs Body:** For GET/DELETE requests, use \`queryParams\` (not \`requestBody\`) for search terms,
|
|
179
|
-
filters, pagination. Only POST/PUT/PATCH use \`requestBody\`.
|
|
180
|
-
**Path verification:** Cross-reference paths against Router Mounting context — use correct
|
|
181
|
-
nested paths. **Request bodies:** Replace placeholders with actual schemas from source code.
|
|
406
|
+
**Budget: ${maxGen} generate + ${topN - maxGen} additional = ${topN} total**
|
|
182
407
|
|
|
183
|
-
|
|
408
|
+
No backend API changes detected and no traces available. Do NOT generate or execute any tests.
|
|
409
|
+
All ${topN} recommendations go into additionalRecommendations only.
|
|
410
|
+
|
|
411
|
+
Draft ${topN} UI and E2E test recommendations covering:
|
|
412
|
+
- Component rendering (correct copy, classes, layout for changed components)
|
|
413
|
+
- User interactions (clicks, form submissions, navigation triggered by changed UI)
|
|
414
|
+
- Empty/error states (if the PR touches empty state or error UI)
|
|
415
|
+
- Cross-browser or responsive behavior (if applicable)
|
|
416
|
+
- Full E2E user journeys that exercise the changed UI flows end-to-end
|
|
417
|
+
|
|
418
|
+
**To generate UI/E2E tests** (when ready):
|
|
419
|
+
1. Call \`skyramp_start_trace_collection\` (playwright: true)
|
|
420
|
+
2. Exercise the changed UI flows in the browser
|
|
421
|
+
3. Call \`skyramp_stop_trace_collection\`
|
|
422
|
+
4. Generate with \`skyramp_ui_test_generation\` or \`skyramp_e2e_test_generation\`
|
|
423
|
+
|
|
424
|
+
**You MUST produce EXACTLY ${topN} total recommendations in additionalRecommendations. Do NOT produce fewer. Generate recommendations now.**
|
|
425
|
+
|
|
426
|
+
Do not churn recommendations without cause.
|
|
184
427
|
`;
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
428
|
+
}
|
|
429
|
+
else if (scored.length > 0) {
|
|
430
|
+
mainSection = buildExecutionPlan(scored, maxGen, topN, analysis.apiEndpoints.baseUrl, authHeaderValue, authSchemeSnippet, authTypeValue, seed, endpointCount, isUIOnlyPR, hasFrontendChanges, hasTraces);
|
|
431
|
+
}
|
|
432
|
+
else {
|
|
433
|
+
mainSection = `
|
|
434
|
+
## Draft Your Execution Plan
|
|
435
|
+
|
|
436
|
+
**Budget: ${maxGen} generate + ${topN - maxGen} additional = ${topN} total**
|
|
437
|
+
|
|
438
|
+
No pre-drafted scenarios available. Draft ${maxGen} tests from your analysis of the endpoint interactions and source code above, then supplement with your own candidates to reach ${topN} total. Prioritize critical categories (security_boundary > data_integrity > business_rule > workflow > crud).
|
|
189
439
|
|
|
190
|
-
|
|
191
|
-
1. **Cross-resource workflow** — resources referencing each other via foreign keys
|
|
192
|
-
2. **Search/filter + verify** — create data, search, verify results
|
|
193
|
-
3. **Error handling** — invalid cross-resource references → appropriate errors
|
|
440
|
+
For each test: pick the highest-impact endpoint(s), draft a realistic scenario with actual request/response shapes from source code, and execute the same pipeline described in Tool Workflows below.
|
|
194
441
|
|
|
195
|
-
|
|
196
|
-
|
|
442
|
+
**You MUST produce EXACTLY ${topN} total recommendations: ${maxGen} to generate + ${topN - maxGen} as additionalRecommendations. Do NOT produce fewer. Generate recommendations now.**
|
|
443
|
+
|
|
444
|
+
## Recommendation Stability
|
|
445
|
+
- **Carry forward** previous additionalRecommendations that still apply — match by scenarioName (multi-step) or endpoint (single-endpoint). Re-derive category and priority from test content.
|
|
446
|
+
- **Only drop** a previous recommendation if its target endpoint was removed, its business logic changed, or it is now covered by a generated test.
|
|
447
|
+
- **Only add** new recommendations for code paths introduced since the last run.
|
|
448
|
+
- Do not churn recommendations without cause.
|
|
197
449
|
`;
|
|
198
|
-
}
|
|
199
450
|
}
|
|
451
|
+
// ── OpenAPI spec note ──
|
|
452
|
+
const specNote = openApiSpec
|
|
453
|
+
? `\n**OpenAPI Spec available**: \`${openApiSpec.path}\`
|
|
454
|
+
Use it for contract tests (\`apiSchema: "${openApiSpec.path}"\`) and to extract request/response shapes.
|
|
455
|
+
`
|
|
456
|
+
: "";
|
|
200
457
|
// ── PR History ──
|
|
201
458
|
let prHistorySection = "";
|
|
202
459
|
if (prContext && prContext.previousRecommendations.length > 0) {
|
|
@@ -280,32 +537,26 @@ ${modePreamble}
|
|
|
280
537
|
|
|
281
538
|
Scope: ${scopeNote}
|
|
282
539
|
|
|
283
|
-
${buildTestQualityCriteria()}
|
|
284
|
-
|
|
285
540
|
${sourcePriority}
|
|
286
541
|
|
|
287
|
-
${buildPrioritizationDimensions()}
|
|
288
|
-
|
|
289
|
-
${buildTestExamples()}
|
|
290
|
-
|
|
291
|
-
${buildTestPatternGuidelines()}
|
|
292
|
-
|
|
293
|
-
${buildGenerationRules(isUIOnlyPR)}
|
|
294
|
-
|
|
295
|
-
${diffSection}
|
|
296
542
|
## Repository Context
|
|
297
543
|
|
|
298
544
|
${repoContext}
|
|
299
|
-
|
|
545
|
+
${specNote}
|
|
546
|
+
${diffSection}
|
|
300
547
|
${interactionSection}
|
|
301
|
-
${
|
|
548
|
+
${mainSection}
|
|
302
549
|
${prHistorySection}
|
|
303
550
|
## Existing Tests
|
|
304
551
|
- Frameworks: ${analysis.existingTests.frameworks.join(", ") || "none"}
|
|
305
552
|
${formatTestLocations(analysis.existingTests.testLocations)}
|
|
306
553
|
|
|
307
|
-
${
|
|
554
|
+
${isUIOnlyPR
|
|
555
|
+
? `## How to Generate Tests — Tool Workflows
|
|
308
556
|
|
|
309
|
-
|
|
557
|
+
**For UI tests:** \`skyramp_start_trace_collection\` (playwright: true) → perform browser steps → \`skyramp_stop_trace_collection\` → \`skyramp_ui_test_generation\` with the playwright zip.
|
|
558
|
+
**For E2E tests:** Same trace flow, pass both trace file and playwright zip to \`skyramp_e2e_test_generation\`.
|
|
559
|
+
Without traces, list as additionalRecommendations with instructions to record traces first.`
|
|
560
|
+
: buildToolWorkflows(authHeaderValue, authTypeValue)}
|
|
310
561
|
`;
|
|
311
562
|
}
|
|
@@ -2,7 +2,7 @@ jest.mock("@skyramp/skyramp", () => ({
|
|
|
2
2
|
WorkspaceConfigManager: { create: jest.fn() },
|
|
3
3
|
}));
|
|
4
4
|
import { buildRecommendationPrompt } from "./test-recommendation-prompt.js";
|
|
5
|
-
import {
|
|
5
|
+
import { PATH_PARAM_UUID_GUIDANCE, MAX_TESTS_TO_GENERATE } from "./recommendationSections.js";
|
|
6
6
|
// ---------------------------------------------------------------------------
|
|
7
7
|
// Minimal fixtures
|
|
8
8
|
// ---------------------------------------------------------------------------
|
|
@@ -261,30 +261,73 @@ describe("buildRecommendationPrompt — PR History section", () => {
|
|
|
261
261
|
});
|
|
262
262
|
});
|
|
263
263
|
// ---------------------------------------------------------------------------
|
|
264
|
-
// Tests —
|
|
264
|
+
// Tests — Stability and supplement in buildRecommendationPrompt
|
|
265
265
|
// ---------------------------------------------------------------------------
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
266
|
+
function minimalScenario(overrides = {}) {
|
|
267
|
+
return {
|
|
268
|
+
scenarioName: "item-create-delete",
|
|
269
|
+
description: "Create and delete an item to verify cascade",
|
|
270
|
+
category: "data_integrity",
|
|
271
|
+
priority: "high",
|
|
272
|
+
steps: [
|
|
273
|
+
{ order: 1, method: "POST", path: "/api/items", description: "Create item", interactionType: "success", expectedStatusCode: 201 },
|
|
274
|
+
{ order: 2, method: "DELETE", path: "/api/items/{id}", description: "Delete item", interactionType: "success", expectedStatusCode: 204 },
|
|
275
|
+
],
|
|
276
|
+
chainingKeys: ["id"],
|
|
277
|
+
requiresAuth: false,
|
|
278
|
+
estimatedComplexity: "simple",
|
|
279
|
+
testType: "integration",
|
|
280
|
+
...overrides,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
describe("buildRecommendationPrompt — Stability and supplement section", () => {
|
|
284
|
+
it("includes Recommendation Stability section in output when scenarios exist", () => {
|
|
285
|
+
const analysis = minimalAnalysis({
|
|
286
|
+
businessContext: { mainPurpose: "Test API", userFlows: [], dataFlows: [], integrationPatterns: [], draftedScenarios: [minimalScenario()] },
|
|
287
|
+
});
|
|
288
|
+
const prompt = buildRecommendationPrompt(analysis, "full_repo", 10);
|
|
289
|
+
expect(prompt).toContain("## Recommendation Stability");
|
|
270
290
|
});
|
|
271
291
|
it("stability section uses scenarioName/endpoint matching strategy", () => {
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
|
|
292
|
+
const analysis = minimalAnalysis({
|
|
293
|
+
businessContext: { mainPurpose: "Test API", userFlows: [], dataFlows: [], integrationPatterns: [], draftedScenarios: [minimalScenario()] },
|
|
294
|
+
});
|
|
295
|
+
const prompt = buildRecommendationPrompt(analysis, "full_repo", 10);
|
|
296
|
+
const stabilityStart = prompt.indexOf("## Recommendation Stability");
|
|
297
|
+
const stabilityBlock = prompt.slice(stabilityStart, stabilityStart + 500);
|
|
275
298
|
expect(stabilityBlock).toContain("scenarioName");
|
|
276
299
|
expect(stabilityBlock).toContain("endpoint");
|
|
277
300
|
expect(stabilityBlock).toContain("Re-derive category and priority");
|
|
278
301
|
});
|
|
279
302
|
it("stability section specifies when to drop a recommendation", () => {
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
303
|
+
const analysis = minimalAnalysis({
|
|
304
|
+
businessContext: { mainPurpose: "Test API", userFlows: [], dataFlows: [], integrationPatterns: [], draftedScenarios: [minimalScenario()] },
|
|
305
|
+
});
|
|
306
|
+
const prompt = buildRecommendationPrompt(analysis, "full_repo", 10);
|
|
307
|
+
expect(prompt).toContain("target endpoint was removed");
|
|
308
|
+
expect(prompt).toContain("business logic changed");
|
|
309
|
+
expect(prompt).toContain("covered by a generated test");
|
|
310
|
+
});
|
|
311
|
+
it("instructs to supplement beyond pre-ranked list to reach topN", () => {
|
|
312
|
+
// 1 scenario, topN=10 → supplementCount=9 → supplement note should appear
|
|
313
|
+
const analysis = minimalAnalysis({
|
|
314
|
+
businessContext: { mainPurpose: "Test API", userFlows: [], dataFlows: [], integrationPatterns: [], draftedScenarios: [minimalScenario()] },
|
|
315
|
+
});
|
|
316
|
+
const prompt = buildRecommendationPrompt(analysis, "full_repo", 10);
|
|
317
|
+
expect(prompt).toContain("REQUIRED — You MUST add");
|
|
318
|
+
expect(prompt).toContain("5-dimension rubric");
|
|
319
|
+
});
|
|
320
|
+
// Verify MAX_TESTS_TO_GENERATE is still exported and equals 3
|
|
321
|
+
it("MAX_TESTS_TO_GENERATE is 3", () => {
|
|
322
|
+
expect(MAX_TESTS_TO_GENERATE).toBe(3);
|
|
284
323
|
});
|
|
285
324
|
it("uses MAX_CRITICAL_TESTS in category-aware selection rules", () => {
|
|
286
|
-
const
|
|
287
|
-
|
|
325
|
+
const analysis = minimalAnalysis({
|
|
326
|
+
businessContext: { mainPurpose: "Test API", userFlows: [], dataFlows: [], integrationPatterns: [], draftedScenarios: [minimalScenario()] },
|
|
327
|
+
});
|
|
328
|
+
const prompt = buildRecommendationPrompt(analysis, "full_repo", 10);
|
|
329
|
+
// The critical-category minimum line references MAX_CRITICAL_TESTS (= 3)
|
|
330
|
+
expect(prompt).toContain("GENERATE items MUST be from HIGH-priority categories");
|
|
288
331
|
});
|
|
289
332
|
});
|
|
290
333
|
// ---------------------------------------------------------------------------
|
|
@@ -198,7 +198,7 @@ Trace File:
|
|
|
198
198
|
|
|
199
199
|
**CRITICAL: FOR A SINGLE SCENARIO CREATE A SINGLE SCENARIO FILE WITH EACH STEP AS A JSON OBJECT IN THE ARRAY.**
|
|
200
200
|
|
|
201
|
-
**CRITICAL:
|
|
201
|
+
**CRITICAL: For UI test trace collection, use the browser_* tools (browser_navigate, browser_click, browser_type, etc.) to interact with the application, then call skyramp_export_zip to export the trace zip. Do NOT use skyramp_start_trace_collection/skyramp_stop_trace_collection.**
|
|
202
202
|
`,
|
|
203
203
|
},
|
|
204
204
|
},
|