@empiricalrun/test-gen 0.31.18 → 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 CHANGED
@@ -1,5 +1,11 @@
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
+
3
9
  ## 0.31.18
4
10
 
5
11
  ### Patch Changes
@@ -0,0 +1,4 @@
1
+ import { PlaywrightActionGenerator } from "../types";
2
+ export declare const PLAYWRIGHT_HOVER_ACTION_NAME = "hover_element";
3
+ export declare const hoverActionGenerator: PlaywrightActionGenerator;
4
+ //# sourceMappingURL=hover.d.ts.map
@@ -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;AASnE,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;IAaxB,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"}
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"}
@@ -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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/test-gen",
3
- "version": "0.31.18",
3
+ "version": "0.31.19",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"