automation_model 1.0.445-dev → 1.0.445

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 (71) hide show
  1. package/README.md +130 -0
  2. package/lib/analyze_helper.js.map +1 -1
  3. package/lib/api.d.ts +43 -2
  4. package/lib/api.js +239 -49
  5. package/lib/api.js.map +1 -1
  6. package/lib/auto_page.d.ts +5 -2
  7. package/lib/auto_page.js +231 -49
  8. package/lib/auto_page.js.map +1 -1
  9. package/lib/browser_manager.d.ts +7 -3
  10. package/lib/browser_manager.js +172 -48
  11. package/lib/browser_manager.js.map +1 -1
  12. package/lib/bruno.d.ts +2 -0
  13. package/lib/bruno.js +381 -0
  14. package/lib/bruno.js.map +1 -0
  15. package/lib/command_common.d.ts +6 -0
  16. package/lib/command_common.js +202 -0
  17. package/lib/command_common.js.map +1 -0
  18. package/lib/date_time.js.map +1 -1
  19. package/lib/drawRect.js.map +1 -1
  20. package/lib/environment.d.ts +4 -0
  21. package/lib/environment.js +6 -2
  22. package/lib/environment.js.map +1 -1
  23. package/lib/error-messages.d.ts +6 -0
  24. package/lib/error-messages.js +206 -0
  25. package/lib/error-messages.js.map +1 -0
  26. package/lib/file_checker.d.ts +1 -0
  27. package/lib/file_checker.js +61 -0
  28. package/lib/file_checker.js.map +1 -0
  29. package/lib/find_function.js.map +1 -1
  30. package/lib/generation_scripts.d.ts +4 -0
  31. package/lib/generation_scripts.js +2 -0
  32. package/lib/generation_scripts.js.map +1 -0
  33. package/lib/index.d.ts +3 -0
  34. package/lib/index.js +3 -0
  35. package/lib/index.js.map +1 -1
  36. package/lib/init_browser.d.ts +5 -2
  37. package/lib/init_browser.js +128 -11
  38. package/lib/init_browser.js.map +1 -1
  39. package/lib/locate_element.d.ts +7 -0
  40. package/lib/locate_element.js +215 -0
  41. package/lib/locate_element.js.map +1 -0
  42. package/lib/locator.d.ts +37 -0
  43. package/lib/locator.js +172 -0
  44. package/lib/locator.js.map +1 -1
  45. package/lib/locator_log.d.ts +26 -0
  46. package/lib/locator_log.js +69 -0
  47. package/lib/locator_log.js.map +1 -0
  48. package/lib/network.d.ts +3 -0
  49. package/lib/network.js +183 -0
  50. package/lib/network.js.map +1 -0
  51. package/lib/scripts/axe.mini.js +12 -0
  52. package/lib/snapshot_validation.d.ts +37 -0
  53. package/lib/snapshot_validation.js +357 -0
  54. package/lib/snapshot_validation.js.map +1 -0
  55. package/lib/stable_browser.d.ts +152 -56
  56. package/lib/stable_browser.js +2416 -1303
  57. package/lib/stable_browser.js.map +1 -1
  58. package/lib/table.d.ts +15 -0
  59. package/lib/table.js +257 -0
  60. package/lib/table.js.map +1 -0
  61. package/lib/table_analyze.js.map +1 -1
  62. package/lib/table_helper.d.ts +19 -0
  63. package/lib/table_helper.js +116 -0
  64. package/lib/table_helper.js.map +1 -0
  65. package/lib/test_context.d.ts +7 -0
  66. package/lib/test_context.js +15 -10
  67. package/lib/test_context.js.map +1 -1
  68. package/lib/utils.d.ts +22 -2
  69. package/lib/utils.js +678 -11
  70. package/lib/utils.js.map +1 -1
  71. package/package.json +18 -10
package/lib/utils.js CHANGED
@@ -1,6 +1,9 @@
1
1
  import CryptoJS from "crypto-js";
2
2
  import path from "path";
3
3
  import { TOTP } from "totp-generator";
4
+ import fs from "fs";
5
+ import axios from "axios";
6
+ import objectPath from "object-path";
4
7
  // Function to encrypt a string
5
8
  function encrypt(text, key = null) {
6
9
  if (!key) {
@@ -8,8 +11,29 @@ function encrypt(text, key = null) {
8
11
  }
9
12
  return CryptoJS.AES.encrypt(text, key).toString();
10
13
  }
14
+ function getTestDataValue(key, environment = "*") {
15
+ const blinqEnvPath = "data/data.json";
16
+ const envPath = path.resolve(process.cwd(), blinqEnvPath);
17
+ const envJson = JSON.parse(fs.readFileSync(envPath, "utf-8"));
18
+ const dataArray = envJson[environment];
19
+ const item = dataArray.find((item) => item.key === key);
20
+ // if the item is not found in the specific env, check if it exists in the default environment
21
+ if (!item && environment !== "*") {
22
+ return getTestDataValue(key, "*");
23
+ }
24
+ if (!item) {
25
+ throw new Error(`Key ${key} not found in data.json`);
26
+ }
27
+ if (item.DataType === "string") {
28
+ return item.value;
29
+ }
30
+ else if (item.DataType === "secret" || item.DataType === "totp") {
31
+ return decrypt(item.value, null, false);
32
+ }
33
+ throw new Error(`Unsupported data type for key ${key}`);
34
+ }
11
35
  // Function to decrypt a string
12
- async function decrypt(encryptedText, key = null, totpWait = true) {
36
+ function decrypt(encryptedText, key = null, totpWait = true) {
13
37
  if (!key) {
14
38
  key = _findKey();
15
39
  }
@@ -21,19 +45,105 @@ async function decrypt(encryptedText, key = null, totpWait = true) {
21
45
  const bytes = CryptoJS.AES.decrypt(encryptedText, key);
22
46
  encryptedText = bytes.toString(CryptoJS.enc.Utf8);
23
47
  let { otp, expires } = TOTP.generate(encryptedText);
24
- if (totpWait) {
25
- // expires is in unix time, check if we have at least 10 seconds left, if it's less than wait for the expires time
26
- if (expires - Date.now() < 10000) {
27
- await new Promise((resolve) => setTimeout(resolve, (expires - Date.now() + 1000) % 30000));
28
- ({ otp, expires } = TOTP.generate(encryptedText));
29
- }
30
- }
48
+ // if (totpWait) {
49
+ // // expires is in unix time, check if we have at least 10 seconds left, if it's less than wait for the expires time
50
+ // if (expires - Date.now() < 10000) {
51
+ // await new Promise((resolve) => setTimeout(resolve, (expires - Date.now() + 1000) % 30000));
52
+ // ({ otp, expires } = TOTP.generate(encryptedText));
53
+ // }
54
+ // }
31
55
  return otp;
32
56
  }
57
+ if (encryptedText.startsWith("mask:")) {
58
+ return encryptedText.substring(5);
59
+ }
33
60
  const bytes = CryptoJS.AES.decrypt(encryptedText, key);
34
61
  return bytes.toString(CryptoJS.enc.Utf8);
35
62
  }
63
+ export function testForRegex(text) {
64
+ const regexEndPattern = /\/([gimuy]*)$/;
65
+ if (text.startsWith("/")) {
66
+ const match = regexEndPattern.test(text);
67
+ if (match) {
68
+ try {
69
+ const regex = new RegExp(text.substring(1, text.lastIndexOf("/")), text.match(regexEndPattern)[1]);
70
+ return true;
71
+ }
72
+ catch {
73
+ // not regex
74
+ }
75
+ }
76
+ }
77
+ return false;
78
+ }
79
+ function _convertToRegexQuery(text, isRegex, fullMatch, ignoreCase) {
80
+ let query = "internal:text=/";
81
+ let queryEnd = "/";
82
+ let pattern = "";
83
+ const regexEndPattern = /\/([gimuy]*)$/;
84
+ if (text.startsWith("/")) {
85
+ const match = regexEndPattern.test(text);
86
+ if (match) {
87
+ try {
88
+ const regex = new RegExp(text.substring(1, text.lastIndexOf("/")), text.match(regexEndPattern)[1]);
89
+ text = text.replace(/"/g, '\\"');
90
+ return "internal:text=" + text;
91
+ }
92
+ catch {
93
+ // not regex
94
+ }
95
+ }
96
+ }
97
+ if (isRegex) {
98
+ pattern = text;
99
+ }
100
+ else {
101
+ // first remove \n then split the text by any white space,
102
+ let parts = text.replace(/\\n/g, "").split(/\s+/);
103
+ // escape regex split part
104
+ parts = parts.map((part) => escapeRegex(part));
105
+ pattern = parts.join("\\s*");
106
+ }
107
+ if (fullMatch) {
108
+ pattern = "^\\s*" + pattern + "\\s*$";
109
+ }
110
+ if (ignoreCase) {
111
+ queryEnd += "i";
112
+ }
113
+ return query + pattern + queryEnd;
114
+ }
115
+ function escapeRegex(str) {
116
+ // Special regex characters that need to be escaped
117
+ const specialChars = [
118
+ "/",
119
+ ".",
120
+ "*",
121
+ "+",
122
+ "?",
123
+ "^",
124
+ "$",
125
+ "(",
126
+ ")",
127
+ "[",
128
+ "]",
129
+ "{",
130
+ "}",
131
+ "|",
132
+ "\\",
133
+ "-",
134
+ "'",
135
+ '"',
136
+ ">", // added to avoid confusion with pw selectorsxw
137
+ ];
138
+ // Create a regex that will match all special characters
139
+ const escapedRegex = new RegExp(specialChars.map((char) => `\\${char}`).join("|"), "g");
140
+ // Escape special characters by prefixing them with a backslash
141
+ return str.replace(escapedRegex, "\\$&");
142
+ }
36
143
  function _findKey() {
144
+ if (process.env.PROJECT_KEY) {
145
+ return process.env.PROJECT_KEY;
146
+ }
37
147
  if (process.env.PROJECT_ID) {
38
148
  return process.env.PROJECT_ID;
39
149
  }
@@ -45,7 +155,564 @@ function _findKey() {
45
155
  // extract the base folder name
46
156
  return path.basename(folder);
47
157
  }
48
- // console.log(encrypt("Hello, World!", null));
49
- // console.log(decrypt("U2FsdGVkX1+6mavadgkMgJPIhR3IO1pDkx36TjTyoyE=", null));
50
- export { encrypt, decrypt };
158
+ function _getDataFile(world = null, context = null, web = null) {
159
+ let dataFile = null;
160
+ if (world && world.reportFolder) {
161
+ dataFile = path.join(world.reportFolder, "data.json");
162
+ }
163
+ else if (web && web.reportFolder) {
164
+ dataFile = path.join(web.reportFolder, "data.json");
165
+ }
166
+ else if (context && context.reportFolder) {
167
+ dataFile = path.join(context.reportFolder, "data.json");
168
+ }
169
+ else if (web && web.project_path) {
170
+ dataFile = path.join(web.project_path, "data", "data.json");
171
+ }
172
+ else {
173
+ dataFile = "data.json";
174
+ }
175
+ return dataFile;
176
+ }
177
+ function _getTestDataFile(world = null, context = null, web = null) {
178
+ let dataFile = null;
179
+ if (world && world.reportFolder) {
180
+ dataFile = path.join(world.reportFolder, "data.json");
181
+ }
182
+ else if (web && web.reportFolder) {
183
+ dataFile = path.join(web.reportFolder, "data.json");
184
+ }
185
+ else if (context && context.reportFolder) {
186
+ dataFile = path.join(context.reportFolder, "data.json");
187
+ }
188
+ else if (fs.existsSync(path.join("data", "data.json"))) {
189
+ dataFile = path.join("data", "data.json");
190
+ }
191
+ else {
192
+ dataFile = "data.json";
193
+ }
194
+ return dataFile;
195
+ }
196
+ function _getTestData(world = null, context = null, web = null) {
197
+ const dataFile = _getDataFile(world, context, web);
198
+ let data = {};
199
+ if (fs.existsSync(dataFile)) {
200
+ data = JSON.parse(fs.readFileSync(dataFile, "utf8"));
201
+ }
202
+ return data;
203
+ }
204
+ async function replaceWithLocalTestData(value, world, _decrypt = true, totpWait = true, context = null, web = null, throwError = true) {
205
+ if (!value) {
206
+ return value;
207
+ }
208
+ let env = context?.environment?.name || "";
209
+ // used for unit tests
210
+ let testData = context?._data_ ? context._data_ : _getTestData(world, context, web);
211
+ const resolveDatePlaceholder = async (key) => {
212
+ const dateQuery = key.substring(5);
213
+ const parts = dateQuery.split(">>");
214
+ const returnTemplate = parts[1] || null;
215
+ const serviceUrl = _getServerUrl();
216
+ const config = {
217
+ method: "post",
218
+ url: `${serviceUrl}/api/runs/find-date/find`,
219
+ headers: {
220
+ "x-source": "true",
221
+ "Content-Type": "application/json",
222
+ Authorization: `Bearer ${process.env.TOKEN}`,
223
+ },
224
+ data: JSON.stringify({ value: parts[0] }),
225
+ };
226
+ const result = await axios.request(config);
227
+ if (result.status !== 200 || !result.data?.status || !result.data.result) {
228
+ console.error("Failed to find date");
229
+ throw new Error("Failed to find date");
230
+ }
231
+ return formatDate(result.data.result, returnTemplate);
232
+ };
233
+ const resolvePlaceholder = async (key) => {
234
+ if (key.startsWith("date:")) {
235
+ return await resolveDatePlaceholder(key);
236
+ }
237
+ let resolved = replaceTestDataValue(env, key, testData, _decrypt);
238
+ if (resolved !== null)
239
+ return resolved;
240
+ resolved = replaceTestDataValue("*", key, testData, _decrypt);
241
+ if (resolved !== null)
242
+ return resolved;
243
+ if (throwError) {
244
+ throw new Error(`Parameter "{{${key}}}" is undefined in the test data`);
245
+ }
246
+ else {
247
+ console.warn(`Parameter "{{${key}}}" is undefined in the test data`);
248
+ return null;
249
+ }
250
+ };
251
+ const recursiveReplace = async (input) => {
252
+ const regex = /{{([^{}]+)}}/g;
253
+ let result = input;
254
+ let match;
255
+ let anyChange = false;
256
+ while ((match = regex.exec(result)) !== null) {
257
+ const fullMatch = match[0];
258
+ const key = match[1].trim();
259
+ const replacement = await resolvePlaceholder(key);
260
+ if (replacement !== null) {
261
+ result = result.replace(fullMatch, replacement);
262
+ anyChange = true;
263
+ regex.lastIndex = 0; // reset index due to string mutation
264
+ }
265
+ }
266
+ // If replacements were made, repeat to resolve nested placeholders
267
+ return anyChange ? await recursiveReplace(result) : result;
268
+ };
269
+ value = await recursiveReplace(value);
270
+ // Only evaluate if value contains a JS expression
271
+ if ((value.startsWith("secret:") || value.startsWith("totp:") || value.startsWith("mask:")) && _decrypt) {
272
+ return decrypt(value, null, totpWait);
273
+ }
274
+ if (value.startsWith("${") && value.endsWith("}")) {
275
+ value = evaluateString(value, context?.examplesRow);
276
+ }
277
+ return value;
278
+ }
279
+ function replaceTestDataValue(env, key, testData, decryptValue = true) {
280
+ const path = key.split(".");
281
+ const value = objectPath.get(testData, path);
282
+ if (value && !Array.isArray(value)) {
283
+ return value;
284
+ }
285
+ const dataArray = testData[env];
286
+ if (!dataArray) {
287
+ return null;
288
+ }
289
+ for (const obj of dataArray) {
290
+ if (obj.key !== key) {
291
+ continue;
292
+ }
293
+ if (obj.DataType === "secret") {
294
+ if (decryptValue === true) {
295
+ return decrypt(`secret:${obj.value}`, null);
296
+ }
297
+ else {
298
+ return `secret:${obj.value}`;
299
+ }
300
+ }
301
+ if (obj.DataType === "totp") {
302
+ return `totp:${obj.value}`;
303
+ }
304
+ return obj.value;
305
+ }
306
+ return null;
307
+ }
308
+ function evaluateString(template, parameters) {
309
+ if (!parameters) {
310
+ parameters = {};
311
+ }
312
+ try {
313
+ return new Function(...Object.keys(parameters), `return \`${template}\`;`)(...Object.values(parameters));
314
+ }
315
+ catch (e) {
316
+ console.error(e);
317
+ return template;
318
+ }
319
+ }
320
+ function formatDate(dateStr, format) {
321
+ if (!format) {
322
+ return dateStr;
323
+ }
324
+ // Split the input date string
325
+ const [dd, mm, yyyy] = dateStr.split("-");
326
+ // Define replacements
327
+ const replacements = {
328
+ dd: dd,
329
+ mm: mm,
330
+ yyyy: yyyy,
331
+ };
332
+ // Replace format placeholders with actual values
333
+ return format.replace(/dd|mm|yyyy/g, (match) => replacements[match]);
334
+ }
335
+ function maskValue(value) {
336
+ if (!value) {
337
+ return value;
338
+ }
339
+ if (value.startsWith("secret:")) {
340
+ return "secret:****";
341
+ }
342
+ if (value.startsWith("totp:")) {
343
+ return "totp:****";
344
+ }
345
+ if (value.startsWith("mask:")) {
346
+ return "mask:****";
347
+ }
348
+ return value;
349
+ }
350
+ function _copyContext(from, to) {
351
+ to.browser = from.browser;
352
+ to.page = from.page;
353
+ to.context = from.context;
354
+ }
355
+ async function scrollPageToLoadLazyElements(page) {
356
+ let lastHeight = await page.evaluate(() => document.body.scrollHeight);
357
+ let retry = 0;
358
+ while (true) {
359
+ await page.evaluate(() => window.scrollBy(0, window.innerHeight));
360
+ await new Promise((resolve) => setTimeout(resolve, 1000));
361
+ let newHeight = await page.evaluate(() => document.body.scrollHeight);
362
+ if (newHeight === lastHeight) {
363
+ break;
364
+ }
365
+ lastHeight = newHeight;
366
+ retry++;
367
+ if (retry > 10) {
368
+ break;
369
+ }
370
+ }
371
+ await page.evaluate(() => window.scrollTo(0, 0));
372
+ }
373
+ function _fixUsingParams(text, _params) {
374
+ if (!_params || typeof text !== "string") {
375
+ return text;
376
+ }
377
+ for (let key in _params) {
378
+ let regValue = key;
379
+ if (key.startsWith("_")) {
380
+ // remove the _ prefix
381
+ regValue = key.substring(1);
382
+ }
383
+ text = text.replaceAll(new RegExp("{" + regValue + "}", "g"), _params[key]);
384
+ }
385
+ return text;
386
+ }
387
+ function getWebLogFile(logFolder) {
388
+ if (!fs.existsSync(logFolder)) {
389
+ fs.mkdirSync(logFolder, { recursive: true });
390
+ }
391
+ let nextIndex = 1;
392
+ while (fs.existsSync(path.join(logFolder, nextIndex.toString() + ".json"))) {
393
+ nextIndex++;
394
+ }
395
+ const fileName = nextIndex + ".json";
396
+ return path.join(logFolder, fileName);
397
+ }
398
+ function _fixLocatorUsingParams(locator, _params) {
399
+ // check if not null
400
+ if (!locator) {
401
+ return locator;
402
+ }
403
+ // clone the locator
404
+ locator = JSON.parse(JSON.stringify(locator));
405
+ scanAndManipulate(locator, _params);
406
+ return locator;
407
+ }
408
+ function _isObject(value) {
409
+ return value && typeof value === "object" && value.constructor === Object;
410
+ }
411
+ function scanAndManipulate(currentObj, _params) {
412
+ for (const key in currentObj) {
413
+ if (typeof currentObj[key] === "string") {
414
+ // Perform string manipulation
415
+ currentObj[key] = _fixUsingParams(currentObj[key], _params);
416
+ }
417
+ else if (_isObject(currentObj[key])) {
418
+ // Recursively scan nested objects
419
+ scanAndManipulate(currentObj[key], _params);
420
+ }
421
+ }
422
+ }
423
+ function extractStepExampleParameters(step) {
424
+ if (!step ||
425
+ !step.gherkinDocument ||
426
+ !step.pickle ||
427
+ !step.pickle.astNodeIds ||
428
+ !(step.pickle.astNodeIds.length > 1) ||
429
+ !step.gherkinDocument.feature ||
430
+ !step.gherkinDocument.feature.children) {
431
+ return {};
432
+ }
433
+ try {
434
+ const scenarioId = step.pickle.astNodeIds[0];
435
+ const exampleId = step.pickle.astNodeIds[1];
436
+ // find the scenario in the gherkin document
437
+ const scenario = step.gherkinDocument.feature.children.find((child) => child.scenario.id === scenarioId).scenario;
438
+ if (!scenario || !scenario.examples || !scenario.examples[0].tableBody) {
439
+ return {};
440
+ }
441
+ // find the table body in the examples
442
+ const row = scenario.examples[0].tableBody.find((r) => r.id === exampleId);
443
+ if (!row) {
444
+ return {};
445
+ }
446
+ // extract the cells values (row.cells.value) into an array
447
+ const values = row.cells.map((cell) => cell.value);
448
+ // extract the table headers keys (scenario.examples.tableHeader.cells.value) into an array
449
+ const keys = scenario.examples[0].tableHeader.cells.map((cell) => cell.value);
450
+ // create a dictionary of the keys and values
451
+ const params = {};
452
+ for (let i = 0; i < keys.length; i++) {
453
+ params[keys[i]] = values[i];
454
+ }
455
+ return params;
456
+ }
457
+ catch (e) {
458
+ console.error(e);
459
+ return {};
460
+ }
461
+ }
462
+ export async function performAction(action, element, options, web, state, _params) {
463
+ let usedOptions;
464
+ if (!options) {
465
+ options = {};
466
+ }
467
+ if (!element) {
468
+ throw new Error("Element not found");
469
+ }
470
+ switch (action) {
471
+ case "click":
472
+ // copy any of the following options to usedOptions: button, clickCount, delay, modifiers, force, position, trial
473
+ usedOptions = ["button", "clickCount", "delay", "modifiers", "force", "position", "trial", "timeout"].reduce((acc, key) => {
474
+ if (options[key]) {
475
+ acc[key] = options[key];
476
+ }
477
+ return acc;
478
+ }, {});
479
+ if (!usedOptions.timeout) {
480
+ usedOptions.timeout = 10000;
481
+ if (usedOptions.position) {
482
+ usedOptions.timeout = 1000;
483
+ }
484
+ }
485
+ try {
486
+ await element.click(usedOptions);
487
+ }
488
+ catch (e) {
489
+ if (usedOptions.position) {
490
+ // find the element bounding box
491
+ const rect = await element.boundingBox();
492
+ // calculate the x and y position
493
+ const x = rect.x + rect.width / 2 + (usedOptions.position.x || 0);
494
+ const y = rect.y + rect.height / 2 + (usedOptions.position.y || 0);
495
+ // click on the x and y position
496
+ await web.page.mouse.click(x, y);
497
+ }
498
+ else {
499
+ if (state && state.selectors) {
500
+ state.element = await web._locate(state.selectors, state.info, _params);
501
+ element = state.element;
502
+ }
503
+ await element.dispatchEvent("click");
504
+ }
505
+ }
506
+ break;
507
+ case "hover":
508
+ usedOptions = ["position", "trial", "timeout"].reduce((acc, key) => {
509
+ acc[key] = options[key];
510
+ return acc;
511
+ }, {});
512
+ try {
513
+ await element.hover(usedOptions);
514
+ await new Promise((resolve) => setTimeout(resolve, 1000));
515
+ }
516
+ catch (e) {
517
+ if (state && state.selectors) {
518
+ state.info.log += "hover failed, will try again" + "\n";
519
+ state.element = await web._locate(state.selectors, state.info, _params);
520
+ element = state.element;
521
+ }
522
+ usedOptions.timeout = 10000;
523
+ await element.hover(usedOptions);
524
+ await new Promise((resolve) => setTimeout(resolve, 1000));
525
+ }
526
+ break;
527
+ case "hover+click":
528
+ await performAction("hover", element, options, web, state, _params);
529
+ await performAction("click", element, options, web, state, _params);
530
+ break;
531
+ default:
532
+ throw new Error(`Action ${action} not supported`);
533
+ }
534
+ }
535
+ const KEYBOARD_EVENTS = [
536
+ "ALT",
537
+ "AltGraph",
538
+ "CapsLock",
539
+ "Control",
540
+ "Fn",
541
+ "FnLock",
542
+ "Hyper",
543
+ "Meta",
544
+ "NumLock",
545
+ "ScrollLock",
546
+ "Shift",
547
+ "Super",
548
+ "Symbol",
549
+ "SymbolLock",
550
+ "Enter",
551
+ "Tab",
552
+ "ArrowDown",
553
+ "ArrowLeft",
554
+ "ArrowRight",
555
+ "ArrowUp",
556
+ "End",
557
+ "Home",
558
+ "PageDown",
559
+ "PageUp",
560
+ "Backspace",
561
+ "Clear",
562
+ "Copy",
563
+ "CrSel",
564
+ "Cut",
565
+ "Delete",
566
+ "EraseEof",
567
+ "ExSel",
568
+ "Insert",
569
+ "Paste",
570
+ "Redo",
571
+ "Undo",
572
+ "Accept",
573
+ "Again",
574
+ "Attn",
575
+ "Cancel",
576
+ "ContextMenu",
577
+ "Escape",
578
+ "Execute",
579
+ "Find",
580
+ "Finish",
581
+ "Help",
582
+ "Pause",
583
+ "Play",
584
+ "Props",
585
+ "Select",
586
+ "ZoomIn",
587
+ "ZoomOut",
588
+ "BrightnessDown",
589
+ "BrightnessUp",
590
+ "Eject",
591
+ "LogOff",
592
+ "Power",
593
+ "PowerOff",
594
+ "PrintScreen",
595
+ "Hibernate",
596
+ "Standby",
597
+ "WakeUp",
598
+ "AllCandidates",
599
+ "Alphanumeric",
600
+ "CodeInput",
601
+ "Compose",
602
+ "Convert",
603
+ "Dead",
604
+ "FinalMode",
605
+ "GroupFirst",
606
+ "GroupLast",
607
+ "GroupNext",
608
+ "GroupPrevious",
609
+ "ModeChange",
610
+ "NextCandidate",
611
+ "NonConvert",
612
+ "PreviousCandidate",
613
+ "Process",
614
+ "SingleCandidate",
615
+ "HangulMode",
616
+ "HanjaMode",
617
+ "JunjaMode",
618
+ "Eisu",
619
+ "Hankaku",
620
+ "Hiragana",
621
+ "HiraganaKatakana",
622
+ "KanaMode",
623
+ "KanjiMode",
624
+ "Katakana",
625
+ "Romaji",
626
+ "Zenkaku",
627
+ "ZenkakuHanaku",
628
+ "F1",
629
+ "F2",
630
+ "F3",
631
+ "F4",
632
+ "F5",
633
+ "F6",
634
+ "F7",
635
+ "F8",
636
+ "F9",
637
+ "F10",
638
+ "F11",
639
+ "F12",
640
+ "Soft1",
641
+ "Soft2",
642
+ "Soft3",
643
+ "Soft4",
644
+ "ChannelDown",
645
+ "ChannelUp",
646
+ "Close",
647
+ "MailForward",
648
+ "MailReply",
649
+ "MailSend",
650
+ "MediaFastForward",
651
+ "MediaPause",
652
+ "MediaPlay",
653
+ "MediaPlayPause",
654
+ "MediaRecord",
655
+ "MediaRewind",
656
+ "MediaStop",
657
+ "MediaTrackNext",
658
+ "MediaTrackPrevious",
659
+ "AudioBalanceLeft",
660
+ "AudioBalanceRight",
661
+ "AudioBassBoostDown",
662
+ "AudioBassBoostToggle",
663
+ "AudioBassBoostUp",
664
+ "AudioFaderFront",
665
+ "AudioFaderRear",
666
+ "AudioSurroundModeNext",
667
+ "AudioTrebleDown",
668
+ "AudioTrebleUp",
669
+ "AudioVolumeDown",
670
+ "AudioVolumeMute",
671
+ "AudioVolumeUp",
672
+ "MicrophoneToggle",
673
+ "MicrophoneVolumeDown",
674
+ "MicrophoneVolumeMute",
675
+ "MicrophoneVolumeUp",
676
+ "TV",
677
+ "TV3DMode",
678
+ "TVAntennaCable",
679
+ "TVAudioDescription",
680
+ ];
681
+ function unEscapeString(str) {
682
+ const placeholder = "\\n";
683
+ str = str.replace(new RegExp(placeholder, "g"), "\n");
684
+ return str;
685
+ }
686
+ function _getServerUrl() {
687
+ let serviceUrl = "https://api.blinq.io";
688
+ if (process.env.NODE_ENV_BLINQ === "dev") {
689
+ serviceUrl = "https://dev.api.blinq.io";
690
+ }
691
+ else if (process.env.NODE_ENV_BLINQ === "stage") {
692
+ serviceUrl = "https://stage.api.blinq.io";
693
+ }
694
+ else if (process.env.NODE_ENV_BLINQ === "prod") {
695
+ serviceUrl = "https://api.blinq.io";
696
+ }
697
+ else if (!process.env.NODE_ENV_BLINQ) {
698
+ serviceUrl = "https://api.blinq.io";
699
+ }
700
+ else {
701
+ serviceUrl = process.env.NODE_ENV_BLINQ;
702
+ }
703
+ return serviceUrl;
704
+ }
705
+ function tryParseJson(input) {
706
+ if (typeof input === "string") {
707
+ try {
708
+ return JSON.parse(input);
709
+ }
710
+ catch {
711
+ // If parsing fails, return the original input (assumed to be plain text or another format)
712
+ return input;
713
+ }
714
+ }
715
+ return input;
716
+ }
717
+ export { encrypt, decrypt, replaceWithLocalTestData, maskValue, _copyContext, scrollPageToLoadLazyElements, _fixUsingParams, getWebLogFile, _fixLocatorUsingParams, _isObject, scanAndManipulate, KEYBOARD_EVENTS, unEscapeString, _getServerUrl, _convertToRegexQuery, extractStepExampleParameters, _getDataFile, tryParseJson, getTestDataValue, };
51
718
  //# sourceMappingURL=utils.js.map