@empiricalrun/test-gen 0.73.0 → 0.74.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/CHANGELOG.md +96 -0
- package/dist/actions/utils/index.d.ts.map +1 -1
- package/dist/actions/utils/index.js +1 -2
- package/dist/agent/browsing/index.d.ts.map +1 -1
- package/dist/agent/browsing/index.js +9 -7
- package/dist/agent/browsing/utils.d.ts.map +1 -1
- package/dist/agent/browsing/utils.js +3 -4
- package/dist/agent/chat/agent-loop.d.ts +7 -8
- package/dist/agent/chat/agent-loop.d.ts.map +1 -1
- package/dist/agent/chat/agent-loop.js +14 -17
- package/dist/agent/chat/exports.d.ts +5 -4
- package/dist/agent/chat/exports.d.ts.map +1 -1
- package/dist/agent/chat/exports.js +9 -4
- package/dist/agent/chat/filesystem-cache.d.ts +12 -0
- package/dist/agent/chat/filesystem-cache.d.ts.map +1 -0
- package/dist/agent/chat/filesystem-cache.js +101 -0
- package/dist/agent/chat/index.d.ts +4 -1
- package/dist/agent/chat/index.d.ts.map +1 -1
- package/dist/agent/chat/index.js +44 -22
- package/dist/agent/chat/models.d.ts +2 -1
- package/dist/agent/chat/models.d.ts.map +1 -1
- package/dist/agent/chat/models.js +25 -3
- package/dist/agent/chat/prompt/index.d.ts +3 -1
- package/dist/agent/chat/prompt/index.d.ts.map +1 -1
- package/dist/agent/chat/prompt/index.js +77 -2
- package/dist/agent/chat/prompt/repo.d.ts.map +1 -1
- package/dist/agent/chat/prompt/repo.js +1 -0
- package/dist/agent/chat/state.d.ts +6 -5
- package/dist/agent/chat/state.d.ts.map +1 -1
- package/dist/agent/chat/state.js +35 -5
- package/dist/agent/chat/utils.d.ts +1 -0
- package/dist/agent/chat/utils.d.ts.map +1 -1
- package/dist/agent/chat/utils.js +16 -3
- package/dist/agent/cua/index.js +1 -1
- package/dist/agent/cua/model.js +1 -1
- package/dist/agent/cua/pw-codegen/pw-pause/index.d.ts.map +1 -1
- package/dist/agent/cua/pw-codegen/pw-pause/index.js +0 -1
- package/dist/agent/master/browser-tests/fixtures.d.ts.map +1 -1
- package/dist/agent/master/browser-tests/fixtures.js +0 -1
- package/dist/agent/master/element-annotation.d.ts.map +1 -1
- package/dist/agent/master/element-annotation.js +1 -2
- package/dist/agent/master/execute-browser-action.d.ts.map +1 -1
- package/dist/agent/master/execute-browser-action.js +8 -6
- package/dist/agent/master/icon-descriptor/index.js +2 -2
- package/dist/agent/master/next-action.js +1 -1
- package/dist/agent/master/planner.js +1 -1
- package/dist/agent/master/scroller.js +2 -2
- package/dist/agent/master/with-hints.d.ts.map +1 -1
- package/dist/agent/master/with-hints.js +6 -5
- package/dist/agent/planner/run-time-planner.js +1 -1
- package/dist/agent/planner/run.d.ts.map +1 -1
- package/dist/agent/planner/run.js +4 -2
- package/dist/auth/cli-auth.js +1 -1
- package/dist/auth/token-store.d.ts.map +1 -1
- package/dist/auth/token-store.js +4 -6
- package/dist/bin/index.js +30 -163
- package/dist/bin/utils/context.js +1 -1
- package/dist/bin/utils/index.d.ts +0 -12
- package/dist/bin/utils/index.d.ts.map +1 -1
- package/dist/bin/utils/index.js +0 -70
- package/dist/bin/utils/platform/web/index.d.ts +2 -2
- package/dist/bin/utils/platform/web/index.d.ts.map +1 -1
- package/dist/bin/utils/platform/web/index.js +7 -5
- package/dist/bin/utils/scenarios/index.d.ts +11 -3
- package/dist/bin/utils/scenarios/index.d.ts.map +1 -1
- package/dist/browser-injected-scripts/annotate-elements.spec.js +0 -5
- package/dist/browser-injected-scripts/annotate-elements.spec.ts +0 -5
- package/dist/dashboard/client.d.ts +2 -2
- package/dist/dashboard/client.d.ts.map +1 -1
- package/dist/dashboard/client.js +4 -1
- package/dist/file-info/adapters/file-system/index.d.ts +9 -0
- package/dist/file-info/adapters/file-system/index.d.ts.map +1 -0
- package/dist/file-info/adapters/file-system/index.js +25 -0
- package/dist/file-info/adapters/file-system/reader.d.ts +6 -0
- package/dist/file-info/adapters/file-system/reader.d.ts.map +1 -0
- package/dist/file-info/{file-system.js → adapters/file-system/reader.js} +16 -0
- package/dist/file-info/adapters/github/index.d.ts +11 -0
- package/dist/file-info/adapters/github/index.d.ts.map +1 -0
- package/dist/file-info/adapters/github/index.js +29 -0
- package/dist/file-info/adapters/github/reader.d.ts +16 -0
- package/dist/file-info/adapters/github/reader.d.ts.map +1 -0
- package/dist/file-info/adapters/github/reader.js +185 -0
- package/dist/file-info/index.d.ts +4 -0
- package/dist/file-info/index.d.ts.map +1 -0
- package/dist/file-info/index.js +10 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/recorder/index.d.ts +7 -3
- package/dist/recorder/index.d.ts.map +1 -1
- package/dist/recorder/index.js +181 -64
- package/dist/recorder/temp-files.d.ts +1 -1
- package/dist/recorder/temp-files.d.ts.map +1 -1
- package/dist/recorder/temp-files.js +2 -2
- package/dist/recorder/upload.d.ts +1 -1
- package/dist/recorder/upload.d.ts.map +1 -1
- package/dist/recorder/upload.js +3 -3
- package/dist/tools/{commit-and-create-pr.d.ts → commit-and-create-pr/index.d.ts} +1 -1
- package/dist/tools/commit-and-create-pr/index.d.ts.map +1 -0
- package/dist/tools/{commit-and-create-pr.js → commit-and-create-pr/index.js} +8 -28
- package/dist/tools/definitions/commit-and-create-pr.d.ts +3 -0
- package/dist/tools/definitions/commit-and-create-pr.d.ts.map +1 -0
- package/dist/tools/definitions/commit-and-create-pr.js +31 -0
- package/dist/tools/definitions/delete-file.d.ts +3 -0
- package/dist/tools/definitions/delete-file.d.ts.map +1 -0
- package/dist/tools/definitions/delete-file.js +20 -0
- package/dist/tools/{download-build.d.ts → definitions/download-build.d.ts} +2 -2
- package/dist/tools/definitions/download-build.d.ts.map +1 -0
- package/dist/tools/definitions/download-build.js +18 -0
- package/dist/tools/definitions/fetch-video-analysis.d.ts +11 -0
- package/dist/tools/definitions/fetch-video-analysis.d.ts.map +1 -0
- package/dist/tools/definitions/fetch-video-analysis.js +26 -0
- package/dist/tools/definitions/grep.d.ts +3 -0
- package/dist/tools/definitions/grep.d.ts.map +1 -0
- package/dist/tools/definitions/grep.js +29 -0
- package/dist/tools/definitions/merge-conflicts.d.ts +3 -0
- package/dist/tools/definitions/merge-conflicts.d.ts.map +1 -0
- package/dist/tools/definitions/merge-conflicts.js +24 -0
- package/dist/tools/definitions/run-test.d.ts +2 -2
- package/dist/tools/definitions/run-test.d.ts.map +1 -1
- package/dist/tools/definitions/run-test.js +4 -7
- package/dist/tools/definitions/str_replace_editor.d.ts.map +1 -1
- package/dist/tools/definitions/str_replace_editor.js +9 -5
- package/dist/tools/definitions/test-gen-browser.d.ts +5 -5
- package/dist/tools/definitions/test-gen-browser.d.ts.map +1 -1
- package/dist/tools/definitions/test-gen-browser.js +4 -7
- package/dist/tools/definitions/upgrade-packages.d.ts +36 -0
- package/dist/tools/definitions/upgrade-packages.d.ts.map +1 -0
- package/dist/tools/definitions/upgrade-packages.js +21 -0
- package/dist/tools/definitions/utils.d.ts +15 -0
- package/dist/tools/definitions/utils.d.ts.map +1 -0
- package/dist/tools/definitions/utils.js +16 -0
- package/dist/tools/{delete-file.d.ts → delete-file/index.d.ts} +1 -1
- package/dist/tools/delete-file/index.d.ts.map +1 -0
- package/dist/tools/{delete-file.js → delete-file/index.js} +4 -16
- package/dist/tools/diagnosis-fetcher.d.ts.map +1 -1
- package/dist/tools/diagnosis-fetcher.js +13 -11
- package/dist/tools/download-build/index.d.ts +3 -0
- package/dist/tools/download-build/index.d.ts.map +1 -0
- package/dist/tools/{download-build.js → download-build/index.js} +4 -14
- package/dist/tools/executor/index.d.ts.map +1 -1
- package/dist/tools/executor/index.js +19 -4
- package/dist/tools/executor/utils/git.js +1 -1
- package/dist/tools/executor/utils/pr-description.d.ts +1 -1
- package/dist/tools/executor/utils/pr-description.d.ts.map +1 -1
- package/dist/tools/fetch-image/index.d.ts +10 -1
- package/dist/tools/fetch-image/index.d.ts.map +1 -1
- package/dist/tools/fetch-image/index.js +8 -1
- package/dist/tools/fetch-last-successful-test-run/index.d.ts +3 -0
- package/dist/tools/fetch-last-successful-test-run/index.d.ts.map +1 -0
- package/dist/tools/fetch-last-successful-test-run/index.js +60 -0
- package/dist/tools/fetch-video-analysis/index.d.ts +5 -0
- package/dist/tools/fetch-video-analysis/index.d.ts.map +1 -0
- package/dist/tools/fetch-video-analysis/index.js +89 -0
- package/dist/tools/fetch-video-analysis/local-ffmpeg-client.d.ts +24 -0
- package/dist/tools/fetch-video-analysis/local-ffmpeg-client.d.ts.map +1 -0
- package/dist/tools/fetch-video-analysis/local-ffmpeg-client.js +209 -0
- package/dist/tools/fetch-video-analysis/utils.d.ts +10 -0
- package/dist/tools/fetch-video-analysis/utils.d.ts.map +1 -0
- package/dist/tools/fetch-video-analysis/utils.js +72 -0
- package/dist/tools/fetch-video-analysis/video-analysis.d.ts +7 -0
- package/dist/tools/fetch-video-analysis/video-analysis.d.ts.map +1 -0
- package/dist/tools/fetch-video-analysis/video-analysis.js +54 -0
- package/dist/tools/file-operations/create.d.ts +11 -0
- package/dist/tools/file-operations/create.d.ts.map +1 -0
- package/dist/tools/file-operations/create.js +60 -0
- package/dist/tools/file-operations/index.d.ts +15 -0
- package/dist/tools/file-operations/index.d.ts.map +1 -0
- package/dist/tools/file-operations/index.js +143 -0
- package/dist/tools/file-operations/insert.d.ts +11 -0
- package/dist/tools/file-operations/insert.d.ts.map +1 -0
- package/dist/tools/file-operations/insert.js +61 -0
- package/dist/tools/file-operations/replace.d.ts +11 -0
- package/dist/tools/file-operations/replace.d.ts.map +1 -0
- package/dist/tools/file-operations/replace.js +80 -0
- package/dist/tools/file-operations/shared/git-helper.d.ts +4 -0
- package/dist/tools/file-operations/shared/git-helper.d.ts.map +1 -0
- package/dist/tools/file-operations/shared/git-helper.js +29 -0
- package/dist/tools/file-operations/shared/helpers.d.ts +19 -0
- package/dist/tools/file-operations/shared/helpers.d.ts.map +1 -0
- package/dist/tools/file-operations/shared/helpers.js +133 -0
- package/dist/tools/file-operations/view/index.d.ts +14 -0
- package/dist/tools/file-operations/view/index.d.ts.map +1 -0
- package/dist/tools/file-operations/view/index.js +56 -0
- package/dist/tools/grep/index.d.ts.map +1 -1
- package/dist/tools/grep/index.js +2 -9
- package/dist/tools/grep/ripgrep/index.d.ts +2 -2
- package/dist/tools/grep/ripgrep/index.d.ts.map +1 -1
- package/dist/tools/grep/ripgrep/index.js +3 -3
- package/dist/tools/grep/types.d.ts.map +1 -0
- package/dist/tools/index.d.ts +7 -2
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +66 -22
- package/dist/tools/issues/create-issue.d.ts +3 -0
- package/dist/tools/issues/create-issue.d.ts.map +1 -0
- package/dist/tools/issues/create-issue.js +76 -0
- package/dist/tools/issues/index.d.ts +4 -0
- package/dist/tools/issues/index.d.ts.map +1 -0
- package/dist/tools/issues/index.js +9 -0
- package/dist/tools/issues/list-issues.d.ts +3 -0
- package/dist/tools/issues/list-issues.d.ts.map +1 -0
- package/dist/tools/issues/list-issues.js +32 -0
- package/dist/tools/issues/metadata-schema.d.ts +24 -0
- package/dist/tools/issues/metadata-schema.d.ts.map +1 -0
- package/dist/tools/issues/metadata-schema.js +22 -0
- package/dist/tools/issues/update-issue.d.ts +3 -0
- package/dist/tools/issues/update-issue.d.ts.map +1 -0
- package/dist/tools/issues/update-issue.js +75 -0
- package/dist/tools/issues/utils.d.ts +5 -0
- package/dist/tools/issues/utils.d.ts.map +1 -0
- package/dist/tools/issues/utils.js +26 -0
- package/dist/tools/list-environments.d.ts.map +1 -1
- package/dist/tools/list-environments.js +4 -0
- package/dist/tools/{merge-conflicts.d.ts → merge-conflicts/index.d.ts} +1 -1
- package/dist/tools/merge-conflicts/index.d.ts.map +1 -0
- package/dist/tools/{merge-conflicts.js → merge-conflicts/index.js} +3 -19
- package/dist/tools/test-gen-browser.js +4 -4
- package/dist/tools/test-run-fetcher/index.d.ts.map +1 -1
- package/dist/tools/test-run-fetcher/index.js +4 -0
- package/dist/tools/trace-dot-zip/index.d.ts +3 -0
- package/dist/tools/trace-dot-zip/index.d.ts.map +1 -0
- package/dist/tools/trace-dot-zip/index.js +48 -0
- package/dist/tools/trace-dot-zip/types.d.ts +86 -0
- package/dist/tools/trace-dot-zip/types.d.ts.map +1 -0
- package/dist/tools/trace-dot-zip/types.js +2 -0
- package/dist/tools/trace-dot-zip/utils/console-trace.d.ts +7 -0
- package/dist/tools/trace-dot-zip/utils/console-trace.d.ts.map +1 -0
- package/dist/tools/trace-dot-zip/utils/console-trace.js +34 -0
- package/dist/tools/trace-dot-zip/utils/extract-zip.d.ts +21 -0
- package/dist/tools/trace-dot-zip/utils/extract-zip.d.ts.map +1 -0
- package/dist/tools/trace-dot-zip/utils/extract-zip.js +174 -0
- package/dist/tools/trace-dot-zip/utils/network-trace.d.ts +21 -0
- package/dist/tools/trace-dot-zip/utils/network-trace.d.ts.map +1 -0
- package/dist/tools/trace-dot-zip/utils/network-trace.js +189 -0
- package/dist/tools/triage-summary/index.d.ts +3 -0
- package/dist/tools/triage-summary/index.d.ts.map +1 -0
- package/dist/tools/triage-summary/index.js +51 -0
- package/dist/tools/triage-summary/types.d.ts +5 -0
- package/dist/tools/triage-summary/types.d.ts.map +1 -0
- package/dist/tools/triage-summary/types.js +2 -0
- package/dist/tools/triage-summary/utils.d.ts +4 -0
- package/dist/tools/triage-summary/utils.d.ts.map +1 -0
- package/dist/tools/triage-summary/utils.js +16 -0
- package/dist/tools/upgrade-packages/index.d.ts.map +1 -1
- package/dist/tools/upgrade-packages/index.js +5 -15
- package/dist/tools/view-failed-test-run-report/index.d.ts +12 -0
- package/dist/tools/view-failed-test-run-report/index.d.ts.map +1 -0
- package/dist/tools/view-failed-test-run-report/index.js +163 -0
- package/dist/trace-utils/index.d.ts +4 -0
- package/dist/trace-utils/index.d.ts.map +1 -0
- package/dist/trace-utils/index.js +10 -0
- package/dist/utils/dedup-image-fs.d.ts +27 -0
- package/dist/utils/dedup-image-fs.d.ts.map +1 -0
- package/dist/utils/dedup-image-fs.js +88 -0
- package/dist/utils/dedup-image.d.ts +25 -0
- package/dist/utils/dedup-image.d.ts.map +1 -0
- package/dist/utils/dedup-image.js +80 -0
- package/dist/utils/env.d.ts.map +1 -1
- package/dist/utils/env.js +0 -1
- package/dist/utils/json.js +1 -1
- package/dist/utils/model.d.ts +3 -0
- package/dist/utils/model.d.ts.map +1 -0
- package/dist/utils/model.js +18 -0
- package/dist/utils/playwright-report-parser.d.ts +13 -0
- package/dist/utils/playwright-report-parser.d.ts.map +1 -0
- package/dist/utils/playwright-report-parser.js +138 -0
- package/dist/utils/slug.d.ts +1 -0
- package/dist/utils/slug.d.ts.map +1 -1
- package/dist/utils/slug.js +9 -1
- package/dist/utils/stripAnsi.d.ts.map +1 -1
- package/dist/utils/stripAnsi.js +1 -3
- package/eslint.config.mjs +43 -0
- package/package.json +22 -6
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/agent/codegen/generate-code-apply-changes.d.ts +0 -13
- package/dist/agent/codegen/generate-code-apply-changes.d.ts.map +0 -1
- package/dist/agent/codegen/generate-code-apply-changes.js +0 -379
- package/dist/agent/codegen/repo-edit.d.ts +0 -23
- package/dist/agent/codegen/repo-edit.d.ts.map +0 -1
- package/dist/agent/codegen/repo-edit.js +0 -81
- package/dist/agent/codegen/run.d.ts +0 -20
- package/dist/agent/codegen/run.d.ts.map +0 -1
- package/dist/agent/codegen/run.js +0 -116
- package/dist/agent/enrich-prompt/index.d.ts +0 -12
- package/dist/agent/enrich-prompt/index.d.ts.map +0 -1
- package/dist/agent/enrich-prompt/index.js +0 -80
- package/dist/agent/enrich-prompt/utils.d.ts +0 -6
- package/dist/agent/enrich-prompt/utils.d.ts.map +0 -1
- package/dist/agent/enrich-prompt/utils.js +0 -11
- package/dist/agent/infer-agent/index.d.ts +0 -10
- package/dist/agent/infer-agent/index.d.ts.map +0 -1
- package/dist/agent/infer-agent/index.js +0 -60
- package/dist/evals/add-scenario-agent.evals.d.ts +0 -4
- package/dist/evals/add-scenario-agent.evals.d.ts.map +0 -1
- package/dist/evals/add-scenario-agent.evals.js +0 -44
- package/dist/evals/infer-master-or-code-agent.evals.d.ts +0 -4
- package/dist/evals/infer-master-or-code-agent.evals.d.ts.map +0 -1
- package/dist/evals/infer-master-or-code-agent.evals.js +0 -22
- package/dist/file-info/file-system.d.ts +0 -3
- package/dist/file-info/file-system.d.ts.map +0 -1
- package/dist/file-info/github.d.ts +0 -3
- package/dist/file-info/github.d.ts.map +0 -1
- package/dist/file-info/github.js +0 -107
- package/dist/tools/commit-and-create-pr.d.ts.map +0 -1
- package/dist/tools/delete-file.d.ts.map +0 -1
- package/dist/tools/download-build.d.ts.map +0 -1
- package/dist/tools/grep/ripgrep/types.d.ts.map +0 -1
- package/dist/tools/merge-conflicts.d.ts.map +0 -1
- package/dist/tools/str_replace_editor.d.ts +0 -22
- package/dist/tools/str_replace_editor.d.ts.map +0 -1
- package/dist/tools/str_replace_editor.js +0 -429
- /package/dist/tools/grep/{ripgrep/types.d.ts → types.d.ts} +0 -0
- /package/dist/tools/grep/{ripgrep/types.js → types.js} +0 -0
|
@@ -7,26 +7,13 @@ exports.upgradePackagesTool = void 0;
|
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
|
-
const
|
|
10
|
+
const upgrade_packages_1 = require("../definitions/upgrade-packages");
|
|
11
11
|
const utils_1 = require("../executor/utils");
|
|
12
12
|
const git_1 = require("../executor/utils/git");
|
|
13
13
|
const pr_description_1 = require("../executor/utils/pr-description");
|
|
14
14
|
const utils_2 = require("./utils");
|
|
15
|
-
const packageSpecSchema = zod_1.z.object({
|
|
16
|
-
name: zod_1.z.string(),
|
|
17
|
-
version: zod_1.z.string(),
|
|
18
|
-
});
|
|
19
|
-
const upgradePackagesSchema = zod_1.z.object({
|
|
20
|
-
packages: zod_1.z.array(packageSpecSchema).min(1),
|
|
21
|
-
});
|
|
22
15
|
exports.upgradePackagesTool = {
|
|
23
|
-
|
|
24
|
-
name: "upgradePackages",
|
|
25
|
-
description: `This tool can be used to upgrade NPM packages in this repository. To run this tool, specify a list of packages with their names and version strings. At least one package must be specified.
|
|
26
|
-
This tool handles the entire workflow: editing the package.json file, running "npm install", generating lockfile, committing the changes and creating a pull request. For patch updates (e.g., 1.0.1 → 1.0.2), the tool will automatically merge the PR for minor updates. For major updates, the user needs to review the PR and merge it manually.`,
|
|
27
|
-
parameters: upgradePackagesSchema,
|
|
28
|
-
},
|
|
29
|
-
needsBrowser: false,
|
|
16
|
+
...upgrade_packages_1.upgradePackagesTool,
|
|
30
17
|
execute: async ({ input, repoPath, apiClient, chatSession }) => {
|
|
31
18
|
const { packages: packagesToUpdate } = input;
|
|
32
19
|
try {
|
|
@@ -75,6 +62,9 @@ This tool handles the entire workflow: editing the package.json file, running "n
|
|
|
75
62
|
let shouldMerge = false;
|
|
76
63
|
let prNumber = null;
|
|
77
64
|
let merged = false;
|
|
65
|
+
if (!apiClient) {
|
|
66
|
+
throw new Error("Dashboard API client is not available.");
|
|
67
|
+
}
|
|
78
68
|
try {
|
|
79
69
|
const { pr } = await (0, utils_1.findOrCreatePullRequest)({
|
|
80
70
|
owner: "empirical-run",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Tool } from "@empiricalrun/shared-types";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export declare const ViewFailedTestRunReportSchema: z.ZodObject<{
|
|
4
|
+
testRunUrl: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
testRunUrl: string;
|
|
7
|
+
}, {
|
|
8
|
+
testRunUrl: string;
|
|
9
|
+
}>;
|
|
10
|
+
export type ViewFailedTestRunReportInput = z.infer<typeof ViewFailedTestRunReportSchema>;
|
|
11
|
+
export declare const viewFailedTestRunReportTool: Tool;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/view-failed-test-run-report/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAc,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,6BAA6B;;;;;;EAExC,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,6BAA6B,CACrC,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,IAoLzC,CAAC"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.viewFailedTestRunReportTool = exports.ViewFailedTestRunReportSchema = void 0;
|
|
4
|
+
// import fs from "fs";
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const playwright_report_parser_1 = require("../../utils/playwright-report-parser");
|
|
7
|
+
exports.ViewFailedTestRunReportSchema = zod_1.z.object({
|
|
8
|
+
testRunUrl: zod_1.z.string().describe("The URL of the test run to process."),
|
|
9
|
+
});
|
|
10
|
+
exports.viewFailedTestRunReportTool = {
|
|
11
|
+
schema: {
|
|
12
|
+
name: "viewFailedTestRunReport",
|
|
13
|
+
description: "View the test run report using its URL. the report only contains information about failed tests.",
|
|
14
|
+
parameters: exports.ViewFailedTestRunReportSchema,
|
|
15
|
+
},
|
|
16
|
+
needsBrowser: false,
|
|
17
|
+
isInlineTool: true,
|
|
18
|
+
execute: async ({ input, apiClient }) => {
|
|
19
|
+
const { testRunUrl } = input;
|
|
20
|
+
// Remove query parameters if they exist
|
|
21
|
+
const urlWithoutParams = testRunUrl.split("?")[0] || testRunUrl;
|
|
22
|
+
// Extract the run ID and repo name from the URL
|
|
23
|
+
const urlParts = urlWithoutParams.split("/");
|
|
24
|
+
const runId = urlParts.pop(); // Last part is the run ID
|
|
25
|
+
const repoName = urlParts[urlParts.length - 2]; // Second to last part is the repo name
|
|
26
|
+
if (!runId || !repoName) {
|
|
27
|
+
return {
|
|
28
|
+
isError: true,
|
|
29
|
+
result: "Invalid test run URL - could not extract run ID or repo name",
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
let result = {
|
|
33
|
+
testRun: null,
|
|
34
|
+
summary: null,
|
|
35
|
+
environment: null,
|
|
36
|
+
currentBuild: null,
|
|
37
|
+
};
|
|
38
|
+
let data = null;
|
|
39
|
+
if (!apiClient) {
|
|
40
|
+
throw new Error("Dashboard API client is not available.");
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
data = await apiClient.request(`/api/test-runs/${runId}?repo_name=${repoName}`, { method: "GET" });
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
return {
|
|
47
|
+
isError: true,
|
|
48
|
+
result: `Failed to fetch test run details: ${error instanceof Error ? error.message : String(error)}`,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
const testRun = data?.data?.test_run?.testRun;
|
|
52
|
+
const project = data?.data?.test_run?.project;
|
|
53
|
+
const environmentSlug = testRun?.environment_slug;
|
|
54
|
+
const summaryUrl = testRun?.summary_url;
|
|
55
|
+
// TODO: Remove html from this tool
|
|
56
|
+
const indexHtmlUrl = summaryUrl?.replace("summary.json", "index.html");
|
|
57
|
+
if (testRun) {
|
|
58
|
+
result = {
|
|
59
|
+
testRun: testRun,
|
|
60
|
+
currentBuild: {
|
|
61
|
+
id: testRun?.build_id,
|
|
62
|
+
build_url: testRun?.build_url,
|
|
63
|
+
project_id: testRun?.project_id,
|
|
64
|
+
build_id: testRun?.build_id,
|
|
65
|
+
branch: testRun?.test_run_branch,
|
|
66
|
+
commit: testRun?.commit,
|
|
67
|
+
commit_url: testRun?.commit_url,
|
|
68
|
+
version: "",
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (summaryUrl && indexHtmlUrl) {
|
|
73
|
+
try {
|
|
74
|
+
const summaryJson = await fetch(summaryUrl);
|
|
75
|
+
const summaryData = await summaryJson.json();
|
|
76
|
+
// fs.writeFileSync(
|
|
77
|
+
// "download-summary.json",
|
|
78
|
+
// summaryJson ? JSON.stringify(summaryData, null, 2) : "",
|
|
79
|
+
// "utf-8",
|
|
80
|
+
// );
|
|
81
|
+
const htmlDetailed = await apiClient.request(`/api/reports/html-detailed`, {
|
|
82
|
+
method: "GET",
|
|
83
|
+
params: {
|
|
84
|
+
url: indexHtmlUrl,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
const parsedReport = (0, playwright_report_parser_1.parsePlaywrightTestReport)(summaryData);
|
|
88
|
+
// fs.writeFileSync(
|
|
89
|
+
// "parsed-report.json",
|
|
90
|
+
// parsedReport ? JSON.stringify(parsedReport, null, 2) : "",
|
|
91
|
+
// "utf-8",
|
|
92
|
+
// );
|
|
93
|
+
const failedTests = parsedReport.tests.filter((test) => test.status === "failed");
|
|
94
|
+
const reportJson = htmlDetailed.files["report.json"];
|
|
95
|
+
const testsWithResults = failedTests.map((test) => {
|
|
96
|
+
let matchingTest = (0, playwright_report_parser_1.findTestInReport)(reportJson, test, htmlDetailed.files);
|
|
97
|
+
// to reduce the token size of the final response, we remove the steps from the results
|
|
98
|
+
if (matchingTest && Array.isArray(matchingTest.results)) {
|
|
99
|
+
matchingTest.results = matchingTest.results.map((result) => ({
|
|
100
|
+
...result,
|
|
101
|
+
steps: [],
|
|
102
|
+
errors: result.errors.map((error) => {
|
|
103
|
+
return {
|
|
104
|
+
message: error.message.slice(0, 100),
|
|
105
|
+
};
|
|
106
|
+
}),
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
if (matchingTest) {
|
|
110
|
+
return {
|
|
111
|
+
...test,
|
|
112
|
+
results: matchingTest.results,
|
|
113
|
+
steps: [],
|
|
114
|
+
error: { ...test.error, snippet: "" },
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
const updatedReport = {
|
|
119
|
+
...parsedReport,
|
|
120
|
+
tests: testsWithResults,
|
|
121
|
+
};
|
|
122
|
+
result = {
|
|
123
|
+
...result,
|
|
124
|
+
summary: updatedReport,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
console.error("Failed to save summary: ", err);
|
|
129
|
+
const errMsg = `Failed to save summary: ${err instanceof Error ? err.message : String(err)}`;
|
|
130
|
+
return {
|
|
131
|
+
isError: true,
|
|
132
|
+
result: errMsg,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (environmentSlug && project?.repo_name) {
|
|
137
|
+
const environment = await apiClient.request(`/api/environments`, {
|
|
138
|
+
method: "GET",
|
|
139
|
+
params: {
|
|
140
|
+
project_repo_name: repoName,
|
|
141
|
+
environment_slug: environmentSlug,
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
if (environment?.data?.environment && environment?.data?.build) {
|
|
145
|
+
result = {
|
|
146
|
+
...result,
|
|
147
|
+
environment: environment?.data?.environment,
|
|
148
|
+
currentBuild: {
|
|
149
|
+
...result.currentBuild,
|
|
150
|
+
environment_id: environment?.data?.build?.environment_id,
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
isError: false,
|
|
157
|
+
result: `
|
|
158
|
+
Note: the paths in the test run report are relative to the tests directory and not the repo directory.
|
|
159
|
+
|
|
160
|
+
Test run report: ${JSON.stringify(result, null, 2)}`,
|
|
161
|
+
};
|
|
162
|
+
},
|
|
163
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { extractFileFromZipFromUrl, getFilenamesInZip, } from "../tools/trace-dot-zip/utils/extract-zip";
|
|
2
|
+
export { generateNetworkTrace } from "../tools/trace-dot-zip/utils/network-trace";
|
|
3
|
+
export { deduplicateImages } from "../utils/dedup-image";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/trace-utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deduplicateImages = exports.generateNetworkTrace = exports.getFilenamesInZip = exports.extractFileFromZipFromUrl = void 0;
|
|
4
|
+
var extract_zip_1 = require("../tools/trace-dot-zip/utils/extract-zip");
|
|
5
|
+
Object.defineProperty(exports, "extractFileFromZipFromUrl", { enumerable: true, get: function () { return extract_zip_1.extractFileFromZipFromUrl; } });
|
|
6
|
+
Object.defineProperty(exports, "getFilenamesInZip", { enumerable: true, get: function () { return extract_zip_1.getFilenamesInZip; } });
|
|
7
|
+
var network_trace_1 = require("../tools/trace-dot-zip/utils/network-trace");
|
|
8
|
+
Object.defineProperty(exports, "generateNetworkTrace", { enumerable: true, get: function () { return network_trace_1.generateNetworkTrace; } });
|
|
9
|
+
var dedup_image_1 = require("../utils/dedup-image");
|
|
10
|
+
Object.defineProperty(exports, "deduplicateImages", { enumerable: true, get: function () { return dedup_image_1.deduplicateImages; } });
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Processes an array of image file paths and returns only unique images as base64 strings.
|
|
3
|
+
* This is a file system wrapper around the deduplicateImages function that processes
|
|
4
|
+
* images in batches to avoid memory overflow.
|
|
5
|
+
*
|
|
6
|
+
* @param options - Configuration options
|
|
7
|
+
* @param options.imagePaths - An array of file paths to image files.
|
|
8
|
+
* @param options.batchSize - Number of images to process at a time (default: 50)
|
|
9
|
+
* @param options.threshold - The maximum fraction of pixels allowed to differ to consider two images similar.
|
|
10
|
+
* For example, 0.01 means that if less than 1% of the pixels differ, the images are considered duplicates.
|
|
11
|
+
* Default is 0.001 (0.1%).
|
|
12
|
+
* @param options.logPrefix - The ID of the test run, used for logging purposes.
|
|
13
|
+
* @returns A promise that resolves to an array of unique image objects with base64 data.
|
|
14
|
+
*/
|
|
15
|
+
export declare function deduplicateImageFiles({ imagePaths, batchSize, threshold, logPrefix, }: {
|
|
16
|
+
imagePaths: string[];
|
|
17
|
+
batchSize?: number;
|
|
18
|
+
threshold?: number;
|
|
19
|
+
logPrefix?: string;
|
|
20
|
+
}): Promise<{
|
|
21
|
+
metadata: {
|
|
22
|
+
index: number;
|
|
23
|
+
path: string;
|
|
24
|
+
};
|
|
25
|
+
image: string;
|
|
26
|
+
}[]>;
|
|
27
|
+
//# sourceMappingURL=dedup-image-fs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dedup-image-fs.d.ts","sourceRoot":"","sources":["../../src/utils/dedup-image-fs.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AACH,wBAAsB,qBAAqB,CAAC,EAC1C,UAAU,EACV,SAAc,EACd,SAAiB,EACjB,SAA4B,GAC7B,EAAE;IACD,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,CAmG1E"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deduplicateImageFiles = deduplicateImageFiles;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const dedup_image_1 = require("./dedup-image");
|
|
6
|
+
/**
|
|
7
|
+
* Processes an array of image file paths and returns only unique images as base64 strings.
|
|
8
|
+
* This is a file system wrapper around the deduplicateImages function that processes
|
|
9
|
+
* images in batches to avoid memory overflow.
|
|
10
|
+
*
|
|
11
|
+
* @param options - Configuration options
|
|
12
|
+
* @param options.imagePaths - An array of file paths to image files.
|
|
13
|
+
* @param options.batchSize - Number of images to process at a time (default: 50)
|
|
14
|
+
* @param options.threshold - The maximum fraction of pixels allowed to differ to consider two images similar.
|
|
15
|
+
* For example, 0.01 means that if less than 1% of the pixels differ, the images are considered duplicates.
|
|
16
|
+
* Default is 0.001 (0.1%).
|
|
17
|
+
* @param options.logPrefix - The ID of the test run, used for logging purposes.
|
|
18
|
+
* @returns A promise that resolves to an array of unique image objects with base64 data.
|
|
19
|
+
*/
|
|
20
|
+
async function deduplicateImageFiles({ imagePaths, batchSize = 50, threshold = 0.001, logPrefix = "dedup-image-fs", }) {
|
|
21
|
+
const uniqueImages = [];
|
|
22
|
+
console.log(`[${logPrefix}] Processing ${imagePaths.length} images in batches of ${batchSize}`);
|
|
23
|
+
for (let i = 0; i < imagePaths.length; i += batchSize) {
|
|
24
|
+
const batch = imagePaths.slice(i, i + batchSize);
|
|
25
|
+
console.log(`[${logPrefix}] Processing batch ${Math.floor(i / batchSize) + 1}/${Math.ceil(imagePaths.length / batchSize)}`);
|
|
26
|
+
const batchBase64Images = [];
|
|
27
|
+
for (let j = 0; j < batch.length; j++) {
|
|
28
|
+
const imagePath = batch[j];
|
|
29
|
+
if (!imagePath) {
|
|
30
|
+
console.error(`[${logPrefix}] Error: imagePath is undefined for batch ${Math.floor(i / batchSize) + 1}/${Math.ceil(imagePaths.length / batchSize)}`);
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
const buffer = await fs_1.promises.readFile(imagePath);
|
|
35
|
+
const base64 = buffer.toString("base64");
|
|
36
|
+
batchBase64Images.push({
|
|
37
|
+
metadata: {
|
|
38
|
+
index: i + j,
|
|
39
|
+
path: imagePath,
|
|
40
|
+
},
|
|
41
|
+
image: base64,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
console.error(`[${logPrefix}] Error reading image ${imagePath}:`, error);
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// If this is the first batch, just deduplicate within the batch
|
|
50
|
+
if (uniqueImages.length === 0) {
|
|
51
|
+
const batchUniqueImages = await (0, dedup_image_1.deduplicateImages)({
|
|
52
|
+
base64Images: batchBase64Images,
|
|
53
|
+
threshold,
|
|
54
|
+
logPrefix: `${logPrefix}-batch-${Math.floor(i / batchSize) + 1}`,
|
|
55
|
+
});
|
|
56
|
+
uniqueImages.push(...batchUniqueImages);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
// For subsequent batches, compare against the last unique image and then deduplicate within batch
|
|
60
|
+
const lastUniqueImage = uniqueImages[uniqueImages.length - 1];
|
|
61
|
+
if (!lastUniqueImage) {
|
|
62
|
+
console.error(`[${logPrefix}] Error: lastUniqueImage is undefined for batch ${Math.floor(i / batchSize) + 1}/${Math.ceil(imagePaths.length / batchSize)}`);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
const batchWithPrevious = [lastUniqueImage, ...batchBase64Images];
|
|
66
|
+
const batchUniqueImages = await (0, dedup_image_1.deduplicateImages)({
|
|
67
|
+
base64Images: batchWithPrevious,
|
|
68
|
+
threshold,
|
|
69
|
+
logPrefix: `${logPrefix}-batch-${Math.floor(i / batchSize) + 1}`,
|
|
70
|
+
});
|
|
71
|
+
// Remove the first image if it's the same as the last unique image (it was a duplicate)
|
|
72
|
+
// and add the rest to unique images
|
|
73
|
+
if (batchUniqueImages.length > 0) {
|
|
74
|
+
// Skip the first image if it has the same path as the last unique image
|
|
75
|
+
const startIndex = batchUniqueImages[0]?.metadata.path === lastUniqueImage.metadata.path
|
|
76
|
+
? 1
|
|
77
|
+
: 0;
|
|
78
|
+
uniqueImages.push(...batchUniqueImages.slice(startIndex));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// Force garbage collection after each batch
|
|
82
|
+
if (global.gc) {
|
|
83
|
+
global.gc();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
console.log(`[${logPrefix}] Filtered to ${uniqueImages.length} unique images from ${imagePaths.length} total images`);
|
|
87
|
+
return uniqueImages;
|
|
88
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Processes an array of base64 image objects and returns only unique images.
|
|
3
|
+
* Two images are considered "similar" if the fraction of differing pixels (when resized)
|
|
4
|
+
* is below the provided threshold.
|
|
5
|
+
*
|
|
6
|
+
* @param options - Configuration options
|
|
7
|
+
* @param options.base64Images - An array of objects, each with a metadata field and a base64-encoded image string.
|
|
8
|
+
* @param options.threshold - The maximum fraction of pixels allowed to differ to consider two images similar.
|
|
9
|
+
* For example, 0.01 means that if less than 1% of the pixels differ, the images are considered duplicates.
|
|
10
|
+
* Default is 0.001 (0.1%).
|
|
11
|
+
* @param options.logPrefix - The ID of the test run, used for logging purposes.
|
|
12
|
+
* @returns A promise that resolves to an array of unique image objects.
|
|
13
|
+
*/
|
|
14
|
+
export declare function deduplicateImages({ base64Images, threshold, logPrefix, }: {
|
|
15
|
+
base64Images: {
|
|
16
|
+
metadata: any;
|
|
17
|
+
image: string;
|
|
18
|
+
}[];
|
|
19
|
+
threshold?: number;
|
|
20
|
+
logPrefix?: string;
|
|
21
|
+
}): Promise<{
|
|
22
|
+
metadata: any;
|
|
23
|
+
image: string;
|
|
24
|
+
}[]>;
|
|
25
|
+
//# sourceMappingURL=dedup-image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dedup-image.d.ts","sourceRoot":"","sources":["../../src/utils/dedup-image.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,YAAY,EACZ,SAAiB,EACjB,SAAyB,GAC1B,EAAE;IACD,YAAY,EAAE;QAAE,QAAQ,EAAE,GAAG,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,GAAG,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,CAsE9C"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.deduplicateImages = deduplicateImages;
|
|
7
|
+
const pixelmatch_1 = __importDefault(require("pixelmatch"));
|
|
8
|
+
const sharp_1 = __importDefault(require("sharp"));
|
|
9
|
+
/**
|
|
10
|
+
* Processes an array of base64 image objects and returns only unique images.
|
|
11
|
+
* Two images are considered "similar" if the fraction of differing pixels (when resized)
|
|
12
|
+
* is below the provided threshold.
|
|
13
|
+
*
|
|
14
|
+
* @param options - Configuration options
|
|
15
|
+
* @param options.base64Images - An array of objects, each with a metadata field and a base64-encoded image string.
|
|
16
|
+
* @param options.threshold - The maximum fraction of pixels allowed to differ to consider two images similar.
|
|
17
|
+
* For example, 0.01 means that if less than 1% of the pixels differ, the images are considered duplicates.
|
|
18
|
+
* Default is 0.001 (0.1%).
|
|
19
|
+
* @param options.logPrefix - The ID of the test run, used for logging purposes.
|
|
20
|
+
* @returns A promise that resolves to an array of unique image objects.
|
|
21
|
+
*/
|
|
22
|
+
async function deduplicateImages({ base64Images, threshold = 0.001, logPrefix = "dedup-image", }) {
|
|
23
|
+
const uniqueImages = [];
|
|
24
|
+
// We'll store the raw pixel data (RGBA) and dimensions for the previous unique image.
|
|
25
|
+
let previousImageData = null;
|
|
26
|
+
let previousWidth = null;
|
|
27
|
+
let previousHeight = null;
|
|
28
|
+
for (const imgData of base64Images) {
|
|
29
|
+
try {
|
|
30
|
+
// Convert the base64 string to a Buffer.
|
|
31
|
+
const buffer = Buffer.from(imgData.image, "base64");
|
|
32
|
+
const imgMetadata = await (0, sharp_1.default)(buffer).metadata();
|
|
33
|
+
const height = imgMetadata.height || 0;
|
|
34
|
+
const width = imgMetadata.width || 0;
|
|
35
|
+
// Resize the image to fixed dimensions and extract its raw RGBA pixel data.
|
|
36
|
+
const { data } = await (0, sharp_1.default)(buffer)
|
|
37
|
+
.ensureAlpha()
|
|
38
|
+
.raw()
|
|
39
|
+
.toBuffer({ resolveWithObject: true });
|
|
40
|
+
let isDuplicate = false;
|
|
41
|
+
// If there's a previously processed unique image, compare the current image with it.
|
|
42
|
+
if (previousImageData &&
|
|
43
|
+
previousWidth === width &&
|
|
44
|
+
previousHeight === height) {
|
|
45
|
+
// Only compare images if they have the same dimensions
|
|
46
|
+
try {
|
|
47
|
+
const diffPixels = (0, pixelmatch_1.default)(data, // current image pixel data
|
|
48
|
+
previousImageData, // previous image pixel data
|
|
49
|
+
null, // no diff image output is needed
|
|
50
|
+
width, height, { threshold: 0.1 });
|
|
51
|
+
// console.log("diffPixels", diffPixels);
|
|
52
|
+
const totalPixels = height * width;
|
|
53
|
+
const diffFraction = diffPixels / totalPixels;
|
|
54
|
+
// console.log("diffFraction", diffFraction);
|
|
55
|
+
// If the fraction of differing pixels is below (or equal to) the threshold,
|
|
56
|
+
// consider the current image a duplicate.
|
|
57
|
+
if (diffFraction <= threshold) {
|
|
58
|
+
isDuplicate = true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
console.error(`[${logPrefix}] Error comparing images:`, error);
|
|
63
|
+
// If comparison fails, treat as non-duplicate
|
|
64
|
+
isDuplicate = false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// If the image is not a duplicate, add it to the list and update the previous image data.
|
|
68
|
+
if (!isDuplicate) {
|
|
69
|
+
uniqueImages.push(imgData);
|
|
70
|
+
previousImageData = data;
|
|
71
|
+
previousWidth = width;
|
|
72
|
+
previousHeight = height;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
console.error(`[${logPrefix}] Error processing image:`, error);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return uniqueImages;
|
|
80
|
+
}
|
package/dist/utils/env.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/utils/env.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/utils/env.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,YAK/B"}
|
package/dist/utils/env.js
CHANGED
|
@@ -3,6 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.isRunningOnCloud = isRunningOnCloud;
|
|
4
4
|
function isRunningOnCloud() {
|
|
5
5
|
return (process.env.CI === "true" ||
|
|
6
|
-
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
|
7
6
|
!!process.env.RUNNING_BROWSER_TESTS_FOR_TEST_GEN);
|
|
8
7
|
}
|
package/dist/utils/json.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.truncateJsonValues = truncateJsonValues;
|
|
4
|
-
function truncateJsonValues(obj, maxLength =
|
|
4
|
+
function truncateJsonValues(obj, maxLength = 3000) {
|
|
5
5
|
if (typeof obj === "string") {
|
|
6
6
|
if (obj.length > maxLength) {
|
|
7
7
|
const suffix = "...[truncated]";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/utils/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAkBjE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ARGS_TO_MODEL_MAP = void 0;
|
|
4
|
+
exports.ARGS_TO_MODEL_MAP = {
|
|
5
|
+
"claude-3-5": "claude-3-5-sonnet-20241022",
|
|
6
|
+
"claude-3-7": "claude-3-7-sonnet-20250219",
|
|
7
|
+
"claude-4": "claude-sonnet-4-20250514",
|
|
8
|
+
"claude-sonnet-4": "claude-sonnet-4-20250514",
|
|
9
|
+
"claude-opus-4": "claude-opus-4-20250514",
|
|
10
|
+
gemini: "gemini-2.5-pro",
|
|
11
|
+
"gemini-2.5": "gemini-2.5-pro",
|
|
12
|
+
"gemini-2.5-pro": "gemini-2.5-pro",
|
|
13
|
+
o3: "o3-2025-04-16",
|
|
14
|
+
"o3-2025-04-16": "o3-2025-04-16",
|
|
15
|
+
"gpt-5": "gpt-5-2025-08-07",
|
|
16
|
+
"o4-mini": "o4-mini-2025-04-16",
|
|
17
|
+
"o4-mini-2025-04-16": "o4-mini-2025-04-16",
|
|
18
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HtmlReportData, HtmlReportFile, HtmlReportTest, PlaywrightMatchingTest, PlaywrightTestReport } from "@empiricalrun/shared-types";
|
|
2
|
+
import type { JSONReport } from "playwright/types/testReporter";
|
|
3
|
+
export declare function parsePlaywrightTestReport(jsonReport: JSONReport): PlaywrightTestReport;
|
|
4
|
+
export declare const findTestInReport: (reportJson: HtmlReportFile, targetTest: PlaywrightMatchingTest, allFiles: HtmlReportData["files"]) => HtmlReportTest | null;
|
|
5
|
+
export interface TestCriteria {
|
|
6
|
+
name: string;
|
|
7
|
+
file_path: string;
|
|
8
|
+
suites: string[];
|
|
9
|
+
}
|
|
10
|
+
export declare function findMatchingTest(tests: PlaywrightMatchingTest[], testCriteria: TestCriteria): PlaywrightMatchingTest | null;
|
|
11
|
+
export declare function fetchAndFindTestCase(summaryJsonUrl: string, testCriteria: TestCriteria): Promise<PlaywrightMatchingTest>;
|
|
12
|
+
export declare function findTestInPlaywrightSummary(summaryJson: JSONReport, testCriteria: TestCriteria): Promise<PlaywrightMatchingTest | null>;
|
|
13
|
+
//# sourceMappingURL=playwright-report-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playwright-report-parser.d.ts","sourceRoot":"","sources":["../../src/utils/playwright-report-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,UAAU,EAGX,MAAM,+BAA+B,CAAC;AAqEvC,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,UAAU,GACrB,oBAAoB,CAuBtB;AAED,eAAO,MAAM,gBAAgB,GAC3B,YAAY,cAAc,EAC1B,YAAY,sBAAsB,EAClC,UAAU,cAAc,CAAC,OAAO,CAAC,0BAwBlC,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,sBAAsB,EAAE,EAC/B,YAAY,EAAE,YAAY,GACzB,sBAAsB,GAAG,IAAI,CAgB/B;AAED,wBAAsB,oBAAoB,CACxC,cAAc,EAAE,MAAM,EACtB,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,sBAAsB,CAAC,CAqBjC;AAED,wBAAsB,2BAA2B,CAC/C,WAAW,EAAE,UAAU,EACvB,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CASxC"}
|