@empiricalrun/test-gen 0.42.9 → 0.42.10
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 +11 -0
- package/dist/agent/codegen/lexical-scoped-vars.d.ts.map +1 -1
- package/dist/agent/codegen/lexical-scoped-vars.js +2 -3
- package/dist/agent/master/element-annotation.js +1 -1
- package/dist/agent/master/run.js +1 -1
- package/dist/agent/master/scroller.d.ts.map +1 -1
- package/dist/agent/master/scroller.js +4 -0
- package/dist/bin/utils/platform/web/index.d.ts.map +1 -1
- package/dist/bin/utils/platform/web/index.js +0 -2
- package/dist/browser-injected-scripts/annotate-elements.js +22 -6
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @empiricalrun/test-gen
|
|
2
2
|
|
|
3
|
+
## 0.42.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ad2e2c5: fix: annotations for small elements should be outside the container
|
|
8
|
+
- 6471bf9: test: updated timeouts
|
|
9
|
+
- fabdfd6: fix: moved lexical vars check to o3-mini and increased timeout
|
|
10
|
+
- 61bc738: fix: added message for scroll on dashboard
|
|
11
|
+
- Updated dependencies [fabdfd6]
|
|
12
|
+
- @empiricalrun/llm@0.9.31
|
|
13
|
+
|
|
3
14
|
## 0.42.9
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexical-scoped-vars.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/lexical-scoped-vars.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"lexical-scoped-vars.d.ts","sourceRoot":"","sources":["../../../src/agent/codegen/lexical-scoped-vars.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAQrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGnD,wBAAsB,oBAAoB,CAAC,EACzC,KAAK,EACL,IAAI,EACJ,cAAc,EACd,OAAO,GACR,EAAE;IACD,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC,qBAoDA"}
|
|
@@ -16,14 +16,13 @@ async function getLexicalScopedVars({ trace, file, referencePoint, options, }) {
|
|
|
16
16
|
const llm = new llm_1.LLM({
|
|
17
17
|
trace: fetchLexicalScopedVarsSpan,
|
|
18
18
|
provider: options?.modelProvider || constants_1.DEFAULT_MODEL_PROVIDER,
|
|
19
|
-
defaultModel: options?.model ||
|
|
19
|
+
defaultModel: options?.model || "o3-mini-2025-01-31",
|
|
20
20
|
providerApiKey: constants_1.MODEL_API_KEYS[options?.modelProvider || constants_1.DEFAULT_MODEL_PROVIDER],
|
|
21
21
|
});
|
|
22
22
|
const message = await llm.createChatCompletion({
|
|
23
23
|
messages,
|
|
24
24
|
modelParameters: {
|
|
25
|
-
|
|
26
|
-
...options?.modelParameters,
|
|
25
|
+
max_completion_tokens: constants_1.DEFAULT_O1_MODEL_PARAMETERS.max_completion_tokens,
|
|
27
26
|
},
|
|
28
27
|
responseFormat: {
|
|
29
28
|
type: "json_schema",
|
|
@@ -129,7 +129,7 @@ async function getElementAnnotation({ elementDescription, annotations, annotated
|
|
|
129
129
|
...constants_1.DEFAULT_MODEL_PARAMETERS,
|
|
130
130
|
...options?.modelParameters,
|
|
131
131
|
tool_choice: "required",
|
|
132
|
-
temperature:
|
|
132
|
+
temperature: 0.5,
|
|
133
133
|
},
|
|
134
134
|
trace: annotationsSpan,
|
|
135
135
|
traceName: "get-element-from-action",
|
package/dist/agent/master/run.js
CHANGED
|
@@ -198,7 +198,7 @@ async function createTestUsingMasterAgent({ task, page, testCase, options, scope
|
|
|
198
198
|
});
|
|
199
199
|
if (annotationKeys.length > 0) {
|
|
200
200
|
const annotationMapString = annotationKeys
|
|
201
|
-
?.map((a) => `${a.elementID}
|
|
201
|
+
?.map((a) => `${a.elementID}: ${a.text}`)
|
|
202
202
|
.join("\n");
|
|
203
203
|
// Provides the annotations for all the element present on screen
|
|
204
204
|
// Also provides the annotation of element on which the action needs to be taken
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroller.d.ts","sourceRoot":"","sources":["../../../src/agent/master/scroller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"scroller.d.ts","sourceRoot":"","sources":["../../../src/agent/master/scroller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAchD,MAAM,MAAM,cAAc,GAAG;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AA2ZF,wBAAsB,QAAQ,CAAC,EAC7B,kBAAkB,EAClB,IAAI,EACJ,KAAK,EACL,cAAc,EACd,MAAM,GACP,EAAE;IACD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CA6D5B"}
|
|
@@ -4,6 +4,7 @@ exports.scroller = void 0;
|
|
|
4
4
|
const llm_1 = require("@empiricalrun/llm");
|
|
5
5
|
const vision_1 = require("@empiricalrun/llm/vision");
|
|
6
6
|
const constants_1 = require("../../constants");
|
|
7
|
+
const reporter_1 = require("../../reporter");
|
|
7
8
|
const utils_1 = require("../utils");
|
|
8
9
|
const action_tool_calls_1 = require("./action-tool-calls");
|
|
9
10
|
const element_annotation_1 = require("./element-annotation");
|
|
@@ -43,7 +44,9 @@ async function isScrollable({ scrollDirection, page, divAnnotation, }) {
|
|
|
43
44
|
// If the div annotation is undefined, we scroll the page
|
|
44
45
|
// else we scroll the element
|
|
45
46
|
async function scroll({ scrollBy, page, direction, divAnnotation, logger, }) {
|
|
47
|
+
const testGenUpdatesReporter = new reporter_1.TestGenUpdatesReporter();
|
|
46
48
|
if (divAnnotation) {
|
|
49
|
+
await testGenUpdatesReporter.sendMessage("Scrolling the div since element is not in view");
|
|
47
50
|
logger?.log("Scrolling the div since element is not in view");
|
|
48
51
|
return await page.evaluate(({ scrollBy, direction, divAnnotation }) => {
|
|
49
52
|
if (
|
|
@@ -58,6 +61,7 @@ async function scroll({ scrollBy, page, direction, divAnnotation, logger, }) {
|
|
|
58
61
|
return 0;
|
|
59
62
|
}, { scrollBy, direction, divAnnotation });
|
|
60
63
|
}
|
|
64
|
+
await testGenUpdatesReporter.sendMessage("Scrolling the page since element is not in view");
|
|
61
65
|
logger?.log("Scrolling the page since element is not in view");
|
|
62
66
|
return await page.evaluate(({ scrollBy, direction }) => {
|
|
63
67
|
let scrollHeight = scrollBy || window.innerHeight;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/bin/utils/platform/web/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMhD,OAAO,EAGL,IAAI,EAEJ,UAAU,EAEX,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,eAAO,MAAM,gCAAgC,eA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KvB,MAAM;iBACV,MAAM;YACX,MAAM,EAAE;YA2DjB,CAAC;AAEF,eAAO,MAAM,iCAAiC,cACjC,MAAM,EAAE,gBACL,MAAM,sBAyBrB,CAAC;AAEF,wBAAsB,qBAAqB,CAAC,EAC1C,YAAY,EACZ,QAAQ,EACR,MAAM,GACP,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,iBAgDA;AAED,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EAAE,iBAsBzB;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;CACpB,WAYA;AAED,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,MAAM,GACP,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,UAOA;AAED,wBAAgB,+BAA+B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CA4B5E;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQnD"}
|
|
@@ -229,8 +229,6 @@ exports.stripAndPrependImports = stripAndPrependImports;
|
|
|
229
229
|
async function lintErrors(filePath) {
|
|
230
230
|
const eslint = new eslint_1.ESLint({
|
|
231
231
|
fix: true,
|
|
232
|
-
// useEslintrc: false,
|
|
233
|
-
// overrideConfigFile: path.join(process.cwd(), ".eslintrc.js"),
|
|
234
232
|
useEslintrc: true,
|
|
235
233
|
});
|
|
236
234
|
const [result] = await eslint.lintFiles(filePath);
|
|
@@ -311,10 +311,7 @@ function annotateElementsWithPreference({
|
|
|
311
311
|
// Style the marker
|
|
312
312
|
Object.assign(marker.style, {
|
|
313
313
|
position: "absolute",
|
|
314
|
-
|
|
315
|
-
left: `${rect.left + windowToAnnotate.scrollX}px`,
|
|
316
|
-
background:
|
|
317
|
-
"-webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(255, 247, 133)), to(rgb(255, 197, 66)))",
|
|
314
|
+
background: "rgb(255, 197, 66)",
|
|
318
315
|
padding: "1px 3px 0px",
|
|
319
316
|
borderRadius: "3px",
|
|
320
317
|
border: "1px solid rgb(227, 190, 35)",
|
|
@@ -331,10 +328,29 @@ function annotateElementsWithPreference({
|
|
|
331
328
|
fontFamily: "Helvetica, Arial, sans-serif",
|
|
332
329
|
fontWeight: "bold",
|
|
333
330
|
textShadow: "rgba(255, 255, 255, 0.6) 0px 1px 0px",
|
|
331
|
+
visibility: "hidden", // Setting the visibility to hidden initially, to get the height and width of marker
|
|
334
332
|
});
|
|
335
333
|
|
|
336
|
-
// Attach the marker to the specified parent element
|
|
337
334
|
parentElement.appendChild(marker);
|
|
335
|
+
let markerRect = marker.getBoundingClientRect();
|
|
336
|
+
let top = rect.top + windowToAnnotate.scrollY;
|
|
337
|
+
let left = rect.left + windowToAnnotate.scrollX;
|
|
338
|
+
|
|
339
|
+
// If the target element is smaller, we annotate outside the container
|
|
340
|
+
if (markerRect.height > rect.height - markerRect.height) {
|
|
341
|
+
top = top - markerRect.height;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if (markerRect.width > rect.width - markerRect.width) {
|
|
345
|
+
left = left - markerRect.width / 2;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// Applying the position and setting visibility
|
|
349
|
+
marker.style.top = `${top}px`;
|
|
350
|
+
marker.style.left = `${left}px`;
|
|
351
|
+
marker.style.visibility = "visible";
|
|
352
|
+
|
|
353
|
+
// Attach the marker to the specified parent element
|
|
338
354
|
parentElements.push(parentElement);
|
|
339
355
|
return marker;
|
|
340
356
|
}
|
|
@@ -461,7 +477,7 @@ function annotateElementsWithPreference({
|
|
|
461
477
|
|
|
462
478
|
// Use createHintMarker with the specified container
|
|
463
479
|
createHintMarker(el, hint, container, windowToAnnotate);
|
|
464
|
-
el.style.boxShadow = `inset 0 0 0px
|
|
480
|
+
el.style.boxShadow = `inset 0 0 0px 1px red`;
|
|
465
481
|
|
|
466
482
|
// Add element details to the annotations map
|
|
467
483
|
annotationsMap[hint] = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/test-gen",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.10",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -72,9 +72,9 @@
|
|
|
72
72
|
"ts-morph": "^23.0.0",
|
|
73
73
|
"tsx": "^4.16.2",
|
|
74
74
|
"typescript": "^5.3.3",
|
|
75
|
-
"@empiricalrun/llm": "^0.9.
|
|
76
|
-
"@empiricalrun/
|
|
77
|
-
"@empiricalrun/
|
|
75
|
+
"@empiricalrun/llm": "^0.9.31",
|
|
76
|
+
"@empiricalrun/reporter": "^0.22.1",
|
|
77
|
+
"@empiricalrun/r2-uploader": "^0.3.8"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@playwright/test": "1.47.1",
|