@playq/core 0.2.77

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.
Files changed (225) hide show
  1. package/README.md +41 -0
  2. package/bin/playq.js +175 -0
  3. package/cucumber.js +10 -0
  4. package/dist/exec/featureFileCache.d.ts +21 -0
  5. package/dist/exec/featureFileCache.js +124 -0
  6. package/dist/exec/featureFilePreProcess.d.ts +12 -0
  7. package/dist/exec/featureFilePreProcess.js +208 -0
  8. package/dist/exec/preLoader.d.ts +1 -0
  9. package/dist/exec/preLoader.js +72 -0
  10. package/dist/exec/preProcessEntry.d.ts +1 -0
  11. package/dist/exec/preProcessEntry.js +83 -0
  12. package/dist/exec/preProcess_old_todelete.d.ts +1 -0
  13. package/dist/exec/preProcess_old_todelete.js +258 -0
  14. package/dist/exec/runner.d.ts +1 -0
  15. package/dist/exec/runner.js +221 -0
  16. package/dist/exec/runner_orchestrator.d.ts +1 -0
  17. package/dist/exec/runner_orchestrator.js +85 -0
  18. package/dist/exec/sgGenerator.d.ts +11 -0
  19. package/dist/exec/sgGenerator.js +310 -0
  20. package/dist/global.d.ts +15 -0
  21. package/dist/global.js +185 -0
  22. package/dist/helper/actions/api/apiRequestActions.d.ts +117 -0
  23. package/dist/helper/actions/api/apiRequestActions.js +374 -0
  24. package/dist/helper/actions/api/apiValidationActions.d.ts +119 -0
  25. package/dist/helper/actions/api/apiValidationActions.js +615 -0
  26. package/dist/helper/actions/apiActions.d.ts +18 -0
  27. package/dist/helper/actions/apiActions.js +34 -0
  28. package/dist/helper/actions/apiStepDefs.d.ts +1 -0
  29. package/dist/helper/actions/apiStepDefs.js +64 -0
  30. package/dist/helper/actions/comm/commonActions.d.ts +58 -0
  31. package/dist/helper/actions/comm/commonActions.js +198 -0
  32. package/dist/helper/actions/comm/utilityActions.d.ts +131 -0
  33. package/dist/helper/actions/comm/utilityActions.js +351 -0
  34. package/dist/helper/actions/commActions.d.ts +18 -0
  35. package/dist/helper/actions/commActions.js +34 -0
  36. package/dist/helper/actions/commStepDefs.d.ts +1 -0
  37. package/dist/helper/actions/commStepDefs.js +57 -0
  38. package/dist/helper/actions/stepGroupStepDefs.d.ts +1 -0
  39. package/dist/helper/actions/stepGroupStepDefs.js +15 -0
  40. package/dist/helper/actions/web/alertActions.d.ts +61 -0
  41. package/dist/helper/actions/web/alertActions.js +224 -0
  42. package/dist/helper/actions/web/cookieActions.d.ts +45 -0
  43. package/dist/helper/actions/web/cookieActions.js +186 -0
  44. package/dist/helper/actions/web/downloadActions.d.ts +40 -0
  45. package/dist/helper/actions/web/downloadActions.js +153 -0
  46. package/dist/helper/actions/web/elementReaderActions.d.ts +95 -0
  47. package/dist/helper/actions/web/elementReaderActions.js +326 -0
  48. package/dist/helper/actions/web/formActions.d.ts +122 -0
  49. package/dist/helper/actions/web/formActions.js +423 -0
  50. package/dist/helper/actions/web/iframeActions.d.ts +23 -0
  51. package/dist/helper/actions/web/iframeActions.js +108 -0
  52. package/dist/helper/actions/web/javascriptActions.d.ts +14 -0
  53. package/dist/helper/actions/web/javascriptActions.js +77 -0
  54. package/dist/helper/actions/web/keyboardActions.d.ts +35 -0
  55. package/dist/helper/actions/web/keyboardActions.js +118 -0
  56. package/dist/helper/actions/web/localStorageActions.d.ts +51 -0
  57. package/dist/helper/actions/web/localStorageActions.js +163 -0
  58. package/dist/helper/actions/web/mouseActions.d.ts +240 -0
  59. package/dist/helper/actions/web/mouseActions.js +609 -0
  60. package/dist/helper/actions/web/reportingActions.d.ts +34 -0
  61. package/dist/helper/actions/web/reportingActions.js +58 -0
  62. package/dist/helper/actions/web/screenshotActions.d.ts +34 -0
  63. package/dist/helper/actions/web/screenshotActions.js +151 -0
  64. package/dist/helper/actions/web/testDataActions.d.ts +21 -0
  65. package/dist/helper/actions/web/testDataActions.js +211 -0
  66. package/dist/helper/actions/web/validationActions.d.ts +547 -0
  67. package/dist/helper/actions/web/validationActions.js +1754 -0
  68. package/dist/helper/actions/web/waitActions.d.ts +191 -0
  69. package/dist/helper/actions/web/waitActions.js +589 -0
  70. package/dist/helper/actions/web/webNavigation.d.ts +104 -0
  71. package/dist/helper/actions/web/webNavigation.js +288 -0
  72. package/dist/helper/actions/webActions.d.ts +32 -0
  73. package/dist/helper/actions/webActions.js +48 -0
  74. package/dist/helper/actions/webStepDefs.d.ts +1 -0
  75. package/dist/helper/actions/webStepDefs.js +455 -0
  76. package/dist/helper/browsers/browserManager.d.ts +1 -0
  77. package/dist/helper/browsers/browserManager.js +56 -0
  78. package/dist/helper/bundle/defaultEntries.d.ts +6 -0
  79. package/dist/helper/bundle/defaultEntries.js +200 -0
  80. package/dist/helper/bundle/env.d.ts +1 -0
  81. package/dist/helper/bundle/env.js +157 -0
  82. package/dist/helper/bundle/vars.d.ts +9 -0
  83. package/dist/helper/bundle/vars.js +375 -0
  84. package/dist/helper/faker/customFaker.d.ts +55 -0
  85. package/dist/helper/faker/customFaker.js +45 -0
  86. package/dist/helper/faker/modules/data/postcodes_valid_sg.json +17 -0
  87. package/dist/helper/faker/modules/dateTime.d.ts +18 -0
  88. package/dist/helper/faker/modules/dateTime.js +106 -0
  89. package/dist/helper/faker/modules/mobile.d.ts +4 -0
  90. package/dist/helper/faker/modules/mobile.js +59 -0
  91. package/dist/helper/faker/modules/nric.d.ts +32 -0
  92. package/dist/helper/faker/modules/nric.js +84 -0
  93. package/dist/helper/faker/modules/passport.d.ts +3 -0
  94. package/dist/helper/faker/modules/passport.js +36 -0
  95. package/dist/helper/faker/modules/person.d.ts +14 -0
  96. package/dist/helper/faker/modules/person.js +73 -0
  97. package/dist/helper/faker/modules/postcode.d.ts +6 -0
  98. package/dist/helper/faker/modules/postcode.js +47 -0
  99. package/dist/helper/fixtures/locAggregate.d.ts +7 -0
  100. package/dist/helper/fixtures/locAggregate.js +94 -0
  101. package/dist/helper/fixtures/logFixture.d.ts +8 -0
  102. package/dist/helper/fixtures/logFixture.js +56 -0
  103. package/dist/helper/fixtures/webFixture.d.ts +19 -0
  104. package/dist/helper/fixtures/webFixture.js +186 -0
  105. package/dist/helper/fixtures/webLocFixture.d.ts +2 -0
  106. package/dist/helper/fixtures/webLocFixture.js +144 -0
  107. package/dist/helper/report/allureStepLogger.d.ts +0 -0
  108. package/dist/helper/report/allureStepLogger.js +25 -0
  109. package/dist/helper/report/customiseReport.d.ts +1 -0
  110. package/dist/helper/report/customiseReport.js +55 -0
  111. package/dist/helper/report/init.d.ts +1 -0
  112. package/dist/helper/report/init.js +14 -0
  113. package/dist/helper/report/report.d.ts +1 -0
  114. package/dist/helper/report/report.js +102 -0
  115. package/dist/helper/util/dataLoader.d.ts +10 -0
  116. package/dist/helper/util/dataLoader.js +73 -0
  117. package/dist/helper/util/logger.d.ts +4 -0
  118. package/dist/helper/util/logger.js +61 -0
  119. package/dist/helper/util/session/sessionUtil.d.ts +26 -0
  120. package/dist/helper/util/session/sessionUtil.js +729 -0
  121. package/dist/helper/util/stepHelpers.d.ts +2 -0
  122. package/dist/helper/util/stepHelpers.js +16 -0
  123. package/dist/helper/util/test-data/dataLoader.d.ts +7 -0
  124. package/dist/helper/util/test-data/dataLoader.js +145 -0
  125. package/dist/helper/util/test-data/dataTest.d.ts +10 -0
  126. package/dist/helper/util/test-data/dataTest.js +216 -0
  127. package/dist/helper/util/totp/totpHelper.d.ts +38 -0
  128. package/dist/helper/util/totp/totpHelper.js +117 -0
  129. package/dist/helper/util/utilities/cryptoUtil.d.ts +2 -0
  130. package/dist/helper/util/utilities/cryptoUtil.js +53 -0
  131. package/dist/helper/util/utilities/schemaGeneratorUtil.d.ts +2 -0
  132. package/dist/helper/util/utilities/schemaGeneratorUtil.js +129 -0
  133. package/dist/helper/util/utils.d.ts +2 -0
  134. package/dist/helper/util/utils.js +22 -0
  135. package/dist/helper/wrapper/PlaywrightWrappers.d.ts +8 -0
  136. package/dist/helper/wrapper/PlaywrightWrappers.js +26 -0
  137. package/dist/helper/wrapper/assert.d.ts +9 -0
  138. package/dist/helper/wrapper/assert.js +23 -0
  139. package/dist/index.d.ts +7 -0
  140. package/dist/index.js +57 -0
  141. package/dist/scripts/get-versions.d.ts +1 -0
  142. package/dist/scripts/get-versions.js +98 -0
  143. package/dist/scripts/posttest.d.ts +1 -0
  144. package/dist/scripts/posttest.js +29 -0
  145. package/dist/scripts/pretest.d.ts +1 -0
  146. package/dist/scripts/pretest.js +57 -0
  147. package/dist/scripts/util.d.ts +1 -0
  148. package/dist/scripts/util.js +376 -0
  149. package/package.json +68 -0
  150. package/src/exec/featureFileCache.ts +80 -0
  151. package/src/exec/featureFilePreProcess.ts +239 -0
  152. package/src/exec/preLoader.ts +72 -0
  153. package/src/exec/preProcessEntry.ts +59 -0
  154. package/src/exec/preProcess_old_todelete.ts +289 -0
  155. package/src/exec/runner.ts +241 -0
  156. package/src/exec/runnerCuke.js +90 -0
  157. package/src/exec/runner_orchestrator.ts +91 -0
  158. package/src/exec/sgGenerator.ts +373 -0
  159. package/src/global.ts +130 -0
  160. package/src/helper/actions/api/apiRequestActions.ts +362 -0
  161. package/src/helper/actions/api/apiValidationActions.ts +594 -0
  162. package/src/helper/actions/apiActions.ts +18 -0
  163. package/src/helper/actions/apiStepDefs.ts +80 -0
  164. package/src/helper/actions/comm/commonActions.ts +165 -0
  165. package/src/helper/actions/comm/utilityActions.ts +344 -0
  166. package/src/helper/actions/commActions.ts +18 -0
  167. package/src/helper/actions/commStepDefs.ts +72 -0
  168. package/src/helper/actions/stepGroupStepDefs.ts +17 -0
  169. package/src/helper/actions/web/alertActions.ts +179 -0
  170. package/src/helper/actions/web/cookieActions.ts +124 -0
  171. package/src/helper/actions/web/downloadActions.ts +129 -0
  172. package/src/helper/actions/web/elementReaderActions.ts +323 -0
  173. package/src/helper/actions/web/formActions.ts +469 -0
  174. package/src/helper/actions/web/iframeActions.ts +67 -0
  175. package/src/helper/actions/web/javascriptActions.ts +38 -0
  176. package/src/helper/actions/web/keyboardActions.ts +101 -0
  177. package/src/helper/actions/web/localStorageActions.ts +109 -0
  178. package/src/helper/actions/web/mouseActions.ts +864 -0
  179. package/src/helper/actions/web/reportingActions.ts +53 -0
  180. package/src/helper/actions/web/screenshotActions.ts +124 -0
  181. package/src/helper/actions/web/testDataActions.ts +162 -0
  182. package/src/helper/actions/web/validationActions.ts +2287 -0
  183. package/src/helper/actions/web/waitActions.ts +757 -0
  184. package/src/helper/actions/web/webNavigation.ts +313 -0
  185. package/src/helper/actions/webActions.ts +33 -0
  186. package/src/helper/actions/webStepDefs.ts +505 -0
  187. package/src/helper/browsers/browserManager.ts +23 -0
  188. package/src/helper/bundle/defaultEntries.ts +208 -0
  189. package/src/helper/bundle/env.ts +119 -0
  190. package/src/helper/bundle/vars.ts +368 -0
  191. package/src/helper/faker/customFaker.ts +107 -0
  192. package/src/helper/faker/modules/data/postcodes_valid_sg.json +17 -0
  193. package/src/helper/faker/modules/dateTime.ts +121 -0
  194. package/src/helper/faker/modules/mobile.ts +58 -0
  195. package/src/helper/faker/modules/nric.ts +109 -0
  196. package/src/helper/faker/modules/passport.ts +34 -0
  197. package/src/helper/faker/modules/person.ts +93 -0
  198. package/src/helper/faker/modules/postcode.ts +57 -0
  199. package/src/helper/fixtures/locAggregate.ts +61 -0
  200. package/src/helper/fixtures/logFixture.ts +57 -0
  201. package/src/helper/fixtures/webFixture.ts +206 -0
  202. package/src/helper/fixtures/webLocFixture.ts +143 -0
  203. package/src/helper/report/allureStepLogger.ts +26 -0
  204. package/src/helper/report/customiseReport.ts +61 -0
  205. package/src/helper/report/init.ts +18 -0
  206. package/src/helper/report/report.ts +72 -0
  207. package/src/helper/util/dataLoader.ts +42 -0
  208. package/src/helper/util/logger.ts +32 -0
  209. package/src/helper/util/session/sessionUtil.ts +839 -0
  210. package/src/helper/util/stepHelpers.ts +14 -0
  211. package/src/helper/util/test-data/dataLoader.ts +108 -0
  212. package/src/helper/util/test-data/dataTest.ts +191 -0
  213. package/src/helper/util/test-data/registerUser.json +7 -0
  214. package/src/helper/util/totp/totpHelper.ts +102 -0
  215. package/src/helper/util/utilities/cryptoUtil.ts +53 -0
  216. package/src/helper/util/utilities/schemaGeneratorUtil.ts +143 -0
  217. package/src/helper/util/utils.ts +28 -0
  218. package/src/helper/wrapper/PlaywrightWrappers.ts +28 -0
  219. package/src/helper/wrapper/assert.ts +25 -0
  220. package/src/index.ts +17 -0
  221. package/src/scripts/get-versions.ts +68 -0
  222. package/src/scripts/posttest.ts +32 -0
  223. package/src/scripts/pretest.ts +48 -0
  224. package/src/scripts/util.ts +406 -0
  225. package/tsconfig.json +30 -0
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.pressKey = pressKey;
37
+ exports.pressEnter = pressEnter;
38
+ exports.pressTab = pressTab;
39
+ /**
40
+ * @file keyboardActions.ts
41
+ *
42
+ * Keyboard interaction utilities for PlayQ web actions.
43
+ * Provides typing and key press helpers with screenshot options and
44
+ * runner-aware step wrappers.
45
+ *
46
+ * Authors: PlayQ Team
47
+ * Version: v1.0.0
48
+ */
49
+ const allure = __importStar(require("allure-js-commons"));
50
+ const waitActions_1 = require("./waitActions");
51
+ const screenshotActions_1 = require("./screenshotActions");
52
+ const vars_1 = require("../../bundle/vars");
53
+ function isPlaywrightRunner() { return process.env.TEST_RUNNER === 'playwright'; }
54
+ const __allureAny_keys = allure;
55
+ if (typeof __allureAny_keys.step !== 'function') {
56
+ __allureAny_keys.step = async (_n, f) => await f();
57
+ }
58
+ // Allure compatibility shim: if step is unavailable, just run the body
59
+ const __allureAny_web = allure;
60
+ if (typeof __allureAny_web.step !== 'function') {
61
+ __allureAny_web.step = async (_name, fn) => await fn();
62
+ }
63
+ /**
64
+ * Web: Press Key -key: {param} -options: {param}
65
+ *
66
+ * Presses a keyboard key on the page or a specific element.
67
+ *
68
+ * @param page - Playwright Page instance
69
+ * @param key - The key to press (e.g., "Enter", "Tab", "ArrowDown", "a", etc.)
70
+ * @param options - Optional string or object:
71
+ * - screenshot: [boolean] Capture screenshot after pressing the key. Default: false.
72
+ * - screenshotText: [string] Description for the screenshot. Default: "".
73
+ * - screenshotFullPage: [boolean] Full page screenshot. Default: true.
74
+ *
75
+ * @example
76
+ * await pressKey(page, 'Enter', { field: 'Username', screenshot: true });
77
+ */
78
+ async function pressKey(page, key, options) {
79
+ const options_json = typeof options === "string" ? (0, vars_1.parseLooseJson)(options) : options || {};
80
+ const { screenshot = false, screenshotText = "", screenshotFullPage = true, } = options_json;
81
+ if (!page)
82
+ throw new Error("Page not initialized");
83
+ if (isPlaywrightRunner()) {
84
+ await __allureAny_keys.step(`Web: Press Key -key: ${key} -options: ${JSON.stringify(options_json)}`, async () => {
85
+ await doPressKey();
86
+ });
87
+ }
88
+ else {
89
+ await doPressKey();
90
+ }
91
+ async function doPressKey() {
92
+ await (0, waitActions_1.waitForPageToLoad)(page);
93
+ await page.keyboard.press(key, { delay: 0 });
94
+ await (0, screenshotActions_1.processScreenshot)(page, screenshot, screenshotText || `Pressed key: ${key}`, screenshotFullPage);
95
+ }
96
+ }
97
+ /**
98
+ * Web: Press Enter -options: {param}
99
+ *
100
+ * Convenience wrapper to press the Enter key.
101
+ *
102
+ * @param page Playwright Page instance
103
+ * @param options Optional JSON string or object ({ delay })
104
+ */
105
+ async function pressEnter(page, options) {
106
+ return pressKey(page, "Enter", options);
107
+ }
108
+ /**
109
+ * Web: Press Tab -options: {param}
110
+ *
111
+ * Convenience wrapper to press the Tab key.
112
+ *
113
+ * @param page Playwright Page instance
114
+ * @param options Optional JSON string or object ({ delay })
115
+ */
116
+ async function pressTab(page, options) {
117
+ return pressKey(page, "Tab", options);
118
+ }
@@ -0,0 +1,51 @@
1
+ import type { Page } from "playwright";
2
+ /**
3
+ * Web: LocalStorage Set -key: {param} -value: {param}
4
+ *
5
+ * Sets a key/value pair in window.localStorage.
6
+ *
7
+ * @param page - Playwright Page instance
8
+ * @param key - Storage key (required)
9
+ * @param value - Storage value
10
+ * @param options - Optional JSON string or object (reserved for future flags)
11
+ * @throws Error if page is not initialized or key is missing
12
+ */
13
+ export declare function setItem(page: Page, key: string, value: string, options?: any): Promise<void>;
14
+ export declare const localStorageSet: typeof setItem;
15
+ /**
16
+ * Web: LocalStorage Get -key: {param} -options: {param}
17
+ *
18
+ * Retrieves a value by key from window.localStorage.
19
+ *
20
+ * @param page - Playwright Page instance
21
+ * @param key - Storage key (required)
22
+ * @param options - Optional JSON string or object:
23
+ * - assert: [boolean] If true, throws when value is null/undefined (default: false)
24
+ * @returns Stored value or null
25
+ * @throws Error if page is not initialized or key is missing
26
+ */
27
+ export declare function getItem(page: Page, key: string, options?: any): Promise<any>;
28
+ export declare const localStorageGet: typeof getItem;
29
+ /**
30
+ * Web: LocalStorage Remove -key: {param}
31
+ *
32
+ * Removes a key from window.localStorage.
33
+ *
34
+ * @param page - Playwright Page instance
35
+ * @param key - Storage key (required)
36
+ * @param options - Optional JSON string or object (reserved for future flags)
37
+ * @throws Error if page is not initialized or key is missing
38
+ */
39
+ export declare function removeItem(page: Page, key: string, options?: any): Promise<void>;
40
+ export declare const localStorageRemove: typeof removeItem;
41
+ /**
42
+ * Web: LocalStorage Clear -options: {param}
43
+ *
44
+ * Clears all keys from window.localStorage.
45
+ *
46
+ * @param page - Playwright Page instance
47
+ * @param options - Optional JSON string or object (reserved for future flags)
48
+ * @throws Error if page is not initialized
49
+ */
50
+ export declare function clearStorage(page: Page, options?: any): Promise<void>;
51
+ export declare const localStorageClear: typeof clearStorage;
@@ -0,0 +1,163 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.localStorageClear = exports.localStorageRemove = exports.localStorageGet = exports.localStorageSet = void 0;
37
+ exports.setItem = setItem;
38
+ exports.getItem = getItem;
39
+ exports.removeItem = removeItem;
40
+ exports.clearStorage = clearStorage;
41
+ /**
42
+ * @file localStorageActions.ts
43
+ *
44
+ * window.localStorage helpers for PlayQ web actions.
45
+ * Provides set/get/remove/clear with runner-aware step wrappers.
46
+ *
47
+ * Authors: PlayQ Team
48
+ * Version: v1.0.0
49
+ */
50
+ const allure = __importStar(require("allure-js-commons"));
51
+ const global_1 = require("../../../global");
52
+ function isPlaywrightRunner() { return process.env.TEST_RUNNER === 'playwright'; }
53
+ const __allureAny_ls = allure;
54
+ if (typeof __allureAny_ls.step !== 'function') {
55
+ __allureAny_ls.step = async (_n, f) => await f();
56
+ }
57
+ /**
58
+ * Web: LocalStorage Set -key: {param} -value: {param}
59
+ *
60
+ * Sets a key/value pair in window.localStorage.
61
+ *
62
+ * @param page - Playwright Page instance
63
+ * @param key - Storage key (required)
64
+ * @param value - Storage value
65
+ * @param options - Optional JSON string or object (reserved for future flags)
66
+ * @throws Error if page is not initialized or key is missing
67
+ */
68
+ async function setItem(page, key, value, options) {
69
+ const stepName = `Web: LocalStorage Set -key: ${key}`;
70
+ if (!page)
71
+ throw new Error("Page not initialized");
72
+ if (!key)
73
+ throw new Error("LocalStorage.setItem: 'key' is required");
74
+ const _opts = typeof options === 'string' ? global_1.vars.parseLooseJson(options) : (options || {}); // reserved for future flags
75
+ const run = async () => page.evaluate(([k, v]) => localStorage.setItem(k, v), [key, value]);
76
+ if (isPlaywrightRunner()) {
77
+ await __allureAny_ls.step(stepName, run);
78
+ }
79
+ else {
80
+ await run();
81
+ }
82
+ }
83
+ // Friendly aliases
84
+ exports.localStorageSet = setItem;
85
+ /**
86
+ * Web: LocalStorage Get -key: {param} -options: {param}
87
+ *
88
+ * Retrieves a value by key from window.localStorage.
89
+ *
90
+ * @param page - Playwright Page instance
91
+ * @param key - Storage key (required)
92
+ * @param options - Optional JSON string or object:
93
+ * - assert: [boolean] If true, throws when value is null/undefined (default: false)
94
+ * @returns Stored value or null
95
+ * @throws Error if page is not initialized or key is missing
96
+ */
97
+ async function getItem(page, key, options) {
98
+ const stepName = `Web: LocalStorage Get -key: ${key}`;
99
+ if (!page)
100
+ throw new Error("Page not initialized");
101
+ if (!key)
102
+ throw new Error("LocalStorage.getItem: 'key' is required");
103
+ const _opts = typeof options === 'string' ? global_1.vars.parseLooseJson(options) : (options || {});
104
+ const run = async () => page.evaluate((k) => localStorage.getItem(k), key);
105
+ const result = isPlaywrightRunner() ? await __allureAny_ls.step(stepName, run) : await run();
106
+ if ((_opts === null || _opts === void 0 ? void 0 : _opts.assert) === true && (result === null || result === undefined)) {
107
+ throw new Error(`LocalStorage.getItem: No value found for key '${key}'`);
108
+ }
109
+ return result;
110
+ }
111
+ // Friendly aliases
112
+ exports.localStorageGet = getItem;
113
+ /**
114
+ * Web: LocalStorage Remove -key: {param}
115
+ *
116
+ * Removes a key from window.localStorage.
117
+ *
118
+ * @param page - Playwright Page instance
119
+ * @param key - Storage key (required)
120
+ * @param options - Optional JSON string or object (reserved for future flags)
121
+ * @throws Error if page is not initialized or key is missing
122
+ */
123
+ async function removeItem(page, key, options) {
124
+ const stepName = `Web: LocalStorage Remove -key: ${key}`;
125
+ if (!page)
126
+ throw new Error("Page not initialized");
127
+ if (!key)
128
+ throw new Error("LocalStorage.removeItem: 'key' is required");
129
+ const _opts = typeof options === 'string' ? global_1.vars.parseLooseJson(options) : (options || {}); // reserved for future flags
130
+ const run = async () => page.evaluate((k) => localStorage.removeItem(k), key);
131
+ if (isPlaywrightRunner()) {
132
+ await __allureAny_ls.step(stepName, run);
133
+ }
134
+ else {
135
+ await run();
136
+ }
137
+ }
138
+ // Friendly aliases
139
+ exports.localStorageRemove = removeItem;
140
+ /**
141
+ * Web: LocalStorage Clear -options: {param}
142
+ *
143
+ * Clears all keys from window.localStorage.
144
+ *
145
+ * @param page - Playwright Page instance
146
+ * @param options - Optional JSON string or object (reserved for future flags)
147
+ * @throws Error if page is not initialized
148
+ */
149
+ async function clearStorage(page, options) {
150
+ const stepName = `Web: LocalStorage Clear`;
151
+ if (!page)
152
+ throw new Error("Page not initialized");
153
+ const _opts = typeof options === 'string' ? global_1.vars.parseLooseJson(options) : (options || {}); // reserved for future flags
154
+ const run = async () => page.evaluate(() => localStorage.clear());
155
+ if (isPlaywrightRunner()) {
156
+ await __allureAny_ls.step(stepName, run);
157
+ }
158
+ else {
159
+ await run();
160
+ }
161
+ }
162
+ // Friendly aliases
163
+ exports.localStorageClear = clearStorage;
@@ -0,0 +1,240 @@
1
+ import { Page, Locator, BrowserContext } from "@playwright/test";
2
+ /**
3
+ * Web: Click Element -field: {param} -options: {param}
4
+ *
5
+ * Clicks an element on the page using the given fieldType.
6
+ *
7
+ * @param page - Playwright Page instance
8
+ * @param field - Label, text, selector, or Locator
9
+ * @param options - Optional JSON string or object:
10
+ * - fieldType: [string] Field type to resolve (button | action | div | text | link etc.)
11
+ * - actionTimeout: [number] Timeout in ms
12
+ * - pattern: [string] PatternIQ config override
13
+ * - isDoubleClick: [boolean]
14
+ * - screenshot: [boolean]
15
+ * - screenshotBefore: [boolean]
16
+ * - screenshotText: [string]
17
+ * - screenshotFullPage: [boolean]
18
+ */
19
+ export declare function click(page: Page, field: string | Locator, options?: string | Record<string, any>): Promise<void>;
20
+ /**
21
+ * Web: Mouseover on link -field: {param} -options: {param}
22
+ *
23
+ * Performs a mouse hover over a link element on the page, identified by text, label, id, name, or pattern.
24
+ *
25
+ * @param field - The text, label, id, name, or selector of the link to hover over (e.g., "Account", "Login", "Help").
26
+ * @param options - Optional JSON string or object:
27
+ * - actionTimeout: [number] Optional timeout in milliseconds for waiting. Default: Configured timeout.
28
+ * - pattern: [string] Optional pattern to refine element search. Default: Configured pattern.
29
+ * - screenshot: [boolean] Capture a screenshot after hovering over the link. Default: false.
30
+ * - screenshotText: [string] Text description for the screenshot. Default: "".
31
+ * - screenshotFullPage: [boolean] Capture full page screenshot. Default: true.
32
+ *
33
+ * @example
34
+ * Web: Mouseover on link -field: "{{top_menu}} My account" -options: "{screenshot: true, screenshotText: 'Hovered on My Account'}"
35
+ */
36
+ export declare function mouseoverOnLink(page: Page, field: string | Locator, options?: string | Record<string, any>): Promise<void>;
37
+ /**
38
+ * Web: Mouseover on text -text: {param} -options: {param}
39
+ *
40
+ * Performs a mouse hover over an element identified by its visible text.
41
+ *
42
+ * @param page - Playwright Page instance
43
+ * @param text - The visible text of the element to hover over
44
+ * @param options - Optional string or object:
45
+ * - actionTimeout: [number] Optional timeout in milliseconds for waiting. Default: Configured timeout.
46
+ * - pattern: [string] Optional pattern to refine element search.
47
+ * - screenshot: [boolean] Capture a screenshot after hovering. Default: false.
48
+ * - screenshotText: [string] Description for the screenshot.
49
+ * - screenshotFullPage: [boolean] Capture full page screenshot. Default: true.
50
+ *
51
+ * @example
52
+ * Web: Mouseover on text -text: "Menu" -options: "{screenshot: true, screenshotText: 'Hovered on Menu'}"
53
+ */
54
+ export declare function mouseoverOnText(page: Page, text: string, options?: string | Record<string, any>): Promise<void>;
55
+ /**
56
+ * Web: Click Button -field: {param} -options: {param}
57
+ *
58
+ * Clicks a button element on the page, identified by text, label, id, name, pattern, or locator.
59
+ *
60
+ * @param field - The label, text, id, name, or selector of the button to click (e.g., "Submit", "Save", "Cancel").
61
+ * @param options - Optional JSON string or object:
62
+ * - actionTimeout: [number] Optional timeout in milliseconds for waiting. Default: Configured testExecution > actionTimeout or 10000 milliseconds.
63
+ * - pattern: [string] Optional pattern to refine element search. Default: Configured pattern.
64
+ * - screenshot: [boolean] Capture a screenshot after clicking the button. Default: false.
65
+ * - screenshotText: [string] Text description for the screenshot. Default: "".
66
+ * - screenshotFullPage: [boolean] Capture full page screenshot. Default: true.
67
+ * - screenshotBefore: [boolean] Capture a screenshot before clicking. Default: false.
68
+ *
69
+ * @example
70
+ * Web: Click Button -field: "Register" -options: "{screenshot: true, screenshotText: 'After clicking Register'}"
71
+ */
72
+ export declare function clickButton(page: Page, field: string | Locator, options?: string | Record<string, any>): Promise<void>;
73
+ /**
74
+ * Web: Click Link -field: {param} -options: {param}
75
+ *
76
+ * Clicks a link element on the page, identified by link text, label, id, name, or pattern.
77
+ *
78
+ * @param field - The text, label, id, name, or selector of the link to click (e.g., "Home", "Login", "Forgot Password").
79
+ * @param options - Optional JSON string or object:
80
+ * - actionTimeout: [number] Optional timeout in milliseconds for waiting. Default: Configured timeout.
81
+ * - pattern: [string] Optional pattern to refine element search. Default: Configured pattern.
82
+ * - screenshot: [boolean] Capture a screenshot after clicking the link. Default: false.
83
+ * - screenshotText: [string] Text description for the screenshot. Default: "".
84
+ * - screenshotFullPage: [boolean] Capture full page screenshot. Default: true.
85
+ * - screenshotBefore: [boolean] Capture a screenshot before clicking. Default: false.
86
+ *
87
+ * @example
88
+ * Web: Click Link -field: "Register" -options: "{screenshot: true, screenshotText: 'After clicking Register'}"
89
+ */
90
+ export declare function clickLink(page: Page, field: string | Locator, options?: string | Record<string, any>): Promise<void>;
91
+ /**
92
+ * Web: Click tab -field: {param} -options: {param}
93
+ *
94
+ * Clicks a tab element on the page, identified by link text, label, id, name, or pattern.
95
+ *
96
+ * @param field - The text, label, id, name, or selector of the link to click (e.g., "Home", "Login", "Forgot Password").
97
+ * @param options - Optional JSON string or object:
98
+ * - actionTimeout: [number] Optional timeout in milliseconds for waiting. Default: Configured timeout.
99
+ * - pattern: [string] Optional pattern to refine element search. Default: Configured pattern.
100
+ * - screenshot: [boolean] Capture a screenshot after clicking the link. Default: false.
101
+ * - screenshotText: [string] Text description for the screenshot. Default: "".
102
+ * - screenshotFullPage: [boolean] Capture full page screenshot. Default: true.
103
+ * - screenshotBefore: [boolean] Capture a screenshot before clicking. Default: false.
104
+ *
105
+ * @example
106
+ * Web: Click tab -field: "Register" -options: "{screenshot: true, screenshotText: 'After clicking Register'}"
107
+ */
108
+ export declare function clickTab(page: Page, field: string | Locator, options?: string | Record<string, any>): Promise<void>;
109
+ /**
110
+ * Web: Click radio button -field: {param} -options: {param}
111
+ *
112
+ * Selects a radio button element on the page, identified by label, text, id, name, or pattern.
113
+ *
114
+ * @param field - The label, text, id, name, or selector of the radio button to select (e.g., "Yes", "No", "Subscribe").
115
+ * @param options - Optional JSON string or object:
116
+ * - actionTimeout: [number] Optional timeout in milliseconds for waiting. Default: Configured timeout.
117
+ * - pattern: [string] Optional pattern to refine element search. Default: Configured pattern.
118
+ * - force: [boolean] Force the action (e.g., ignore actionability checks). Default: true.
119
+ * - screenshot: [boolean] Capture a screenshot after selecting the radio button. Default: false.
120
+ * - screenshotText: [string] Text description for the screenshot. Default: "".
121
+ * - screenshotFullPage: [boolean] Capture a full page screenshot. Default: true.
122
+ * - screenshotBefore: [boolean] Capture a screenshot before selecting the radio button. Default: false.
123
+ *
124
+ * @example
125
+ * Web: Click radio button -field: "{radio_group:: Newsletter} Yes" -options: "{screenshot: true, screenshotText: 'After selecting Yes for Newsletter'}"
126
+ */
127
+ export declare function clickRadioButton(page: Page, field: string | Locator, options?: string | Record<string, any>): Promise<void>;
128
+ /**
129
+ * Web: Click checkbox -field: {param} -options: {param}
130
+ *
131
+ * Selects a checkbox element on the page, identified by label, text, id, name, or pattern.
132
+ *
133
+ * @param field - The label, text, id, name, or selector of the checkbox to select (e.g., "Agree", "Subscribe").
134
+ * @param options - Optional JSON string or object:
135
+ * - actionTimeout: [number] Optional timeout in milliseconds for waiting. Default: Configured timeout.
136
+ * - pattern: [string] Optional pattern to refine element search. Default: Configured pattern.
137
+ * - force: [boolean] Force the action (e.g., ignore actionability checks). Default: true.
138
+ * - screenshot: [boolean] Capture a screenshot after selecting the checkbox. Default: false.
139
+ * - screenshotText: [string] Text description for the screenshot. Default: "".
140
+ * - screenshotFullPage: [boolean] Capture a full page screenshot. Default: true.
141
+ * - screenshotBefore: [boolean] Capture a screenshot before selecting the checkbox. Default: false.
142
+ *
143
+ * @example
144
+ * Web: Click checkbox -field: "{checkbox_group:: Accept Terms} Agree" -options: "{screenshot: true, screenshotText: 'After selecting Agree for Accept Terms'}"
145
+ */
146
+ export declare function clickCheckbox(page: Page, field: string | Locator, options?: string | Record<string, any>): Promise<void>;
147
+ /**
148
+ * Web: Click at Coordinates -x: {param} -y: {param} -options: {param}
149
+ *
150
+ * Clicks at the specified page coordinates (default: 0,0).
151
+ *
152
+ * @param page - Playwright Page instance
153
+ * @param x - X coordinate (default: 0)
154
+ * @param y - Y coordinate (default: 0)
155
+ * @param options - Optional string or object:
156
+ * - screenshot: [boolean] Capture screenshot after clicking (default: false)
157
+ * - screenshotText: [string] Description for screenshot
158
+ * - screenshotFullPage: [boolean] Full page screenshot (default: true)
159
+ *
160
+ * @example
161
+ * await clickAtCoordinates(page); // Clicks at (0,0)
162
+ * await clickAtCoordinates(page, 100, 200, { screenshot: true });
163
+ */
164
+ export declare function clickAtCoordinates(page: Page, x?: number, y?: number, options?: string | Record<string, any>): Promise<void>;
165
+ /**
166
+ * Web: Drag and Drop -source: {param} -target: {param} -options: {param}
167
+ *
168
+ * Drags an element from source to target location.
169
+ *
170
+ * @param page Playwright Page instance
171
+ * @param source The source element to drag (label, text, id, name, or selector).
172
+ * @param target The target element to drop onto (label, text, id, name, or selector).
173
+ * @param options Optional JSON string or object:
174
+ * - fieldType: [string] Type of the elements (e.g., "item", "icon"). Default: "".
175
+ * - actionTimeout: [number] Optional timeout in milliseconds for waiting. Default: Configured timeout.
176
+ * - pattern: [string] Optional pattern to refine element search. Default: Configured pattern.
177
+ * - screenshot: [boolean] Capture a screenshot after drag and drop. Default: false.
178
+ * - screenshotText: [string] Text description for the screenshot. Default: "".
179
+ * - screenshotFullPage: [boolean] Capture a full page screenshot. Default: true.
180
+ * - screenshotBefore: [boolean] Capture a screenshot before drag and drop. Default: false.
181
+ *
182
+ * @example
183
+ * Web: Drag and Drop -source: "Item A" -target: "Item B" -options: "{screenshot: true, screenshotText: 'After drag and drop'}"
184
+ */
185
+ export declare function dragAndDrop(page: Page, source: string | Locator, target: string | Locator, options?: string | Record<string, any>): Promise<void>;
186
+ /**
187
+ * Web: Scroll To -x: {param} -y: {param} -options: {param}
188
+ *
189
+ * Scrolls the page to the specified x and y coordinates.
190
+ *
191
+ * @param page Playwright Page instance
192
+ * @param x The x-coordinate to scroll to.
193
+ * @param y The y-coordinate to scroll to.
194
+ * @param options Optional JSON string or object (reserved for future use).
195
+ *
196
+ * @example
197
+ * Web: Scroll To -x: 0 -y: 500 -options: "{}"
198
+ */
199
+ export declare function scrollTo(page: Page, x: number, y: number, options?: string | Record<string, any>): Promise<void>;
200
+ /**
201
+ * Web: Scroll Up -amount: {param} -options: {param}
202
+ *
203
+ * Scrolls the page up by the specified amount.
204
+ *
205
+ * @param page Playwright Page instance
206
+ * @param amount The amount in pixels to scroll up (default: 200).
207
+ * @param options Optional JSON string or object (reserved for future use).
208
+ *
209
+ * @example
210
+ * Web: Scroll Up -amount: 300 -options: "{}"
211
+ */
212
+ export declare function scrollUp(page: Page, amount?: number, options?: string | Record<string, any>): Promise<void>;
213
+ /**
214
+ * Web: Scroll Down -amount: {param} -options: {param}
215
+ *
216
+ * Scrolls the page down by the specified amount.
217
+ *
218
+ * @param page Playwright Page instance
219
+ * @param amount The amount in pixels to scroll down (default: 200).
220
+ * @param options Optional JSON string or object (reserved for future use).
221
+ *
222
+ * @example
223
+ * Web: Scroll Down -amount: 300 -options: "{}"
224
+ */
225
+ export declare function scrollDown(page: Page, amount?: number, options?: string | Record<string, any>): Promise<void>;
226
+ /**
227
+ * Web: Click and Wait for New Page -field: {param} -options: {param}
228
+ *
229
+ * Clicks a button or link and waits for a new page (tab) to open.
230
+ *
231
+ * @param context - Playwright BrowserContext
232
+ * @param page - Current Playwright Page
233
+ * @param field - The button/link text or locator to click
234
+ * @param options - Options for clickButton/clickLink
235
+ * @returns The new Page object
236
+ *
237
+ * @example
238
+ * const newPage = await clickAndWaitForNewPage(context, page, "Open Tab", { screenshot: true });
239
+ */
240
+ export declare function clickAndWaitForNewPage(context: BrowserContext, page: Page, field: string | Locator, options?: string | Record<string, any>): Promise<any>;