@empiricalrun/test-gen 0.36.6 → 0.37.1
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 +17 -0
- package/browser-injected-scripts/annotate-elements.js +3 -0
- package/browser-injected-scripts/annotate-elements.spec.ts +0 -9
- package/dist/actions/next-task.d.ts +23 -0
- package/dist/actions/next-task.d.ts.map +1 -1
- package/dist/actions/next-task.js +24 -1
- package/dist/agent/codegen/update-flow.d.ts +8 -0
- package/dist/agent/codegen/update-flow.d.ts.map +1 -1
- package/dist/agent/codegen/update-flow.js +41 -21
- package/dist/agent/codegen/utils.d.ts +19 -0
- package/dist/agent/codegen/utils.d.ts.map +1 -1
- package/dist/agent/codegen/utils.js +32 -1
- package/dist/agent/master/run.js +1 -1
- package/dist/browser-injected-scripts/annotate-elements.js +3 -0
- package/dist/browser-injected-scripts/annotate-elements.spec.ts +0 -9
- package/dist/evals/append-create-test-agent.evals.d.ts +4 -0
- package/dist/evals/append-create-test-agent.evals.d.ts.map +1 -0
- package/dist/evals/append-create-test-agent.evals.js +18 -0
- package/package.json +11 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @empiricalrun/test-gen
|
|
2
2
|
|
|
3
|
+
## 0.37.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3526169: fix: updated prompt for master agent next step
|
|
8
|
+
|
|
9
|
+
## 0.37.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 97e5659: feat: add append create test agent evals
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 2dfecf6: fix: infer agent before enrichment call
|
|
18
|
+
- 5b4509b: updated annotation hints for vue
|
|
19
|
+
|
|
3
20
|
## 0.36.6
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -290,6 +290,9 @@ window.annotateClickableElements = function annotateClickableElements(
|
|
|
290
290
|
isClickable = true;
|
|
291
291
|
} else if (element.classList.contains("cursor-pointer")) {
|
|
292
292
|
isClickable = true;
|
|
293
|
+
} else if (element.classList.contains("v-list-item--link")) {
|
|
294
|
+
// vue specific click handling
|
|
295
|
+
isClickable = true;
|
|
293
296
|
} else if (element.style.cursor === "pointer") {
|
|
294
297
|
isClickable = true;
|
|
295
298
|
}
|
|
@@ -18,7 +18,6 @@ test("should annotate all links on empirical landing page", async ({
|
|
|
18
18
|
const { annotations } = window.annotateClickableElements();
|
|
19
19
|
|
|
20
20
|
return Object.entries(annotations).map(([hint, config]) => ({
|
|
21
|
-
hint,
|
|
22
21
|
innerText: config.node.innerText,
|
|
23
22
|
tagName: config.node.tagName,
|
|
24
23
|
href: config.node.href,
|
|
@@ -27,49 +26,41 @@ test("should annotate all links on empirical landing page", async ({
|
|
|
27
26
|
|
|
28
27
|
test.expect(annotations).toEqual([
|
|
29
28
|
{
|
|
30
|
-
hint: "A",
|
|
31
29
|
innerText: "Empirical",
|
|
32
30
|
tagName: "A",
|
|
33
31
|
href: "https://assets-test.empirical.run/",
|
|
34
32
|
},
|
|
35
33
|
{
|
|
36
|
-
hint: "B",
|
|
37
34
|
innerText: "Blog",
|
|
38
35
|
tagName: "A",
|
|
39
36
|
href: "https://assets-test.empirical.run/blog",
|
|
40
37
|
},
|
|
41
38
|
{
|
|
42
|
-
hint: "C",
|
|
43
39
|
innerText: "Contact us",
|
|
44
40
|
tagName: "A",
|
|
45
41
|
href: "https://assets-test.empirical.run/contact",
|
|
46
42
|
},
|
|
47
43
|
{
|
|
48
|
-
hint: "D",
|
|
49
44
|
href: "https://dash.empirical.run/",
|
|
50
45
|
innerText: "Login ↗\n(opens in a new tab)",
|
|
51
46
|
tagName: "A",
|
|
52
47
|
},
|
|
53
48
|
{
|
|
54
|
-
hint: "E",
|
|
55
49
|
innerText: "Get early access",
|
|
56
50
|
tagName: "A",
|
|
57
51
|
href: "https://assets-test.empirical.run/contact",
|
|
58
52
|
},
|
|
59
53
|
{
|
|
60
|
-
hint: "F",
|
|
61
54
|
innerText: "Playwright\n(opens in a new tab)",
|
|
62
55
|
tagName: "A",
|
|
63
56
|
href: "https://github.com/microsoft/playwright",
|
|
64
57
|
},
|
|
65
58
|
{
|
|
66
|
-
hint: "G",
|
|
67
59
|
innerText: "Meet with us",
|
|
68
60
|
tagName: "A",
|
|
69
61
|
href: "https://assets-test.empirical.run/contact",
|
|
70
62
|
},
|
|
71
63
|
{
|
|
72
|
-
hint: "H",
|
|
73
64
|
innerText: "Privacy Policy",
|
|
74
65
|
tagName: "A",
|
|
75
66
|
href: "https://assets-test.empirical.run/privacy.html",
|
|
@@ -17,6 +17,29 @@ export declare const NextTaskAction: {
|
|
|
17
17
|
type: string;
|
|
18
18
|
description: string;
|
|
19
19
|
};
|
|
20
|
+
listOfAnnotations: {
|
|
21
|
+
type: string;
|
|
22
|
+
items: {
|
|
23
|
+
type: string;
|
|
24
|
+
properties: {
|
|
25
|
+
elementID: {
|
|
26
|
+
type: string;
|
|
27
|
+
};
|
|
28
|
+
text: {
|
|
29
|
+
type: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
required: string[];
|
|
33
|
+
};
|
|
34
|
+
description: string;
|
|
35
|
+
};
|
|
36
|
+
unannotatedElements: {
|
|
37
|
+
type: string;
|
|
38
|
+
items: {
|
|
39
|
+
type: string;
|
|
40
|
+
};
|
|
41
|
+
description: string;
|
|
42
|
+
};
|
|
20
43
|
elementAnnotation: {
|
|
21
44
|
type: string;
|
|
22
45
|
description: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-task.d.ts","sourceRoot":"","sources":["../../src/actions/next-task.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,cAAc,CAAC;AAErC,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"next-task.d.ts","sourceRoot":"","sources":["../../src/actions/next-task.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,cAAc,CAAC;AAErC,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyD1B,CAAC"}
|
|
@@ -23,9 +23,32 @@ The next action should be as atomic as possible, precise and should contain enou
|
|
|
23
23
|
E.g. each click, key press, input, assert should be a separate action.
|
|
24
24
|
Each action should take the task to completion, if not the action is invalid.`,
|
|
25
25
|
},
|
|
26
|
+
listOfAnnotations: {
|
|
27
|
+
type: "array",
|
|
28
|
+
items: {
|
|
29
|
+
type: "object",
|
|
30
|
+
properties: {
|
|
31
|
+
elementID: {
|
|
32
|
+
type: "string",
|
|
33
|
+
},
|
|
34
|
+
text: {
|
|
35
|
+
type: "string",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
required: ["elementId", "text"],
|
|
39
|
+
},
|
|
40
|
+
description: "A list which contains mapping of all the unique element IDs within the yellow box on the screen to their corresponding texts/icons. If an element is an icon, return 'Icon: <description of icon>'.",
|
|
41
|
+
},
|
|
42
|
+
unannotatedElements: {
|
|
43
|
+
type: "array",
|
|
44
|
+
items: {
|
|
45
|
+
type: "string",
|
|
46
|
+
},
|
|
47
|
+
description: "A list of text/icon of elements which are unannotated, clickable and are present on the screen. An element is annotated if there is a red box drawn around it. If an element is an icon, return 'Icon: <description of icon>'.",
|
|
48
|
+
},
|
|
26
49
|
elementAnnotation: {
|
|
27
50
|
type: "string",
|
|
28
|
-
description:
|
|
51
|
+
description: "If the element is present in listOfAnnotations, return the element ID; otherwise, return empty string ''.",
|
|
29
52
|
},
|
|
30
53
|
},
|
|
31
54
|
required: ["reason", "action", "elementAnnotation"],
|
|
@@ -13,6 +13,14 @@ export declare function getUpdateTestCodeCompletion({ testCase, testFileContent,
|
|
|
13
13
|
options?: TestGenConfigOptions;
|
|
14
14
|
}): Promise<string>;
|
|
15
15
|
export declare function updateTest(testCase: TestCase, file: string, options: TestGenConfigOptions | undefined, logging?: boolean, validate?: boolean, trace?: TraceClient): Promise<UpdatedTestCase[]>;
|
|
16
|
+
export declare function getAppendCreateTestBlockCompletion({ testFiles, pageFiles, testCase, testFilePath, options, trace, }: {
|
|
17
|
+
trace?: TraceClient;
|
|
18
|
+
pageFiles?: string;
|
|
19
|
+
testFiles: string;
|
|
20
|
+
testCase: TestCase;
|
|
21
|
+
options?: TestGenConfigOptions;
|
|
22
|
+
testFilePath: string;
|
|
23
|
+
}): Promise<string>;
|
|
16
24
|
export declare function appendCreateTestBlock({ testCase, file, options, trace, validateTypes, }: {
|
|
17
25
|
testCase: TestCase;
|
|
18
26
|
file: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-flow.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/update-flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAsB3B,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAI7D,KAAK,eAAe,GAAG,QAAQ,GAAG;IAChC,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAqIF,wBAAsB,2BAA2B,CAAC,EAChD,QAAQ,EACR,eAAe,EACf,SAAS,EACT,SAAS,EACT,YAAY,EACZ,KAAK,EACL,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC,GAAG,OAAO,CAAC,MAAM,CAAC,CA6ClB;AAED,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,oBAAoB,GAAG,SAAS,EACzC,OAAO,GAAE,OAAc,EACvB,QAAQ,GAAE,OAAc,EACxB,KAAK,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,eAAe,EAAE,CAAC,CA6D5B;AAED,wBAAsB,qBAAqB,CAAC,EAC1C,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,KAAK,EACL,aAAoB,GACrB,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"update-flow.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/update-flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAsB3B,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAI7D,KAAK,eAAe,GAAG,QAAQ,GAAG;IAChC,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAqIF,wBAAsB,2BAA2B,CAAC,EAChD,QAAQ,EACR,eAAe,EACf,SAAS,EACT,SAAS,EACT,YAAY,EACZ,KAAK,EACL,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC,GAAG,OAAO,CAAC,MAAM,CAAC,CA6ClB;AAED,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,oBAAoB,GAAG,SAAS,EACzC,OAAO,GAAE,OAAc,EACvB,QAAQ,GAAE,OAAc,EACxB,KAAK,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,eAAe,EAAE,CAAC,CA6D5B;AAED,wBAAsB,kCAAkC,CAAC,EACvD,SAAS,EACT,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,KAAK,GACN,EAAE;IACD,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;CACtB,mBA4DA;AAED,wBAAsB,qBAAqB,CAAC,EAC1C,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,KAAK,EACL,aAAoB,GACrB,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAyC7B"}
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.appendCreateTestBlock = exports.updateTest = exports.getUpdateTestCodeCompletion = void 0;
|
|
6
|
+
exports.appendCreateTestBlock = exports.getAppendCreateTestBlockCompletion = exports.updateTest = exports.getUpdateTestCodeCompletion = void 0;
|
|
7
7
|
const llm_1 = require("@empiricalrun/llm");
|
|
8
8
|
const crypto_1 = __importDefault(require("crypto"));
|
|
9
9
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
@@ -204,20 +204,7 @@ async function updateTest(testCase, file, options, logging = true, validate = tr
|
|
|
204
204
|
return generatedTestCases;
|
|
205
205
|
}
|
|
206
206
|
exports.updateTest = updateTest;
|
|
207
|
-
async function
|
|
208
|
-
const logger = new logger_1.CustomLogger({ useReporter: false });
|
|
209
|
-
logger.log("Appending create test block");
|
|
210
|
-
const context = await (0, context_1.contextForGeneration)(file);
|
|
211
|
-
const scenarioFileContent = await fs_extra_1.default.readFile(file, "utf-8");
|
|
212
|
-
const testCodePrompt = (0, fs_1.convertFileContentsToString)([
|
|
213
|
-
{
|
|
214
|
-
filePath: file,
|
|
215
|
-
content: scenarioFileContent,
|
|
216
|
-
},
|
|
217
|
-
]);
|
|
218
|
-
const { codePrompt, pomPrompt } = context;
|
|
219
|
-
const generatedTestCases = [];
|
|
220
|
-
// TODO: move this to a common place
|
|
207
|
+
async function getAppendCreateTestBlockCompletion({ testFiles, pageFiles, testCase, testFilePath, options, trace, }) {
|
|
221
208
|
const session = (0, session_1.getSessionDetails)();
|
|
222
209
|
trace =
|
|
223
210
|
trace ||
|
|
@@ -230,17 +217,26 @@ async function appendCreateTestBlock({ testCase, file, options, trace, validateT
|
|
|
230
217
|
options?.metadata.environment || "",
|
|
231
218
|
].filter((s) => !!s),
|
|
232
219
|
});
|
|
220
|
+
const appendCreateTestSpan = trace?.span({
|
|
221
|
+
name: "append-create-test-block",
|
|
222
|
+
input: {
|
|
223
|
+
testCase,
|
|
224
|
+
pageFiles,
|
|
225
|
+
testFiles,
|
|
226
|
+
testFilePath,
|
|
227
|
+
},
|
|
228
|
+
});
|
|
233
229
|
const promptName = "append-create-test-block";
|
|
234
230
|
const promptSpan = trace?.span({
|
|
235
231
|
name: "append-create-test-block-prompt",
|
|
236
232
|
});
|
|
237
233
|
const instruction = await (0, llm_1.getPrompt)(promptName, {
|
|
238
|
-
testFiles:
|
|
239
|
-
pageFiles:
|
|
234
|
+
testFiles: testFiles,
|
|
235
|
+
pageFiles: pageFiles,
|
|
240
236
|
scenarioName: testCase.name,
|
|
241
237
|
scenarioSteps: testCase.steps.join("\n"),
|
|
242
|
-
scenarioFile:
|
|
243
|
-
});
|
|
238
|
+
scenarioFile: testFilePath,
|
|
239
|
+
}, 25);
|
|
244
240
|
promptSpan?.end({ output: { instruction } });
|
|
245
241
|
const [userInstruction] = instruction.filter((s) => s.role === "user");
|
|
246
242
|
const [systemInstruction] = instruction.filter((s) => s.role === "system");
|
|
@@ -262,7 +258,32 @@ async function appendCreateTestBlock({ testCase, file, options, trace, validateT
|
|
|
262
258
|
},
|
|
263
259
|
});
|
|
264
260
|
let response = firstShotMessage?.content || "";
|
|
265
|
-
|
|
261
|
+
appendCreateTestSpan?.end({ output: response });
|
|
262
|
+
return response;
|
|
263
|
+
}
|
|
264
|
+
exports.getAppendCreateTestBlockCompletion = getAppendCreateTestBlockCompletion;
|
|
265
|
+
async function appendCreateTestBlock({ testCase, file, options, trace, validateTypes = true, }) {
|
|
266
|
+
const logger = new logger_1.CustomLogger({ useReporter: false });
|
|
267
|
+
logger.log("Appending create test block");
|
|
268
|
+
const context = await (0, context_1.contextForGeneration)(file);
|
|
269
|
+
const scenarioFileContent = await fs_extra_1.default.readFile(file, "utf-8");
|
|
270
|
+
const testCodePrompt = (0, fs_1.convertFileContentsToString)([
|
|
271
|
+
{
|
|
272
|
+
filePath: file,
|
|
273
|
+
content: scenarioFileContent,
|
|
274
|
+
},
|
|
275
|
+
]);
|
|
276
|
+
const { codePrompt, pomPrompt } = context;
|
|
277
|
+
const generatedTestCases = [];
|
|
278
|
+
const appendCreateTestResp = await getAppendCreateTestBlockCompletion({
|
|
279
|
+
testCase,
|
|
280
|
+
testFilePath: file,
|
|
281
|
+
options,
|
|
282
|
+
trace,
|
|
283
|
+
pageFiles: pomPrompt,
|
|
284
|
+
testFiles: testCodePrompt,
|
|
285
|
+
});
|
|
286
|
+
const fileChanges = (0, utils_1.extractAppendTestUpdates)(appendCreateTestResp);
|
|
266
287
|
await applyFileChanges({
|
|
267
288
|
trace,
|
|
268
289
|
testCase,
|
|
@@ -280,7 +301,6 @@ async function appendCreateTestBlock({ testCase, file, options, trace, validateT
|
|
|
280
301
|
...testCase,
|
|
281
302
|
updatedFiles: fileChanges.map((f) => f.filePath),
|
|
282
303
|
});
|
|
283
|
-
trace?.update({ input: { testCase }, output: { response } });
|
|
284
304
|
await (0, llm_1.flushAllTraces)();
|
|
285
305
|
return generatedTestCases;
|
|
286
306
|
}
|
|
@@ -18,7 +18,26 @@ export declare function extractTestUpdates(input: string): {
|
|
|
18
18
|
}[];
|
|
19
19
|
/**
|
|
20
20
|
*
|
|
21
|
+
* method to extract append create test updates
|
|
22
|
+
* @export
|
|
23
|
+
* @param {string} input
|
|
24
|
+
* @return {*} {({
|
|
25
|
+
* intent: string | undefined,
|
|
26
|
+
* updateLocation: string | undefined,
|
|
27
|
+
* filePath: string | undefined;
|
|
28
|
+
* oldCode: string | undefined;
|
|
29
|
+
* newCode: string | undefined;
|
|
30
|
+
* reason: string | undefined;
|
|
31
|
+
* }[])}
|
|
21
32
|
*/
|
|
33
|
+
export declare function extractAppendTestUpdates(input: string): {
|
|
34
|
+
intent: string | undefined;
|
|
35
|
+
updateLocation: string | undefined;
|
|
36
|
+
filePath: string | undefined;
|
|
37
|
+
oldCode: string | undefined;
|
|
38
|
+
newCode: string | undefined;
|
|
39
|
+
reason: string | undefined;
|
|
40
|
+
}[];
|
|
22
41
|
export declare function extractTestStepsSuggestions(input: string): {
|
|
23
42
|
testStep: string;
|
|
24
43
|
filePath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG;IACjD,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,EAAE,CAiBF;AAED
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG;IACjD,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,EAAE,CAiBF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG;IACvD,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,EAAE,CA8BF;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,GAAG;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CAChB,EAAE,CAeF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extractTestStepsSuggestions = exports.extractTestUpdates = void 0;
|
|
3
|
+
exports.extractTestStepsSuggestions = exports.extractAppendTestUpdates = exports.extractTestUpdates = void 0;
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
6
6
|
* method to extract file path and code updates for the LLM response of update flow
|
|
@@ -32,7 +32,38 @@ function extractTestUpdates(input) {
|
|
|
32
32
|
exports.extractTestUpdates = extractTestUpdates;
|
|
33
33
|
/**
|
|
34
34
|
*
|
|
35
|
+
* method to extract append create test updates
|
|
36
|
+
* @export
|
|
37
|
+
* @param {string} input
|
|
38
|
+
* @return {*} {({
|
|
39
|
+
* intent: string | undefined,
|
|
40
|
+
* updateLocation: string | undefined,
|
|
41
|
+
* filePath: string | undefined;
|
|
42
|
+
* oldCode: string | undefined;
|
|
43
|
+
* newCode: string | undefined;
|
|
44
|
+
* reason: string | undefined;
|
|
45
|
+
* }[])}
|
|
35
46
|
*/
|
|
47
|
+
function extractAppendTestUpdates(input) {
|
|
48
|
+
const result = [];
|
|
49
|
+
// TODO: use better structure for this. Do not kill me for this please.
|
|
50
|
+
const regex = /<reason_for_intent>(.*?)<\/reason_for_intent>[\s\S]*?<intent>(.*?)<\/intent>[\s\S]*?<location_of_update>([\s\S]*?)<\/location_of_update>[\s\S]*?<file_path>([\s\S]*?)<\/file_path>[\s\S]*?<old_code_block>([\s\S]*?)<\/old_code_block>[\s\S]*?<new_code_block>([\s\S]*?)<\/new_code_block>[\s\S]*?<change>([\s\S]*?)<\/change>/g;
|
|
51
|
+
let match;
|
|
52
|
+
while ((match = regex.exec(input)) !== null) {
|
|
53
|
+
const [, reasonForIntent, intent, updateLocation, filePath, oldCode, newCode, reason,] = match;
|
|
54
|
+
result.push({
|
|
55
|
+
reasonForIntent: reasonForIntent?.trim(),
|
|
56
|
+
intent: intent?.trim(),
|
|
57
|
+
updateLocation: updateLocation?.trim(),
|
|
58
|
+
filePath: filePath?.trim(),
|
|
59
|
+
oldCode: oldCode?.trim(),
|
|
60
|
+
newCode: newCode?.trim(),
|
|
61
|
+
reason: reason?.trim(),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
exports.extractAppendTestUpdates = extractAppendTestUpdates;
|
|
36
67
|
function extractTestStepsSuggestions(input) {
|
|
37
68
|
const result = [];
|
|
38
69
|
const regex = /<subtask>(.*?)<\/subtask>[\s\S]*?<file_import_path>([\s\S]*?)<\/file_import_path>[\s\S]*?<usage_example>([\s\S]*?)<\/usage_example>[\s\S]*?<reason>([\s\S]*?)<\/reason>/g;
|
package/dist/agent/master/run.js
CHANGED
|
@@ -40,7 +40,7 @@ async function getNextAction({ task, executedActions, failedActions, pageUrl, tr
|
|
|
40
40
|
failedActions: failedActions.map((a) => a).join("\n"),
|
|
41
41
|
executedActions: executedActions.map((a) => a).join("\n"),
|
|
42
42
|
pageUrl,
|
|
43
|
-
},
|
|
43
|
+
}, 20);
|
|
44
44
|
// assuming there is only one user message in the prompt. if there is a change in langfuse prompt format, this will need to be updated
|
|
45
45
|
const userMessage = promptMessages.filter((m) => m.role === "user")[0];
|
|
46
46
|
const systemMessage = promptMessages.filter((m) => m.role === "system")[0];
|
|
@@ -290,6 +290,9 @@ window.annotateClickableElements = function annotateClickableElements(
|
|
|
290
290
|
isClickable = true;
|
|
291
291
|
} else if (element.classList.contains("cursor-pointer")) {
|
|
292
292
|
isClickable = true;
|
|
293
|
+
} else if (element.classList.contains("v-list-item--link")) {
|
|
294
|
+
// vue specific click handling
|
|
295
|
+
isClickable = true;
|
|
293
296
|
} else if (element.style.cursor === "pointer") {
|
|
294
297
|
isClickable = true;
|
|
295
298
|
}
|
|
@@ -18,7 +18,6 @@ test("should annotate all links on empirical landing page", async ({
|
|
|
18
18
|
const { annotations } = window.annotateClickableElements();
|
|
19
19
|
|
|
20
20
|
return Object.entries(annotations).map(([hint, config]) => ({
|
|
21
|
-
hint,
|
|
22
21
|
innerText: config.node.innerText,
|
|
23
22
|
tagName: config.node.tagName,
|
|
24
23
|
href: config.node.href,
|
|
@@ -27,49 +26,41 @@ test("should annotate all links on empirical landing page", async ({
|
|
|
27
26
|
|
|
28
27
|
test.expect(annotations).toEqual([
|
|
29
28
|
{
|
|
30
|
-
hint: "A",
|
|
31
29
|
innerText: "Empirical",
|
|
32
30
|
tagName: "A",
|
|
33
31
|
href: "https://assets-test.empirical.run/",
|
|
34
32
|
},
|
|
35
33
|
{
|
|
36
|
-
hint: "B",
|
|
37
34
|
innerText: "Blog",
|
|
38
35
|
tagName: "A",
|
|
39
36
|
href: "https://assets-test.empirical.run/blog",
|
|
40
37
|
},
|
|
41
38
|
{
|
|
42
|
-
hint: "C",
|
|
43
39
|
innerText: "Contact us",
|
|
44
40
|
tagName: "A",
|
|
45
41
|
href: "https://assets-test.empirical.run/contact",
|
|
46
42
|
},
|
|
47
43
|
{
|
|
48
|
-
hint: "D",
|
|
49
44
|
href: "https://dash.empirical.run/",
|
|
50
45
|
innerText: "Login ↗\n(opens in a new tab)",
|
|
51
46
|
tagName: "A",
|
|
52
47
|
},
|
|
53
48
|
{
|
|
54
|
-
hint: "E",
|
|
55
49
|
innerText: "Get early access",
|
|
56
50
|
tagName: "A",
|
|
57
51
|
href: "https://assets-test.empirical.run/contact",
|
|
58
52
|
},
|
|
59
53
|
{
|
|
60
|
-
hint: "F",
|
|
61
54
|
innerText: "Playwright\n(opens in a new tab)",
|
|
62
55
|
tagName: "A",
|
|
63
56
|
href: "https://github.com/microsoft/playwright",
|
|
64
57
|
},
|
|
65
58
|
{
|
|
66
|
-
hint: "G",
|
|
67
59
|
innerText: "Meet with us",
|
|
68
60
|
tagName: "A",
|
|
69
61
|
href: "https://assets-test.empirical.run/contact",
|
|
70
62
|
},
|
|
71
63
|
{
|
|
72
|
-
hint: "H",
|
|
73
64
|
innerText: "Privacy Policy",
|
|
74
65
|
tagName: "A",
|
|
75
66
|
href: "https://assets-test.empirical.run/privacy.html",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"append-create-test-agent.evals.d.ts","sourceRoot":"","sources":["../../src/evals/append-create-test-agent.evals.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,QAAA,MAAM,6BAA6B,EAAE,UAapC,CAAC;AAEF,eAAe,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const update_flow_1 = require("../agent/codegen/update-flow");
|
|
4
|
+
const appendCreateTestAgentEvaluate = async ({ item, trace }) => {
|
|
5
|
+
const { testCase, testFiles, pageFiles, testFilePath } = item.input;
|
|
6
|
+
const response = await (0, update_flow_1.getAppendCreateTestBlockCompletion)({
|
|
7
|
+
testCase,
|
|
8
|
+
testFiles,
|
|
9
|
+
pageFiles,
|
|
10
|
+
testFilePath,
|
|
11
|
+
trace,
|
|
12
|
+
});
|
|
13
|
+
return {
|
|
14
|
+
scores: [],
|
|
15
|
+
output: response,
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
exports.default = appendCreateTestAgentEvaluate;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/test-gen",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -9,6 +9,16 @@
|
|
|
9
9
|
"@empiricalrun/test-gen": "dist/bin/index.js"
|
|
10
10
|
},
|
|
11
11
|
"main": "dist/index.js",
|
|
12
|
+
"exports": {
|
|
13
|
+
"./agent/infer-agent": {
|
|
14
|
+
"types": "./dist/agent/infer-agent/index.d.ts",
|
|
15
|
+
"default": "./dist/agent/infer-agent/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./types": {
|
|
18
|
+
"types": "./dist/types/index.d.ts",
|
|
19
|
+
"default": "./dist/types/index.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
12
22
|
"repository": {
|
|
13
23
|
"type": "git",
|
|
14
24
|
"url": "https://github.com/empirical-run/empirical.git"
|