@empiricalrun/test-gen 0.35.8 → 0.35.9
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,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,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAIlC,OAAO,EAAE,YAAY,EAA6B,MAAM,UAAU,CAAC;AAYnE,qBAAa,iBAAiB;IAShB,OAAO,CAAC,IAAI;IARxB,OAAO,CAAC,gBAAgB,CAA8B;IACtD,OAAO,CAAC,eAAe,CAInB;IACJ,OAAO,CAAC,cAAc,CAA2B;gBAE7B,IAAI,EAAE,IAAI;IAgBxB,aAAa,CACjB,IAAI,oBAAa,EACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,KAAK,CAAC,EAAE,WAAW;IAgDrB,wBAAwB,IAAI,YAAY,EAAE;IAmB1C,sBAAsB,IAAI,YAAY,EAAE;IAUxC,YAAY,IAAI;QACd,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,EAAE,CAAC;KACvB;IAUD,gBAAgB,CAAC,KAAK,EAAE,MAAM;IAO9B;;;;;;OAMG;IACH,aAAa,IAAI,OAAO;IAQxB,UAAU;CAUX"}
|
package/dist/actions/index.js
CHANGED
|
@@ -9,6 +9,7 @@ const done_1 = require("./done");
|
|
|
9
9
|
const fill_1 = require("./fill");
|
|
10
10
|
const goto_1 = require("./goto");
|
|
11
11
|
const hover_1 = require("./hover");
|
|
12
|
+
const press_1 = require("./press");
|
|
12
13
|
const reload_page_1 = require("./reload-page");
|
|
13
14
|
const skill_1 = require("./skill");
|
|
14
15
|
const text_content_1 = require("./text-content");
|
|
@@ -24,6 +25,7 @@ class PlaywrightActions {
|
|
|
24
25
|
goto_1.gotoActionGenerator,
|
|
25
26
|
click_1.clickActionGenerator,
|
|
26
27
|
hover_1.hoverActionGenerator,
|
|
28
|
+
press_1.pressActionGenerator,
|
|
27
29
|
done_1.doneActionGenerator,
|
|
28
30
|
assert_1.assertTextVisibilityActionGenerator,
|
|
29
31
|
reload_page_1.reloadActionGenerator,
|
|
@@ -84,6 +86,7 @@ class PlaywrightActions {
|
|
|
84
86
|
fill_1.fillActionGenerator,
|
|
85
87
|
goto_1.gotoActionGenerator,
|
|
86
88
|
click_1.clickActionGenerator,
|
|
89
|
+
press_1.pressActionGenerator,
|
|
87
90
|
done_1.doneActionGenerator,
|
|
88
91
|
assert_1.assertTextVisibilityActionGenerator,
|
|
89
92
|
reload_page_1.reloadActionGenerator,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"press.d.ts","sourceRoot":"","sources":["../../src/actions/press.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAIrD,eAAO,MAAM,4BAA4B,8BAA8B,CAAC;AAExE,eAAO,MAAM,oBAAoB,EAAE,yBA4DlC,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pressActionGenerator = exports.PLAYWRIGHT_PRESS_ACTION_NAME = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
exports.PLAYWRIGHT_PRESS_ACTION_NAME = "keyboard_press_on_element";
|
|
7
|
+
const pressActionGenerator = (page) => {
|
|
8
|
+
return {
|
|
9
|
+
execute: async ({ args }) => {
|
|
10
|
+
const css = args.css_selector;
|
|
11
|
+
const locator = await (0, utils_1.getPlaywrightLocatorUsingCssSelector)(css, args.xpath, page, args?.elementAnnotation);
|
|
12
|
+
const exec = new Function("page", `return page.${locator}.press("${args.key}", { timeout: 3000 })`);
|
|
13
|
+
await exec(page);
|
|
14
|
+
return {
|
|
15
|
+
locator,
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
// TODO: args transformer to be kept at a single place
|
|
19
|
+
template: (args, options) => {
|
|
20
|
+
return {
|
|
21
|
+
code: `await ${(0, utils_1.getPageVarName)()}.${options.locator}.press("${args.key}");`,
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
name: exports.PLAYWRIGHT_PRESS_ACTION_NAME,
|
|
25
|
+
schema: {
|
|
26
|
+
type: "function",
|
|
27
|
+
function: {
|
|
28
|
+
name: exports.PLAYWRIGHT_PRESS_ACTION_NAME,
|
|
29
|
+
description: "Focuses the matching element and presses a combination of the keys",
|
|
30
|
+
parameters: {
|
|
31
|
+
type: "object",
|
|
32
|
+
properties: {
|
|
33
|
+
reason: {
|
|
34
|
+
type: "string",
|
|
35
|
+
description: constants_1.DEFAULT_ACTION_REASON_PROMPT,
|
|
36
|
+
},
|
|
37
|
+
key: {
|
|
38
|
+
type: "string",
|
|
39
|
+
description: "The key to press on the keyboard after focusing the element. Example: F1 - F12, Digit0- Digit9, KeyA- KeyZ, Backquote, Minus, Equal, Backslash, Backspace, Tab, Delete, Escape, ArrowDown, End, Enter, Home, Insert, PageDown, PageUp, ArrowRight, ArrowUp, etc.",
|
|
40
|
+
},
|
|
41
|
+
xpath: {
|
|
42
|
+
type: "string",
|
|
43
|
+
description: "XPath selector to identify the element uniquely and click 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)",
|
|
44
|
+
},
|
|
45
|
+
css_selector: {
|
|
46
|
+
type: "string",
|
|
47
|
+
description: "CSS selector to identify the element uniquely.When creating CSS selectors, ensure they are unique to the page and specific enough to select only one element.",
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
required: ["reason", "key", "xpath", "css_selector"],
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
exports.pressActionGenerator = pressActionGenerator;
|