@empiricalrun/test-gen 0.81.0 → 0.81.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/CHANGELOG.md +21 -0
- package/dist/file-info/adapters/github/reader.d.ts +1 -1
- package/dist/file-info/adapters/github/reader.d.ts.map +1 -1
- package/dist/file-info/adapters/github/reader.js +7 -5
- package/dist/tools/create-pull-request/index.d.ts.map +1 -1
- package/dist/tools/create-pull-request/index.js +1 -3
- package/dist/tools/create-pull-request/utils.d.ts +1 -0
- package/dist/tools/create-pull-request/utils.d.ts.map +1 -1
- package/dist/tools/create-pull-request/utils.js +4 -0
- package/dist/tools/executor/utils/git.d.ts +2 -1
- package/dist/tools/executor/utils/git.d.ts.map +1 -1
- package/dist/tools/executor/utils/git.js +3 -2
- package/dist/tools/executor/utils/index.d.ts.map +1 -1
- package/dist/tools/executor/utils/index.js +4 -0
- package/package.json +9 -9
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/agent/browsing/index.d.ts +0 -15
- package/dist/agent/browsing/index.d.ts.map +0 -1
- package/dist/agent/browsing/index.js +0 -60
- package/dist/agent/master/action-tool-calls.d.ts +0 -42
- package/dist/agent/master/action-tool-calls.d.ts.map +0 -1
- package/dist/agent/master/action-tool-calls.js +0 -87
- package/dist/agent/master/element-annotation.d.ts +0 -30
- package/dist/agent/master/element-annotation.d.ts.map +0 -1
- package/dist/agent/master/element-annotation.js +0 -175
- package/dist/agent/master/execute-browser-action.d.ts +0 -24
- package/dist/agent/master/execute-browser-action.d.ts.map +0 -1
- package/dist/agent/master/execute-browser-action.js +0 -121
- package/dist/agent/master/next-action.d.ts +0 -22
- package/dist/agent/master/next-action.d.ts.map +0 -1
- package/dist/agent/master/next-action.js +0 -97
- package/dist/agent/master/planner.d.ts +0 -15
- package/dist/agent/master/planner.d.ts.map +0 -1
- package/dist/agent/master/planner.js +0 -142
- package/dist/agent/master/run.d.ts +0 -17
- package/dist/agent/master/run.d.ts.map +0 -1
- package/dist/agent/master/run.js +0 -156
- package/dist/agent/master/scroller.d.ts +0 -15
- package/dist/agent/master/scroller.d.ts.map +0 -1
- package/dist/agent/master/scroller.js +0 -369
- package/dist/agent/master/with-hints.d.ts +0 -17
- package/dist/agent/master/with-hints.d.ts.map +0 -1
- package/dist/agent/master/with-hints.js +0 -103
- package/dist/agent/planner/run-time-planner.d.ts +0 -15
- package/dist/agent/planner/run-time-planner.d.ts.map +0 -1
- package/dist/agent/planner/run-time-planner.js +0 -98
- package/dist/agent/planner/run.d.ts +0 -7
- package/dist/agent/planner/run.d.ts.map +0 -1
- package/dist/agent/planner/run.js +0 -128
- package/dist/browser-injected-scripts/annotate-elements.js +0 -612
- package/dist/browser-injected-scripts/annotate-elements.spec.d.ts +0 -2
- package/dist/browser-injected-scripts/annotate-elements.spec.d.ts.map +0 -1
- package/dist/browser-injected-scripts/annotate-elements.spec.js +0 -202
- package/dist/browser-injected-scripts/annotate-elements.spec.ts +0 -327
- package/dist/generate-summary/frame-sampling.d.ts +0 -12
- package/dist/generate-summary/frame-sampling.d.ts.map +0 -1
- package/dist/generate-summary/frame-sampling.js +0 -72
- package/dist/generate-summary/generate-error-stack-summary.d.ts +0 -11
- package/dist/generate-summary/generate-error-stack-summary.d.ts.map +0 -1
- package/dist/generate-summary/generate-error-stack-summary.js +0 -41
- package/dist/generate-summary/generate-failed-step-screenshot-diff-summary.d.ts +0 -58
- package/dist/generate-summary/generate-failed-step-screenshot-diff-summary.d.ts.map +0 -1
- package/dist/generate-summary/generate-failed-step-screenshot-diff-summary.js +0 -460
- package/dist/generate-summary/generate-grouped-summary.d.ts +0 -18
- package/dist/generate-summary/generate-grouped-summary.d.ts.map +0 -1
- package/dist/generate-summary/generate-grouped-summary.js +0 -88
- package/dist/generate-summary/merge-summary.d.ts +0 -16
- package/dist/generate-summary/merge-summary.d.ts.map +0 -1
- package/dist/generate-summary/merge-summary.js +0 -43
- package/dist/generate-summary/pick-videos-for-comparison.d.ts +0 -9
- package/dist/generate-summary/pick-videos-for-comparison.d.ts.map +0 -1
- package/dist/generate-summary/pick-videos-for-comparison.js +0 -54
- package/dist/utils/env.d.ts +0 -2
- package/dist/utils/env.d.ts.map +0 -1
- package/dist/utils/env.js +0 -7
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mergeSummary = void 0;
|
|
4
|
-
const llm_1 = require("@empiricalrun/llm");
|
|
5
|
-
const promptTemplate_0 = "{{#section \"system\"}}\nYou are a software QA engineer who is given a task is to summarize automation test failure\n\nThe test failure will be provided to you in this format\n```\n{\n errorSummary: string, // the error stack of the test\n networkFailures: [\n {\n endpoint: string, // the endpoint that failed\n method: string, // endpoint method\n status: number, // the status code of the failure\n }\n ]\n}\n```\n\nYour output should be of the following format:\n```\n<error summary>\n\n<network failure that happened (if present. otherwise, skip it). not in bullets>\n```\n\nFollow these instructions before responding with output:\n- Do not respond with backticks\n- Do not drop information about unique elements, locators, status code, error messages in the summary\n- Avoid repeating \"test\" keyword\n- Timeout difference in errorSummary can be ignored during merging\n- The merged summary should be grammatically correct\n{{/section}}\n\n{{#section \"user\"}}\nFollowing is the test failure which needs to be summarized:\n{{test}}\n{{/section}}\n";
|
|
6
|
-
const mergeSummary = async ({ testRunId, test, errorSummary: errorStackSummary, networkFailures, videoDiffSummary, trace, }) => {
|
|
7
|
-
let output = "";
|
|
8
|
-
const payload = {
|
|
9
|
-
test: JSON.stringify({
|
|
10
|
-
errorSummary: videoDiffSummary || errorStackSummary,
|
|
11
|
-
networkFailures,
|
|
12
|
-
}),
|
|
13
|
-
};
|
|
14
|
-
try {
|
|
15
|
-
const messages = (0, llm_1.compilePrompt)(promptTemplate_0, payload);
|
|
16
|
-
trace?.event({
|
|
17
|
-
input: {
|
|
18
|
-
payload,
|
|
19
|
-
},
|
|
20
|
-
output: { messages },
|
|
21
|
-
});
|
|
22
|
-
const llm = new llm_1.LLM({
|
|
23
|
-
trace,
|
|
24
|
-
// defaultModel: "gpt-4o-2024-08-06",
|
|
25
|
-
providerApiKey: process.env.ANTHROPIC_API_KEY,
|
|
26
|
-
provider: "anthropic",
|
|
27
|
-
defaultModel: "claude-3-5-sonnet-latest",
|
|
28
|
-
});
|
|
29
|
-
const llmResponse = await llm.createChatCompletion({
|
|
30
|
-
messages: messages,
|
|
31
|
-
trace,
|
|
32
|
-
modelParameters: {
|
|
33
|
-
temperature: 0.2,
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
output = llmResponse?.content ?? "";
|
|
37
|
-
}
|
|
38
|
-
catch (e) {
|
|
39
|
-
throw new Error(`Failed to merge network+video+error stack summary for test - "${test.title}", testRunId - "${testRunId}"`, e.message);
|
|
40
|
-
}
|
|
41
|
-
return output;
|
|
42
|
-
};
|
|
43
|
-
exports.mergeSummary = mergeSummary;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { TestGroup } from "@empiricalrun/shared-types/failure-workflow";
|
|
2
|
-
export declare const pickVideosForComparison: ({ testRunId, test, }: {
|
|
3
|
-
testRunId: number;
|
|
4
|
-
test: TestGroup;
|
|
5
|
-
}) => Promise<{
|
|
6
|
-
failure: string;
|
|
7
|
-
success: string;
|
|
8
|
-
}>;
|
|
9
|
-
//# sourceMappingURL=pick-videos-for-comparison.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pick-videos-for-comparison.d.ts","sourceRoot":"","sources":["../../src/generate-summary/pick-videos-for-comparison.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAExE,eAAO,MAAM,uBAAuB,GAAU,sBAG3C;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,SAAS,CAAC;CACjB,KAAG,OAAO,CAAC;IACV,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAiEA,CAAC"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.pickVideosForComparison = void 0;
|
|
4
|
-
const getVideoSize = async (url) => {
|
|
5
|
-
const response = await fetch(url, { method: "HEAD" });
|
|
6
|
-
if (!response.ok) {
|
|
7
|
-
console.warn(`Failed to fetch ${url}: ${response.statusText}`);
|
|
8
|
-
return 0;
|
|
9
|
-
}
|
|
10
|
-
const contentLength = response.headers.get("content-length");
|
|
11
|
-
if (!contentLength) {
|
|
12
|
-
console.warn(`Content-Length header is missing for ${url}`);
|
|
13
|
-
return 0;
|
|
14
|
-
}
|
|
15
|
-
const videoSize = parseInt(contentLength, 10);
|
|
16
|
-
console.log(`Recording size for ${url} is ------> ${videoSize} bytes`);
|
|
17
|
-
return videoSize;
|
|
18
|
-
};
|
|
19
|
-
const pickVideosForComparison = async ({ testRunId, test, }) => {
|
|
20
|
-
const videosPickedForComparison = {
|
|
21
|
-
failure: "",
|
|
22
|
-
success: "",
|
|
23
|
-
};
|
|
24
|
-
try {
|
|
25
|
-
const failureVideoWithLargestSize = (await Promise.all(test.failure.videos.map(async (video) => {
|
|
26
|
-
const size = await getVideoSize(video);
|
|
27
|
-
return { videoUrl: video, size };
|
|
28
|
-
}))).reduce((max, current) => {
|
|
29
|
-
return current.size > max.size ? current : max;
|
|
30
|
-
}, { videoUrl: "", size: 0 });
|
|
31
|
-
console.log(`Picking failure recording with largest size ------> ${failureVideoWithLargestSize.size}, url - ${failureVideoWithLargestSize.videoUrl}`);
|
|
32
|
-
videosPickedForComparison.failure = failureVideoWithLargestSize.videoUrl;
|
|
33
|
-
const successVideoWithLargestSize = (await Promise.all(test?.success?.videos?.map(async (video) => {
|
|
34
|
-
const size = await getVideoSize(video);
|
|
35
|
-
return { videoUrl: video, size };
|
|
36
|
-
}))).reduce((max, current) => {
|
|
37
|
-
return current.size > max.size ? current : max;
|
|
38
|
-
}, { videoUrl: "", size: 0 });
|
|
39
|
-
console.log(`Picking success recording with largest size ------> ${successVideoWithLargestSize.size}, url - ${successVideoWithLargestSize.videoUrl}`);
|
|
40
|
-
videosPickedForComparison.success = successVideoWithLargestSize.videoUrl;
|
|
41
|
-
if (!videosPickedForComparison.failure) {
|
|
42
|
-
console.warn(`No failure run recordings found for test - "${test.title}", for testRunId - "${testRunId}"`);
|
|
43
|
-
}
|
|
44
|
-
if (!videosPickedForComparison.success) {
|
|
45
|
-
console.warn(`No last successful run recordings found for test - "${test.title}", for testRunId - "${testRunId}"`);
|
|
46
|
-
}
|
|
47
|
-
return videosPickedForComparison;
|
|
48
|
-
}
|
|
49
|
-
catch (e) {
|
|
50
|
-
console.error("Error while processing bookmarks", e);
|
|
51
|
-
return videosPickedForComparison;
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
exports.pickVideosForComparison = pickVideosForComparison;
|
package/dist/utils/env.d.ts
DELETED
package/dist/utils/env.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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
DELETED