@empiricalrun/test-gen 0.31.17 → 0.31.19
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 +12 -0
- package/dist/actions/hover.d.ts +4 -0
- package/dist/actions/hover.d.ts.map +1 -0
- package/dist/actions/hover.js +51 -0
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +2 -0
- package/dist/agent/browsing/utils.d.ts.map +1 -1
- package/dist/agent/browsing/utils.js +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @empiricalrun/test-gen
|
|
2
2
|
|
|
3
|
+
## 0.31.19
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b097c97: feat: add hover action on browsing agent
|
|
8
|
+
|
|
9
|
+
## 0.31.18
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 3600f40: fix: pass suites in prepareFileForMasterAgent flow
|
|
14
|
+
|
|
3
15
|
## 0.31.17
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hover.d.ts","sourceRoot":"","sources":["../../src/actions/hover.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAIrD,eAAO,MAAM,4BAA4B,kBAAkB,CAAC;AAE5D,eAAO,MAAM,oBAAoB,EAAE,yBAoDlC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hoverActionGenerator = exports.PLAYWRIGHT_HOVER_ACTION_NAME = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
exports.PLAYWRIGHT_HOVER_ACTION_NAME = "hover_element";
|
|
7
|
+
const hoverActionGenerator = (page) => {
|
|
8
|
+
return {
|
|
9
|
+
execute: async (args) => {
|
|
10
|
+
const selector = args.css_selector;
|
|
11
|
+
const locator = await (0, utils_1.getPlaywrightLocatorUsingCssSelector)(selector, args.xpath, page);
|
|
12
|
+
const exec = new Function("page", `return page.${locator}.hover({ timeout: 3000 })`);
|
|
13
|
+
await exec(page);
|
|
14
|
+
await page.waitForTimeout(3000);
|
|
15
|
+
return {
|
|
16
|
+
locator,
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
// TODO: args transformer to be kept at a single place
|
|
20
|
+
template: (args, options) => {
|
|
21
|
+
return `await ${(0, utils_1.getPageVarName)()}.${options.locator}.hover();`;
|
|
22
|
+
},
|
|
23
|
+
name: exports.PLAYWRIGHT_HOVER_ACTION_NAME,
|
|
24
|
+
schema: {
|
|
25
|
+
type: "function",
|
|
26
|
+
function: {
|
|
27
|
+
name: exports.PLAYWRIGHT_HOVER_ACTION_NAME,
|
|
28
|
+
description: "hover over an element on the page",
|
|
29
|
+
parameters: {
|
|
30
|
+
type: "object",
|
|
31
|
+
properties: {
|
|
32
|
+
css_selector: {
|
|
33
|
+
type: "string",
|
|
34
|
+
description: "CSS selector to identify the element uniquely and hover over it. When creating CSS selectors, ensure they are unique and specific enough to select only one element, even if there are multiple elements of the same type (like multiple h1 elements)",
|
|
35
|
+
},
|
|
36
|
+
xpath: {
|
|
37
|
+
type: "string",
|
|
38
|
+
description: "XPath selector to identify the element uniquely and hover over it. When creating XPATH selector, ensure they are unique and specific enough to select only one element, even if there are multiple elements of the same type (like multiple h1 elements)",
|
|
39
|
+
},
|
|
40
|
+
reason: {
|
|
41
|
+
type: "string",
|
|
42
|
+
description: constants_1.DEFAULT_ACTION_REASON_PROMPT,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
required: ["css_selector", "xpath", "reason"],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
exports.hoverActionGenerator = hoverActionGenerator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAIlC,OAAO,EAAE,YAAY,EAA6B,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAIlC,OAAO,EAAE,YAAY,EAA6B,MAAM,UAAU,CAAC;AAUnE,qBAAa,iBAAiB;IAMhB,OAAO,CAAC,IAAI;IAJxB,OAAO,CAAC,gBAAgB,CAA8B;IACtD,OAAO,CAAC,eAAe,CAAmC;IAC1D,OAAO,CAAC,cAAc,CAA2B;gBAE7B,IAAI,EAAE,IAAI;IAcxB,aAAa,CAAC,IAAI,oBAAa,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAyBhE,gBAAgB,IAAI,YAAY,EAAE;IAMlC,YAAY;IAIZ,gBAAgB,CAAC,KAAK,EAAE,MAAM;IAO9B,UAAU;CAUX"}
|
package/dist/actions/index.js
CHANGED
|
@@ -8,6 +8,7 @@ const click_1 = require("./click");
|
|
|
8
8
|
const done_1 = require("./done");
|
|
9
9
|
const fill_1 = require("./fill");
|
|
10
10
|
const goto_1 = require("./goto");
|
|
11
|
+
const hover_1 = require("./hover");
|
|
11
12
|
const reload_page_1 = require("./reload-page");
|
|
12
13
|
const text_content_1 = require("./text-content");
|
|
13
14
|
class PlaywrightActions {
|
|
@@ -22,6 +23,7 @@ class PlaywrightActions {
|
|
|
22
23
|
fill_1.fillActionGenerator,
|
|
23
24
|
goto_1.gotoActionGenerator,
|
|
24
25
|
click_1.clickActionGenerator,
|
|
26
|
+
hover_1.hoverActionGenerator,
|
|
25
27
|
done_1.doneActionGenerator,
|
|
26
28
|
assert_1.assertTextVisibilityActionGenerator,
|
|
27
29
|
reload_page_1.reloadActionGenerator,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAavD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAK5C,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,MAAM,CAKhD;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,UAIvD;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agent/browsing/utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAavD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAK5C,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,MAAM,CAKhD;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,UAIvD;AA2DD;;;;GAIG;AACH,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE,aAAa,GACvB,OAAO,CAAC,MAAM,CAAC,CA2CjB;AAyBD,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,IAAI,iBAiBxD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,QA6BjD;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAM1E;AAWD;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,YAAY,EAAE,MAAM,EACpB,gBAAgB,EAAE,oBAAoB,GACrC,OAAO,CAAC,MAAM,CAAC,CA8CjB;AAED,wBAAsB,sBAAsB,CAAC,EAC3C,YAAiB,EACjB,IAAS,EACT,eAAoB,EACpB,gBAAqB,EACrB,UAAyC,GAC1C,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,8EASA"}
|
|
@@ -32,7 +32,7 @@ exports.prepareBrowsingAgentTask = prepareBrowsingAgentTask;
|
|
|
32
32
|
*/
|
|
33
33
|
async function prepareFileForUpdateScenario(genConfig) {
|
|
34
34
|
const { specPath, testCase } = genConfig;
|
|
35
|
-
const { name } = testCase;
|
|
35
|
+
const { name, suites } = testCase;
|
|
36
36
|
// update the test case with appropriate location for createTest
|
|
37
37
|
// TODO: reduce the payload for this LLM call. Only provide test file and page files which are used in the test block
|
|
38
38
|
// this will help with faster response
|
|
@@ -58,6 +58,7 @@ async function prepareFileForUpdateScenario(genConfig) {
|
|
|
58
58
|
const { testBlock, testNode } = (0, web_1.getTypescriptTestBlock)({
|
|
59
59
|
scenarioName: name,
|
|
60
60
|
content: testFileContent,
|
|
61
|
+
suites,
|
|
61
62
|
});
|
|
62
63
|
const parentDescribe = (0, web_1.findFirstSerialDescribeBlock)(testNode);
|
|
63
64
|
const isFileMarkedSerial = await (0, web_1.hasTopLevelDescribeConfigureWithSerialMode)(specPath);
|