@mablhq/mabl-cli 1.25.15 → 1.26.5

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 (54) hide show
  1. package/Globals.js +20 -0
  2. package/api/basicApiClient.js +1 -0
  3. package/api/featureSet.js +2 -2
  4. package/api/mablApiClient.js +9 -2
  5. package/api/mablApiClientFactory.js +5 -4
  6. package/browserLauncher/browserLauncherFactory.js +3 -3
  7. package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +2 -2
  8. package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +18 -0
  9. package/browserLauncher/types.js +5 -1
  10. package/commands/config/config_cmds/configKeys.js +7 -1
  11. package/commands/config/config_cmds/set.js +6 -0
  12. package/commands/tests/testsUtil.js +43 -58
  13. package/domUtil/index.js +1 -2
  14. package/execution/index.js +1 -1
  15. package/index.d.ts +2 -0
  16. package/mablApi/index.js +1 -1
  17. package/mablscript/MablAction.js +31 -1
  18. package/mablscript/actions/ConditionAction.js +4 -0
  19. package/mablscript/actions/FindAction.js +3 -0
  20. package/mablscript/actions/GenerateRandomStringAction.js +3 -0
  21. package/mablscript/actions/GetVariableValue.js +3 -0
  22. package/mablscript/actions/JavaScriptAction.js +7 -0
  23. package/mablscript/importer.js +10 -3
  24. package/mablscript/steps/AssertStep.js +10 -0
  25. package/mablscript/steps/ClickAndHoldStep.js +3 -0
  26. package/mablscript/steps/ClickStep.js +3 -0
  27. package/mablscript/steps/CreateVariableStep.js +6 -0
  28. package/mablscript/steps/DoubleClickStep.js +3 -0
  29. package/mablscript/steps/DownloadStep.js +4 -0
  30. package/mablscript/steps/EchoStep.js +3 -0
  31. package/mablscript/steps/EnterTextStep.js +6 -0
  32. package/mablscript/steps/EvaluateJavaScriptStep.js +3 -0
  33. package/mablscript/steps/HoverStep.js +3 -0
  34. package/mablscript/steps/IfConditionStep.js +9 -0
  35. package/mablscript/steps/OpenEmailStep.js +3 -0
  36. package/mablscript/steps/ReleaseStep.js +3 -0
  37. package/mablscript/steps/RemoveCookieStep.js +4 -0
  38. package/mablscript/steps/SelectStep.js +7 -0
  39. package/mablscript/steps/SendHttpRequestStep.js +8 -0
  40. package/mablscript/steps/SendKeyStep.js +3 -0
  41. package/mablscript/steps/SetCookieStep.js +7 -0
  42. package/mablscript/steps/SetFilesStep.js +3 -0
  43. package/mablscript/steps/SwitchContextStep.js +4 -0
  44. package/mablscript/steps/VisitUrlStep.js +4 -0
  45. package/mablscript/steps/WaitUntilStep.js +3 -0
  46. package/mablscriptFind/index.js +1 -1
  47. package/package.json +5 -4
  48. package/providers/cliConfigProvider.js +6 -0
  49. package/resources/mablFind.js +1 -1
  50. package/util/asyncUtil.js +7 -6
  51. package/util/httpUtil.js +32 -12
  52. package/browserLauncher/runnerType.js +0 -7
  53. package/domUtil/index.js.LICENSE.txt +0 -14
  54. package/mablscript/AttributesConstants.js +0 -115
package/util/asyncUtil.js CHANGED
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.filterAsync = exports.mapAsync = exports.TimeoutError = exports.promiseWithTimeout = void 0;
4
4
  const loggingProvider_1 = require("../providers/logging/loggingProvider");
5
- async function promiseWithTimeout(promise, timeoutMillis, description) {
5
+ async function promiseWithTimeout(promise, timeoutMillis, description, timeoutType = 'mabl promise timeout') {
6
6
  const startTimeMillis = new Date().getTime();
7
- const { timer, cancelTimer } = startTimer(timeoutMillis, description);
7
+ const { timer, cancelTimer } = startTimer(timeoutMillis, description, timeoutType);
8
8
  try {
9
9
  const result = await Promise.race([timer, promise]);
10
10
  if (loggingProvider_1.logger.isDebugEnabled()) {
@@ -24,18 +24,19 @@ async function promiseWithTimeout(promise, timeoutMillis, description) {
24
24
  }
25
25
  exports.promiseWithTimeout = promiseWithTimeout;
26
26
  class TimeoutError extends Error {
27
- constructor(timeoutMillis, description) {
28
- super(`[mabl promise timeout] "${description}" timed out after ${timeoutMillis}ms`);
27
+ constructor(timeoutMillis, description, timeoutType) {
28
+ super(`[${timeoutType}] "${description}" timed out after ${timeoutMillis}ms`);
29
29
  this.timeoutMillis = timeoutMillis;
30
30
  this.description = description;
31
+ this.timeoutType = timeoutType;
31
32
  Object.setPrototypeOf(this, TimeoutError.prototype);
32
33
  }
33
34
  }
34
35
  exports.TimeoutError = TimeoutError;
35
- const startTimer = (timeoutMillis, description) => {
36
+ const startTimer = (timeoutMillis, description, timeoutType) => {
36
37
  let timeout;
37
38
  const promise = new Promise((_resolve, reject) => {
38
- timeout = global.setTimeout(() => reject(new TimeoutError(timeoutMillis, description)), timeoutMillis);
39
+ timeout = global.setTimeout(() => reject(new TimeoutError(timeoutMillis, description, timeoutType)), timeoutMillis);
39
40
  timeout.unref();
40
41
  });
41
42
  return {
package/util/httpUtil.js CHANGED
@@ -28,6 +28,7 @@ const cliConfigProvider_1 = require("../providers/cliConfigProvider");
28
28
  const https = __importStar(require("https"));
29
29
  const pureUtil_1 = require("./pureUtil");
30
30
  const https_proxy_agent_1 = require("https-proxy-agent");
31
+ const hpagent_1 = require("hpagent");
31
32
  exports.USER_AGENT = `${(0, pureUtil_1.getCliName)()}@${(0, pureUtil_1.getCliVersion)()}`;
32
33
  exports.USER_AGENT_HEADER = 'User-Agent';
33
34
  exports.EXECUTION_ENGINE_SSL_VERIFY = false;
@@ -51,7 +52,7 @@ function axiosProxyConfig(httpConfig) {
51
52
  if ((_a = httpConfig.proxyHost) === null || _a === void 0 ? void 0 : _a.href) {
52
53
  config.proxy = proxyUrlToPortConfig(httpConfig.proxyHost);
53
54
  }
54
- return maybeGetModifiedAxiosConfigForHttpProxy(config, httpConfig.sslVerify);
55
+ return maybeGetModifiedAxiosConfigForHttpProxy(config, httpConfig.sslVerify, httpConfig.proxyType);
55
56
  }
56
57
  exports.axiosProxyConfig = axiosProxyConfig;
57
58
  function escapeRegexDots(input) {
@@ -80,7 +81,7 @@ function proxyUrlToPortConfig(proxyUrl) {
80
81
  return config;
81
82
  }
82
83
  exports.proxyUrlToPortConfig = proxyUrlToPortConfig;
83
- function maybeGetModifiedAxiosConfigForHttpProxy(config, sslVerify) {
84
+ function maybeGetModifiedAxiosConfigForHttpProxy(config, sslVerify, proxyType) {
84
85
  var _a, _b;
85
86
  if (config.proxy &&
86
87
  (((_a = config.proxy) === null || _a === void 0 ? void 0 : _a.protocol) === 'http:' || ((_b = config.proxy) === null || _b === void 0 ? void 0 : _b.protocol) === 'http')) {
@@ -89,16 +90,35 @@ function maybeGetModifiedAxiosConfigForHttpProxy(config, sslVerify) {
89
90
  };
90
91
  newConfig.proxy = false;
91
92
  const authConfig = config.proxy.auth;
92
- const configOptions = {
93
- host: config.proxy.host,
94
- port: config.proxy.port,
95
- auth: authConfig
96
- ? `${authConfig.username}:${authConfig.password}`
97
- : undefined,
98
- rejectUnauthorized: sslVerify !== false,
99
- };
100
- newConfig.httpsAgent = new https_proxy_agent_1.HttpsProxyAgent(configOptions);
101
- newConfig.httpAgent = new https_proxy_agent_1.HttpsProxyAgent(configOptions);
93
+ if (proxyType === 'current') {
94
+ let proxyString = 'http://';
95
+ if (authConfig !== undefined) {
96
+ proxyString += `${authConfig.username}:${authConfig.password}@`;
97
+ }
98
+ proxyString += `${config.proxy.host}:${config.proxy.port}`;
99
+ const agentConfig = {
100
+ keepAlive: true,
101
+ keepAliveMsecs: 1000,
102
+ maxSockets: 256,
103
+ maxFreeSockets: 256,
104
+ proxy: proxyString,
105
+ rejectUnauthorized: sslVerify !== false,
106
+ };
107
+ newConfig.httpsAgent = new hpagent_1.HttpsProxyAgent(agentConfig);
108
+ newConfig.httpAgent = new hpagent_1.HttpsProxyAgent(agentConfig);
109
+ }
110
+ else {
111
+ const configOptions = {
112
+ host: config.proxy.host,
113
+ port: config.proxy.port,
114
+ auth: authConfig
115
+ ? `${authConfig.username}:${authConfig.password}`
116
+ : undefined,
117
+ rejectUnauthorized: sslVerify !== false,
118
+ };
119
+ newConfig.httpsAgent = new https_proxy_agent_1.HttpsProxyAgent(configOptions);
120
+ newConfig.httpAgent = new https_proxy_agent_1.HttpsProxyAgent(configOptions);
121
+ }
102
122
  return newConfig;
103
123
  }
104
124
  return config;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RunnerType = void 0;
4
- var RunnerType;
5
- (function (RunnerType) {
6
- RunnerType["Playwright"] = "playwright";
7
- })(RunnerType = exports.RunnerType || (exports.RunnerType = {}));
@@ -1,14 +0,0 @@
1
- /**
2
- * @license Complex.js v2.1.1 12/05/2020
3
- *
4
- * Copyright (c) 2020, Robert Eisele (robert@xarg.org)
5
- * Dual licensed under the MIT or GPL Version 2 licenses.
6
- **/
7
-
8
- /**
9
- * @license Fraction.js v4.2.0 05/03/2022
10
- * https://www.xarg.org/2014/03/rational-numbers-in-javascript/
11
- *
12
- * Copyright (c) 2021, Robert Eisele (robert@xarg.org)
13
- * Dual licensed under the MIT or GPL Version 2 licenses.
14
- **/
@@ -1,115 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ALLOWED_ASSERTABLE_EMAIL_ATTRS_PROPS = exports.isAllowedAssertableUrlAttrProps = exports.ALLOWED_ASSERTABLE_URL_ATTRS_PROPS = exports.ALLOWED_ASSERTABLE_COOKIES_ATTRS_PROPS = exports.ALLOWED_ASSERTABLE_ATTRS_PROPS = void 0;
4
- exports.ALLOWED_ASSERTABLE_ATTRS_PROPS = [
5
- 'accessKey',
6
- 'accessKeyLabel',
7
- 'align',
8
- 'alt',
9
- 'aria-checked',
10
- 'aria-label',
11
- 'aria-labelledby',
12
- 'aria-disabled',
13
- 'autofocus',
14
- 'border',
15
- 'checked',
16
- 'class',
17
- 'className',
18
- 'clientHeight',
19
- 'clientLeft',
20
- 'clientTop',
21
- 'clientWidth',
22
- 'complete',
23
- 'computedName',
24
- 'computedRole',
25
- 'contentEditable',
26
- 'contextMenu',
27
- 'crossOrigin',
28
- 'currentSrc',
29
- 'dataset',
30
- 'defaultChecked',
31
- 'defaultValue',
32
- 'dir',
33
- 'disabled',
34
- 'draggable',
35
- 'formEncType',
36
- 'formMethod',
37
- 'formNoValidate',
38
- 'formTarget',
39
- 'height',
40
- 'hidden',
41
- 'href',
42
- 'hspace',
43
- 'id',
44
- 'indeterminate',
45
- 'inert',
46
- 'innerText',
47
- 'isContentEditable',
48
- 'isMap',
49
- 'itemId',
50
- 'itemScope',
51
- 'lang',
52
- 'length',
53
- 'localName',
54
- 'longDesc',
55
- 'lowSrc',
56
- 'maxLength',
57
- 'multiple',
58
- 'name',
59
- 'namespaceURI',
60
- 'naturalHeight',
61
- 'naturalWidth',
62
- 'noModule',
63
- 'offsetHeight',
64
- 'offsetLeft',
65
- 'offsetTop',
66
- 'offsetWidth',
67
- 'prefix',
68
- 'referrerPolicy',
69
- 'required',
70
- 'selectedIndex',
71
- 'size',
72
- 'sizes',
73
- 'slot',
74
- 'src',
75
- 'srcset',
76
- 'tabIndex',
77
- 'tagName',
78
- 'title',
79
- 'translate',
80
- 'type',
81
- 'validationMessage',
82
- 'validity',
83
- 'value',
84
- 'vspace',
85
- 'width',
86
- 'willValidate',
87
- ];
88
- exports.ALLOWED_ASSERTABLE_COOKIES_ATTRS_PROPS = [
89
- 'domain',
90
- 'http_only',
91
- 'name',
92
- 'path',
93
- 'expires',
94
- 'secure',
95
- 'value',
96
- ];
97
- exports.ALLOWED_ASSERTABLE_URL_ATTRS_PROPS = [
98
- 'hash',
99
- 'host',
100
- 'hostname',
101
- 'href',
102
- 'password',
103
- 'pathname',
104
- 'port',
105
- 'protocol',
106
- 'search',
107
- 'username',
108
- ];
109
- const ALLOWED_ASSERTABLE_URL_ATTRS_PROPS_SET = new Set(exports.ALLOWED_ASSERTABLE_URL_ATTRS_PROPS);
110
- const isAllowedAssertableUrlAttrProps = (x) => ALLOWED_ASSERTABLE_URL_ATTRS_PROPS_SET.has(x);
111
- exports.isAllowedAssertableUrlAttrProps = isAllowedAssertableUrlAttrProps;
112
- exports.ALLOWED_ASSERTABLE_EMAIL_ATTRS_PROPS = [
113
- 'from',
114
- 'subject',
115
- ];