@mablhq/mabl-cli 1.58.25 → 1.58.28

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 (102) hide show
  1. package/api/basicApiClient.js +15 -21
  2. package/api/mablApiClient.js +48 -40
  3. package/api/mablApiClientFactory.js +1 -1
  4. package/auth/OktaClient.js +2 -1
  5. package/browserEngines/chromiumBrowserEngine.js +2 -1
  6. package/browserEngines/firefoxBrowserEngine.js +2 -2
  7. package/browserEngines/webkitBrowerEngine.js +2 -2
  8. package/browserLauncher/browserLauncherFactory.js +3 -2
  9. package/browserLauncher/elementHandle.js +2 -1
  10. package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumElementHandleDelegate.js +20 -12
  11. package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumFrameDelegate.js +1 -1
  12. package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumPageDelegate.js +10 -7
  13. package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxFrameDelegate.js +4 -3
  14. package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractElementHandleDelegate.js +5 -4
  15. package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractPageDelegate.js +7 -4
  16. package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +1 -1
  17. package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +7 -6
  18. package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +37 -31
  19. package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +9 -8
  20. package/browserLauncher/playwrightBrowserLauncher/playwrightHttpRequest.js +8 -4
  21. package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +5 -3
  22. package/browserLauncher/playwrightBrowserLauncher/webkit/webkitElementHandleDelegate.js +2 -1
  23. package/browserLauncher/playwrightBrowserLauncher/webkit/webkitFrameDelegate.js +1 -1
  24. package/browserTestMonitoring/metricsRecorder.js +6 -6
  25. package/commands/commandUtil/branches.js +3 -2
  26. package/commands/commandUtil/codeInsights.js +16 -13
  27. package/commands/commandUtil/fileUtil.js +1 -1
  28. package/commands/commandUtil/util.js +5 -3
  29. package/commands/commandUtil/versionUtil.js +5 -4
  30. package/commands/config/config_cmds/list.js +2 -2
  31. package/commands/datatables/datatables_cmds/create.js +3 -2
  32. package/commands/datatables/datatables_cmds/export.js +5 -3
  33. package/commands/datatables/datatables_cmds/list.js +2 -1
  34. package/commands/datatables/datatables_cmds/scenarios.js +2 -1
  35. package/commands/datatables/datatables_cmds/update.js +11 -11
  36. package/commands/datatables/utils.js +9 -9
  37. package/commands/deploy/deploy_cmds/awaitDeploymentCompletion.js +8 -6
  38. package/commands/deploy/deploy_cmds/create.js +13 -11
  39. package/commands/deploy/deploy_cmds/executionResultPresenter.js +11 -8
  40. package/commands/deploy/deploy_cmds/list.js +4 -3
  41. package/commands/deploy/deploy_cmds/watch.js +2 -1
  42. package/commands/environments/environments_cmds/create.js +2 -1
  43. package/commands/environments/environments_cmds/delete.js +2 -1
  44. package/commands/environments/environments_cmds/update.js +2 -1
  45. package/commands/environments/environments_cmds/urls_cmds/list.js +2 -1
  46. package/commands/flows/flows_cmds/export.js +2 -1
  47. package/commands/plans/plans_cmds/describe.js +2 -1
  48. package/commands/tests/mobileEmulationUtil.js +7 -5
  49. package/commands/tests/testsUtil.js +42 -40
  50. package/commands/tests/tests_cmds/export.js +2 -1
  51. package/commands/tests/tests_cmds/import.js +5 -4
  52. package/commands/tests/tests_cmds/run-cloud.js +13 -12
  53. package/commands/tests/tests_cmds/run.js +11 -9
  54. package/commands/users/users_cmds/list.js +2 -2
  55. package/commands/workspaces/workspace_cmds/copy.js +2 -1
  56. package/core/execution/ApiTestUtils.js +94 -82
  57. package/core/messaging/logLineMessaging.js +3 -2
  58. package/core/messaging/messaging.js +7 -6
  59. package/core/trainer/trainingSessions.js +15 -15
  60. package/coreWebVitals/index.js +18 -14
  61. package/execution/index.js +1 -1
  62. package/functions/apiTest/utils.js +5 -4
  63. package/http/MablHttpAgent.js +6 -4
  64. package/http/RequestSecurityError.js +1 -1
  65. package/http/axiosProxyConfig.js +5 -3
  66. package/http/httpUtil.js +3 -2
  67. package/http/requestInterceptor.js +15 -11
  68. package/mablscript/MablAction.js +3 -2
  69. package/mablscript/MablStep.js +4 -2
  70. package/mablscript/MablSymbol.js +1 -1
  71. package/mablscript/actions/ConditionAction.js +4 -2
  72. package/mablscript/actions/FindAction.js +4 -2
  73. package/mablscript/diffing/diffingUtil.js +7 -8
  74. package/mablscript/importer.js +2 -1
  75. package/mablscript/steps/AccessibilityCheck.js +9 -7
  76. package/mablscript/steps/AssertStep.js +16 -11
  77. package/mablscript/steps/ClickAndHoldStep.js +2 -1
  78. package/mablscript/steps/CreateVariableStep.js +2 -1
  79. package/mablscript/steps/DownloadStep.js +2 -1
  80. package/mablscript/steps/EnterTextStep.js +2 -1
  81. package/mablscript/steps/EvaluateFlowStep.js +1 -1
  82. package/mablscript/steps/IfConditionStep.js +6 -4
  83. package/mablscript/steps/ReleaseStep.js +2 -1
  84. package/mablscript/steps/SendHttpRequestStep.js +4 -2
  85. package/mablscript/steps/SendKeyStep.js +1 -1
  86. package/mablscript/steps/SetCookieStep.js +8 -7
  87. package/mablscript/steps/SetViewportStep.js +1 -1
  88. package/mablscript/steps/SwitchContextStep.js +6 -3
  89. package/mablscript/steps/SyntheticStep.js +2 -1
  90. package/middleware.js +2 -1
  91. package/package.json +1 -1
  92. package/popupDismissal/index.js +5 -4
  93. package/providers/authenticationProvider.js +6 -5
  94. package/providers/cliConfigProvider.js +12 -10
  95. package/providers/exportRequestProvider.js +5 -3
  96. package/providers/logging/loggingProvider.js +1 -1
  97. package/reporters/mochAwesome/mochAwesomeReporter.js +14 -12
  98. package/util/TestOutputWriter.js +12 -8
  99. package/util/actionabilityUtil.js +1 -1
  100. package/util/analytics.js +9 -6
  101. package/util/browserTestUtils.js +2 -1
  102. package/util/markdownUtil.js +11 -9
@@ -17,26 +17,27 @@ function createFileUploadDirectory(testContext) {
17
17
  }
18
18
  exports.createFileUploadDirectory = createFileUploadDirectory;
19
19
  function validateApiTestMessage(request, response) {
20
+ var _a, _b, _c;
20
21
  const authorizationHeader = request.get('authorization');
21
22
  if (authorizationHeader === undefined) {
22
23
  (0, utils_1.handleExecutionFailure)(response, 'Illegal authorization');
23
24
  return false;
24
25
  }
25
26
  const contentType = request.get('content-type');
26
- if (contentType?.toLowerCase() !== 'application/json') {
27
+ if ((contentType === null || contentType === void 0 ? void 0 : contentType.toLowerCase()) !== 'application/json') {
27
28
  (0, utils_1.handleExecutionFailure)(response, 'Illegal content type. Must be application/json');
28
29
  return false;
29
30
  }
30
31
  const pubsubMessage = request.body;
31
- if (typeof pubsubMessage?.message?.data !== 'string') {
32
+ if (typeof ((_a = pubsubMessage === null || pubsubMessage === void 0 ? void 0 : pubsubMessage.message) === null || _a === void 0 ? void 0 : _a.data) !== 'string') {
32
33
  (0, utils_1.handleExecutionFailure)(response, 'Illegal message data format');
33
34
  return false;
34
35
  }
35
- if (typeof pubsubMessage?.subscription !== 'string') {
36
+ if (typeof (pubsubMessage === null || pubsubMessage === void 0 ? void 0 : pubsubMessage.subscription) !== 'string') {
36
37
  (0, utils_1.handleExecutionFailure)(response, 'Illegal message subscription format');
37
38
  return false;
38
39
  }
39
- if (pubsubMessage?.message?.attributes?.test_type !==
40
+ if (((_c = (_b = pubsubMessage === null || pubsubMessage === void 0 ? void 0 : pubsubMessage.message) === null || _b === void 0 ? void 0 : _b.attributes) === null || _c === void 0 ? void 0 : _c.test_type) !==
40
41
  mablApi_1.TestTypeEnum.Api.toString()) {
41
42
  (0, utils_1.handleExecutionFailure)(response, 'Illegal test type');
42
43
  return false;
@@ -48,14 +48,16 @@ class MablHttpAgent extends agent_base_1.Agent {
48
48
  return new MablHttpAgent(constructorParameters.httpAgent, constructorParameters.httpsAgent);
49
49
  }
50
50
  static async getConstructorParameters(httpAgent, httpsAgent) {
51
+ var _a, _b;
51
52
  const proxyConfig = await (0, axiosProxyConfig_1.currentProxyConfig)('test');
52
53
  return {
53
- httpAgent: httpAgent ?? proxyConfig.httpAgent ?? http_1.default.globalAgent,
54
- httpsAgent: httpsAgent ?? proxyConfig.httpsAgent ?? https.globalAgent,
54
+ httpAgent: (_a = httpAgent !== null && httpAgent !== void 0 ? httpAgent : proxyConfig.httpAgent) !== null && _a !== void 0 ? _a : http_1.default.globalAgent,
55
+ httpsAgent: (_b = httpsAgent !== null && httpsAgent !== void 0 ? httpsAgent : proxyConfig.httpsAgent) !== null && _b !== void 0 ? _b : https.globalAgent,
55
56
  };
56
57
  }
57
58
  callback(req, opts) {
58
- if (this.maybeGetFirstStringHeader(req, httpUtil_1.USER_AGENT_HEADER)?.startsWith('PostmanRuntime/')) {
59
+ var _a;
60
+ if ((_a = this.maybeGetFirstStringHeader(req, httpUtil_1.USER_AGENT_HEADER)) === null || _a === void 0 ? void 0 : _a.startsWith('PostmanRuntime/')) {
59
61
  req.setHeader(httpUtil_1.USER_AGENT_HEADER, httpUtil_1.USER_AGENT);
60
62
  }
61
63
  return Promise.resolve(opts.secureEndpoint ? this.httpsAgent : this.httpAgent);
@@ -65,7 +67,7 @@ class MablHttpAgent extends agent_base_1.Agent {
65
67
  if (Array.isArray(value)) {
66
68
  return value[0].toString();
67
69
  }
68
- return value?.toString();
70
+ return value === null || value === void 0 ? void 0 : value.toString();
69
71
  }
70
72
  }
71
73
  exports.MablHttpAgent = MablHttpAgent;
@@ -7,7 +7,7 @@ class RequestSecurityError extends Error {
7
7
  this.isRequestSecurityError = true;
8
8
  }
9
9
  static isInstance(error) {
10
- return error?.isRequestSecurityError || false;
10
+ return (error === null || error === void 0 ? void 0 : error.isRequestSecurityError) || false;
11
11
  }
12
12
  }
13
13
  exports.RequestSecurityError = RequestSecurityError;
@@ -31,10 +31,11 @@ const hpagent_1 = require("hpagent");
31
31
  const httpUtil_1 = require("./httpUtil");
32
32
  async function currentProxyConfig(mode = 'mabl') {
33
33
  const httpConfig = (await cliConfigProvider_1.CliConfigProvider.getCliConfig()).http;
34
- return axiosProxyConfig(mode === 'test' ? httpConfig?.test : httpConfig?.mabl);
34
+ return axiosProxyConfig(mode === 'test' ? httpConfig === null || httpConfig === void 0 ? void 0 : httpConfig.test : httpConfig === null || httpConfig === void 0 ? void 0 : httpConfig.mabl);
35
35
  }
36
36
  exports.currentProxyConfig = currentProxyConfig;
37
37
  function axiosProxyConfig(httpConfig) {
38
+ var _a;
38
39
  const config = {
39
40
  headers: {
40
41
  [httpUtil_1.USER_AGENT_HEADER]: httpUtil_1.USER_AGENT,
@@ -45,7 +46,7 @@ function axiosProxyConfig(httpConfig) {
45
46
  rejectUnauthorized: false,
46
47
  });
47
48
  }
48
- if (httpConfig.proxyHost?.href) {
49
+ if ((_a = httpConfig.proxyHost) === null || _a === void 0 ? void 0 : _a.href) {
49
50
  config.proxy = proxyUrlToPortConfig(httpConfig.proxyHost);
50
51
  }
51
52
  return maybeGetModifiedAxiosConfigForHttpProxy(config, httpConfig.sslVerify, httpConfig.proxyType);
@@ -78,8 +79,9 @@ function proxyUrlToPortConfig(proxyUrl) {
78
79
  }
79
80
  exports.proxyUrlToPortConfig = proxyUrlToPortConfig;
80
81
  function maybeGetModifiedAxiosConfigForHttpProxy(config, sslVerify, proxyType) {
82
+ var _a, _b;
81
83
  if (config.proxy &&
82
- (config.proxy?.protocol === 'http:' || config.proxy?.protocol === 'http')) {
84
+ (((_a = config.proxy) === null || _a === void 0 ? void 0 : _a.protocol) === 'http:' || ((_b = config.proxy) === null || _b === void 0 ? void 0 : _b.protocol) === 'http')) {
83
85
  const newConfig = {
84
86
  ...config,
85
87
  };
package/http/httpUtil.js CHANGED
@@ -39,13 +39,14 @@ function maybeGetSocksAgent(linkServer) {
39
39
  return new socks_proxy_agent_1.SocksProxyAgent(agentOptions);
40
40
  }
41
41
  function postProcessHeaders(response) {
42
+ var _a, _b, _c;
42
43
  const parsed = {};
43
- const rawHeaders = response.request?.res?.rawHeaders;
44
+ const rawHeaders = (_b = (_a = response.request) === null || _a === void 0 ? void 0 : _a.res) === null || _b === void 0 ? void 0 : _b.rawHeaders;
44
45
  if (rawHeaders) {
45
46
  for (let i = 0; i + 1 < rawHeaders.length; i += 2) {
46
47
  const headerName = rawHeaders[i].toLowerCase();
47
48
  const headerValue = rawHeaders[i + 1];
48
- parsed[headerName] = (parsed[headerName] ?? []).concat(headerValue);
49
+ parsed[headerName] = ((_c = parsed[headerName]) !== null && _c !== void 0 ? _c : []).concat(headerValue);
49
50
  }
50
51
  }
51
52
  return parsed;
@@ -22,9 +22,10 @@ function headerStringToHeaders(rawHeader) {
22
22
  .filter((value) => HEADER_EXTRACT_REGEXP.test(value))
23
23
  .map((value) => value.match(HEADER_EXTRACT_REGEXP).groups)
24
24
  .forEach(({ rawKey, value }) => {
25
+ var _a;
25
26
  const normalizedHeader = rawKey.toLowerCase().trim();
26
- const values = headers[normalizedHeader] ?? [];
27
- if (value?.trim()) {
27
+ const values = (_a = headers[normalizedHeader]) !== null && _a !== void 0 ? _a : [];
28
+ if (value === null || value === void 0 ? void 0 : value.trim()) {
28
29
  values.push(value.trim());
29
30
  }
30
31
  headers[normalizedHeader] = values;
@@ -33,11 +34,12 @@ function headerStringToHeaders(rawHeader) {
33
34
  }
34
35
  exports.headerStringToHeaders = headerStringToHeaders;
35
36
  function headerStringToProtocol(rawHeader) {
37
+ var _a, _b, _c;
36
38
  if (!rawHeader) {
37
39
  return;
38
40
  }
39
- const firstRowTrimmed = rawHeader.split(/\r?\n/, 2)?.[0]?.trim();
40
- return firstRowTrimmed?.match(/\s(\S+)$/)?.[1];
41
+ const firstRowTrimmed = (_b = (_a = rawHeader.split(/\r?\n/, 2)) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.trim();
42
+ return (_c = firstRowTrimmed === null || firstRowTrimmed === void 0 ? void 0 : firstRowTrimmed.match(/\s(\S+)$/)) === null || _c === void 0 ? void 0 : _c[1];
41
43
  }
42
44
  exports.headerStringToProtocol = headerStringToProtocol;
43
45
  function headerRecordToHeaderMultiMap(input) {
@@ -48,7 +50,7 @@ function headerRecordToHeaderMultiMap(input) {
48
50
  return result;
49
51
  }
50
52
  function handleRawResponseBody(body) {
51
- body = body ?? '';
53
+ body = body !== null && body !== void 0 ? body : '';
52
54
  switch (typeof body) {
53
55
  case 'number':
54
56
  return { body: body.toString(), responseSize: 8 };
@@ -112,15 +114,16 @@ class RequestInterceptor {
112
114
  }
113
115
  }
114
116
  handleRequest(config) {
117
+ var _a, _b, _c;
115
118
  try {
116
119
  const requestId = (0, uuid_1.v4)();
117
120
  config.mablRequestId = requestId;
118
121
  const requestResponseChain = {
119
122
  requestId,
120
123
  request: {
121
- headers: config.headers ?? {},
122
- url: config?.url ?? '<Unknown URL>',
123
- method: config.method?.toUpperCase(),
124
+ headers: (_a = config.headers) !== null && _a !== void 0 ? _a : {},
125
+ url: (_b = config === null || config === void 0 ? void 0 : config.url) !== null && _b !== void 0 ? _b : '<Unknown URL>',
126
+ method: (_c = config.method) === null || _c === void 0 ? void 0 : _c.toUpperCase(),
124
127
  request_sent_time: Date.now(),
125
128
  },
126
129
  };
@@ -141,7 +144,7 @@ class RequestInterceptor {
141
144
  const request = response.request;
142
145
  if (request) {
143
146
  chainEntry.request.headers = headerStringToHeaders(request._header);
144
- chainEntry.request.protocol = request?._header
147
+ chainEntry.request.protocol = (request === null || request === void 0 ? void 0 : request._header)
145
148
  ? headerStringToProtocol(request._header)
146
149
  : '<Unknown protocol>';
147
150
  }
@@ -151,7 +154,7 @@ class RequestInterceptor {
151
154
  headers: headerRecordToHeaderMultiMap(response.headers),
152
155
  status: response.status,
153
156
  response_received_time: responseReceivedTime,
154
- response_size: contentLength ?? responseSize,
157
+ response_size: contentLength !== null && contentLength !== void 0 ? contentLength : responseSize,
155
158
  body,
156
159
  };
157
160
  }
@@ -161,6 +164,7 @@ class RequestInterceptor {
161
164
  return response;
162
165
  }
163
166
  handleError(error) {
167
+ var _a;
164
168
  try {
165
169
  const config = error.config;
166
170
  let chainEntry;
@@ -173,7 +177,7 @@ class RequestInterceptor {
173
177
  }
174
178
  if (chainEntry) {
175
179
  chainEntry.error = {
176
- code: error.code ?? httpUtil_1.GENERAL_API_STEP_EXECUTION_ERROR_CODE,
180
+ code: (_a = error.code) !== null && _a !== void 0 ? _a : httpUtil_1.GENERAL_API_STEP_EXECUTION_ERROR_CODE,
177
181
  message: error.message,
178
182
  error_received_time: Date.now(),
179
183
  };
@@ -64,8 +64,9 @@ function argumentIsMablVariable(argument) {
64
64
  }
65
65
  exports.argumentIsMablVariable = argumentIsMablVariable;
66
66
  function parseArgument(arg) {
67
+ var _a;
67
68
  if (typeof arg === 'string') {
68
- const name = MablSymbol_1.SINGLE_VARIABLE_PATTERN_REGEX.exec(arg)?.[1];
69
+ const name = (_a = MablSymbol_1.SINGLE_VARIABLE_PATTERN_REGEX.exec(arg)) === null || _a === void 0 ? void 0 : _a[1];
69
70
  if (name) {
70
71
  return new MablSymbol_1.MablSymbol(name);
71
72
  }
@@ -80,7 +81,7 @@ exports.distinctStrings = distinctStrings;
80
81
  function convertObjectToMablscriptArgs(objectArgs) {
81
82
  const mablArgs = Object.keys(objectArgs)
82
83
  .sort()
83
- .filter((key) => objectArgs?.[key] !== undefined)
84
+ .filter((key) => (objectArgs === null || objectArgs === void 0 ? void 0 : objectArgs[key]) !== undefined)
84
85
  .map((key) => {
85
86
  switch (typeof objectArgs[key]) {
86
87
  case 'object':
@@ -47,7 +47,8 @@ class MablStep extends MablAction_1.MablAction {
47
47
  return this.stepSourceIndexInFlow;
48
48
  }
49
49
  getDescriptionForLogging() {
50
- return (this.annotation?.description || this.description || this.getStepName());
50
+ var _a;
51
+ return (((_a = this.annotation) === null || _a === void 0 ? void 0 : _a.description) || this.description || this.getStepName());
51
52
  }
52
53
  substituteMablscriptVariable(argument) {
53
54
  if (argument instanceof MablSymbol_1.MablSymbol) {
@@ -69,7 +70,8 @@ class MablStep extends MablAction_1.MablAction {
69
70
  return formatted;
70
71
  }
71
72
  annotationsOnStep() {
72
- return !!this.annotation?.note || !!this.annotation?.description;
73
+ var _a, _b;
74
+ return !!((_a = this.annotation) === null || _a === void 0 ? void 0 : _a.note) || !!((_b = this.annotation) === null || _b === void 0 ? void 0 : _b.description);
73
75
  }
74
76
  annotationsAsYml() {
75
77
  const result = {};
@@ -11,7 +11,7 @@ class MablSymbol {
11
11
  static fromString(formatted) {
12
12
  const regEx = '{{@(?<name>.*)}}';
13
13
  const found = formatted.match(regEx);
14
- if (!found?.groups) {
14
+ if (!(found === null || found === void 0 ? void 0 : found.groups)) {
15
15
  throw new Error(`Invalid MablSymbol format: ${formatted}`);
16
16
  }
17
17
  const name = found.groups.name;
@@ -30,6 +30,7 @@ class ConditionAction extends MablAction_1.MablAction {
30
30
  }
31
31
  }
32
32
  getEvaluateCondition() {
33
+ var _a;
33
34
  if (this.conditionValueAttribute === undefined) {
34
35
  throw new Error('Invalid equality condition. Missing value to compare.');
35
36
  }
@@ -37,7 +38,7 @@ class ConditionAction extends MablAction_1.MablAction {
37
38
  conditionType: ConditionDescriptor_1.ConditionType.Comparison,
38
39
  comparisonType: ConditionDescriptor_1.ComparisonType.fromString(this.conditionAttribute),
39
40
  comparatorValue: (0, MablAction_1.parseArgument)(this.conditionValueAttribute),
40
- caseInsensitive: this.options?.caseInsensitive,
41
+ caseInsensitive: (_a = this.options) === null || _a === void 0 ? void 0 : _a.caseInsensitive,
41
42
  };
42
43
  }
43
44
  getEvaluatePresence() {
@@ -68,7 +69,8 @@ class ConditionAction extends MablAction_1.MablAction {
68
69
  return `${this.generateEvaluateConditionMablscript()}`;
69
70
  }
70
71
  getInputVariables() {
71
- return MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.conditionValueAttribute ?? '');
72
+ var _a;
73
+ return MablAction_1.MablAction.findUniqueVariableReferencesInValue((_a = this.conditionValueAttribute) !== null && _a !== void 0 ? _a : '');
72
74
  }
73
75
  }
74
76
  exports.ConditionAction = ConditionAction;
@@ -132,6 +132,7 @@ class FindAction extends MablAction_1.MablAction {
132
132
  throw new Error('No selector found in yaml');
133
133
  }
134
134
  toYaml() {
135
+ var _a;
135
136
  const result = {};
136
137
  const find = this.toDescriptor();
137
138
  switch (find.findType) {
@@ -144,7 +145,7 @@ class FindAction extends MablAction_1.MablAction {
144
145
  break;
145
146
  case domUtil_1.FindType.FIND_ONE:
146
147
  result.selector = find.findTarget.selector;
147
- if (find.findTarget.auxiliaryDescriptors?.length) {
148
+ if ((_a = find.findTarget.auxiliaryDescriptors) === null || _a === void 0 ? void 0 : _a.length) {
148
149
  result.selectorAncestors = find.findTarget.auxiliaryDescriptors.map((descriptor) => descriptor.selector);
149
150
  }
150
151
  break;
@@ -157,12 +158,13 @@ class FindAction extends MablAction_1.MablAction {
157
158
  return this.generateFindMablscript();
158
159
  }
159
160
  generateFindMablscript() {
161
+ var _a;
160
162
  let action = this.findDescriptor.findType;
161
163
  let args = '';
162
164
  switch (this.findDescriptor.findType) {
163
165
  case domUtil_1.FindType.FIND_ONE:
164
166
  const find = this.findDescriptor;
165
- const selectors = find.findTarget.auxiliaryDescriptors?.length
167
+ const selectors = ((_a = find.findTarget.auxiliaryDescriptors) === null || _a === void 0 ? void 0 : _a.length)
166
168
  ? '[' +
167
169
  [find.findTarget, ...find.findTarget.auxiliaryDescriptors]
168
170
  .map(mablscriptFind_1.buildFindDescriptorString)
@@ -46,7 +46,7 @@ function convertFlowToStepList(flow, flowConfig) {
46
46
  if (!flow.reusable && flow.flow_type === mablApi_1.Flow.FlowTypeEnum.Mablscript) {
47
47
  return (0, importer_1.parseMablScriptIntoSteps)(flow);
48
48
  }
49
- const evaluateFlowStep = new EvaluateFlowStep_1.EvaluateFlowStep(EvaluateFlowStep_1.EvaluateFlowStep.mablScriptStepNames[0], [{ invariant_id: flow?.invariant_id }, flowConfig], []);
49
+ const evaluateFlowStep = new EvaluateFlowStep_1.EvaluateFlowStep(EvaluateFlowStep_1.EvaluateFlowStep.mablScriptStepNames[0], [{ invariant_id: flow === null || flow === void 0 ? void 0 : flow.invariant_id }, flowConfig], []);
50
50
  if (flow.description) {
51
51
  evaluateFlowStep.setDescription(flow.description);
52
52
  }
@@ -78,7 +78,7 @@ function convertStepListToFlow(steps) {
78
78
  const flow = {
79
79
  script: addTrailingNewline((0, importer_1.mablscriptTheLoadedSteps)(steps)),
80
80
  script_description: steps
81
- .map((step) => step.getDescription() ?? '')
81
+ .map((step) => { var _a; return (_a = step.getDescription()) !== null && _a !== void 0 ? _a : ''; })
82
82
  .join('\n'),
83
83
  step_annotations: stepAnnotations,
84
84
  };
@@ -86,7 +86,7 @@ function convertStepListToFlow(steps) {
86
86
  }
87
87
  exports.convertStepListToFlow = convertStepListToFlow;
88
88
  function flattenTestFlowsIntoSteps(flows, flowConfigs) {
89
- return flows.flatMap((flow, index) => convertFlowToStepList(flow, flowConfigs?.[index]));
89
+ return flows.flatMap((flow, index) => convertFlowToStepList(flow, flowConfigs === null || flowConfigs === void 0 ? void 0 : flowConfigs[index]));
90
90
  }
91
91
  exports.flattenTestFlowsIntoSteps = flattenTestFlowsIntoSteps;
92
92
  function constructTestFlowsFromSteps(steps) {
@@ -173,6 +173,7 @@ function diffTests(test1Flows, test1FlowConfig, test2Flows, test2FlowConfig) {
173
173
  }
174
174
  exports.diffTests = diffTests;
175
175
  function diffFlows(flow1, flow2) {
176
+ var _a, _b;
176
177
  const flow1Steps = (0, importer_1.parseMablScriptIntoSteps)(flow1);
177
178
  const formattedFlow1Steps = addTrailingNewline(flow1Steps.map((step) => step.toLineDiffFormat()).join('\n'));
178
179
  const flow2Steps = (0, importer_1.parseMablScriptIntoSteps)(flow2);
@@ -180,7 +181,7 @@ function diffFlows(flow1, flow2) {
180
181
  const flattenedDiffs = lineModeDiff(formattedFlow1Steps, formattedFlow2Steps);
181
182
  const stepDiffs = convertDiffingFormatIntoDiffingSteps(flattenedDiffs, flow1Steps, flow2Steps);
182
183
  const parametersDiff = diffFlowVariables(flow1.parameters, flow2.parameters);
183
- const inputVariablesDiff = diffFlowVariables(flow1.variables?.inputs, flow2.variables?.inputs);
184
+ const inputVariablesDiff = diffFlowVariables((_a = flow1.variables) === null || _a === void 0 ? void 0 : _a.inputs, (_b = flow2.variables) === null || _b === void 0 ? void 0 : _b.inputs);
184
185
  return { stepDiff: stepDiffs, parametersDiff, inputVariablesDiff };
185
186
  }
186
187
  exports.diffFlows = diffFlows;
@@ -199,10 +200,8 @@ function diffFlowVariables(flow1Variables, flow2Variables) {
199
200
  return flowVariablesDiff;
200
201
  }
201
202
  function flattenFlowVariables(flowVariables) {
202
- return (flowVariables
203
- ?.sort((a, b) => a.name.localeCompare(b.name))
204
- .map((parameter) => (0, fast_json_stable_stringify_1.default)(parameter))
205
- .join('\n') ?? '');
203
+ var _a;
204
+ return ((_a = flowVariables === null || flowVariables === void 0 ? void 0 : flowVariables.sort((a, b) => a.name.localeCompare(b.name)).map((parameter) => (0, fast_json_stable_stringify_1.default)(parameter)).join('\n')) !== null && _a !== void 0 ? _a : '');
206
205
  }
207
206
  function addTrailingNewline(text) {
208
207
  if (!text) {
@@ -371,8 +371,9 @@ function parseMablScriptIntoSteps(flow) {
371
371
  const parsed = parseMablScript(updatedScript);
372
372
  const loadedSteps = loadMablScriptIntoSteps(parsed);
373
373
  loadedSteps.forEach((step, index) => {
374
+ var _a;
374
375
  step.setDescription(flowDescriptions[index]);
375
- if (flow?.step_annotations?.[index]) {
376
+ if ((_a = flow === null || flow === void 0 ? void 0 : flow.step_annotations) === null || _a === void 0 ? void 0 : _a[index]) {
376
377
  step.setAnnotation(flow.step_annotations[index]);
377
378
  }
378
379
  step.setDisabled(disabledIndices.includes(index));
@@ -28,6 +28,7 @@ class AccessibilityCheckStep extends MablStep_1.MablStep {
28
28
  return AccessibilityCheckStep.yamlMablScriptNames[0];
29
29
  }
30
30
  toStepDescriptor() {
31
+ var _a, _b, _c, _d;
31
32
  if (this.findAction) {
32
33
  const find = this.findAction.toDescriptor();
33
34
  switch (find.findType) {
@@ -45,10 +46,10 @@ class AccessibilityCheckStep extends MablStep_1.MablStep {
45
46
  }
46
47
  }
47
48
  return {
48
- tags: this.checkConfig?.tags,
49
- rules: this.checkConfig?.rules,
50
- disabledRules: this.checkConfig?.disabledRules,
51
- failOn: this.checkConfig?.failOn,
49
+ tags: (_a = this.checkConfig) === null || _a === void 0 ? void 0 : _a.tags,
50
+ rules: (_b = this.checkConfig) === null || _b === void 0 ? void 0 : _b.rules,
51
+ disabledRules: (_c = this.checkConfig) === null || _c === void 0 ? void 0 : _c.disabledRules,
52
+ failOn: (_d = this.checkConfig) === null || _d === void 0 ? void 0 : _d.failOn,
52
53
  };
53
54
  }
54
55
  getFormattedStep(_fullLocatorsOn) {
@@ -82,10 +83,11 @@ class AccessibilityCheckStep extends MablStep_1.MablStep {
82
83
  return new AccessibilityCheckStep(AccessibilityCheckStep.mablScriptStepNames[0], [checkConfig], actions);
83
84
  }
84
85
  toMablscript() {
86
+ var _a, _b, _c;
85
87
  let argString = '';
86
- if (this.checkConfig?.tags ||
87
- this.checkConfig?.disabledRules ||
88
- this.checkConfig?.rules) {
88
+ if (((_a = this.checkConfig) === null || _a === void 0 ? void 0 : _a.tags) ||
89
+ ((_b = this.checkConfig) === null || _b === void 0 ? void 0 : _b.disabledRules) ||
90
+ ((_c = this.checkConfig) === null || _c === void 0 ? void 0 : _c.rules)) {
89
91
  argString = `{${(0, MablStep_1.buildObjectString)(this.checkConfig)}}`;
90
92
  }
91
93
  let findAction = '';
@@ -43,6 +43,7 @@ exports.fieldToAssertionStep = {};
43
43
  Object.entries(exports.assertionStepToField).forEach(([stepType, field]) => (exports.fieldToAssertionStep[field] = stepType));
44
44
  class AssertStep extends MablStep_1.MablStep {
45
45
  constructor(name, args, actions) {
46
+ var _a, _b;
46
47
  super(name, args, actions);
47
48
  const firstAction = actions[0];
48
49
  if (firstAction instanceof FindAction_1.FindAction ||
@@ -73,9 +74,9 @@ class AssertStep extends MablStep_1.MablStep {
73
74
  ? args[0]
74
75
  : undefined;
75
76
  this.onFailure =
76
- this.assertArguments?.onFailure ||
77
+ ((_a = this.assertArguments) === null || _a === void 0 ? void 0 : _a.onFailure) ||
77
78
  OnFailure.FailImmediately;
78
- this.observationScope = this.assertArguments?.observationScope;
79
+ this.observationScope = (_b = this.assertArguments) === null || _b === void 0 ? void 0 : _b.observationScope;
79
80
  }
80
81
  canContinueOnFailure() {
81
82
  return this.onFailure !== OnFailure.FailImmediately;
@@ -91,9 +92,10 @@ class AssertStep extends MablStep_1.MablStep {
91
92
  }
92
93
  }
93
94
  determineIfWaitUntilStep() {
95
+ var _a, _b;
94
96
  const find = this.primaryAction.toDescriptor();
95
97
  if ((0, domUtil_1.isFindElementDescriptor)(find)) {
96
- if (find.findOptions?.waitUntil?.timeoutSeconds) {
98
+ if ((_b = (_a = find.findOptions) === null || _a === void 0 ? void 0 : _a.waitUntil) === null || _b === void 0 ? void 0 : _b.timeoutSeconds) {
97
99
  return true;
98
100
  }
99
101
  }
@@ -106,6 +108,7 @@ class AssertStep extends MablStep_1.MablStep {
106
108
  return exports.fieldToAssertionStep[this.assertionType];
107
109
  }
108
110
  toStepDescriptor() {
111
+ var _a, _b;
109
112
  const find = this.primaryAction.toDescriptor();
110
113
  const descriptorToActionMap = new Map()
111
114
  .set(find, this.primaryAction)
@@ -118,9 +121,9 @@ class AssertStep extends MablStep_1.MablStep {
118
121
  }
119
122
  return {
120
123
  find,
121
- extractDescriptor: this.extractAction?.extractDescriptor,
124
+ extractDescriptor: (_a = this.extractAction) === null || _a === void 0 ? void 0 : _a.extractDescriptor,
122
125
  conditionDescriptor: this.conditionAction.conditionDescriptor,
123
- countDescriptor: this.countAction?.countDescriptor,
126
+ countDescriptor: (_b = this.countAction) === null || _b === void 0 ? void 0 : _b.countDescriptor,
124
127
  onFailure: this.onFailure,
125
128
  observationScope: this.observationScope,
126
129
  descriptorToActionMap,
@@ -216,13 +219,14 @@ class AssertStep extends MablStep_1.MablStep {
216
219
  ], actions);
217
220
  }
218
221
  toMablscript() {
219
- const assertAction = `.assert(${!!(this.assertArguments?.onFailure ||
220
- this.assertArguments?.observationScope)
222
+ var _a, _b, _c, _d;
223
+ const assertAction = `.assert(${!!(((_a = this.assertArguments) === null || _a === void 0 ? void 0 : _a.onFailure) ||
224
+ ((_b = this.assertArguments) === null || _b === void 0 ? void 0 : _b.observationScope))
221
225
  ? (0, MablAction_1.convertObjectToMablscriptArgs)({
222
226
  ...this.assertArguments,
223
- onFailure: this.assertArguments?.onFailure === OnFailure.FailImmediately
227
+ onFailure: ((_c = this.assertArguments) === null || _c === void 0 ? void 0 : _c.onFailure) === OnFailure.FailImmediately
224
228
  ? undefined
225
- : this.assertArguments?.onFailure,
229
+ : (_d = this.assertArguments) === null || _d === void 0 ? void 0 : _d.onFailure,
226
230
  })
227
231
  : ''})`;
228
232
  if (this.countAction) {
@@ -238,11 +242,12 @@ class AssertStep extends MablStep_1.MablStep {
238
242
  return `${this.primaryAction.toMablscript()}.${this.conditionAction.toMablscript()}${assertAction}`;
239
243
  }
240
244
  getInputVariables() {
245
+ var _a, _b, _c, _d;
241
246
  return (0, MablAction_1.distinctStrings)([
242
247
  ...this.primaryAction.getInputVariables(),
243
- ...(this.countAction?.getInputVariables() ?? []),
248
+ ...((_b = (_a = this.countAction) === null || _a === void 0 ? void 0 : _a.getInputVariables()) !== null && _b !== void 0 ? _b : []),
244
249
  ...this.conditionAction.getInputVariables(),
245
- ...(this.extractAction?.getInputVariables() ?? []),
250
+ ...((_d = (_c = this.extractAction) === null || _c === void 0 ? void 0 : _c.getInputVariables()) !== null && _d !== void 0 ? _d : []),
246
251
  ]);
247
252
  }
248
253
  }
@@ -7,9 +7,10 @@ const domUtil_1 = require("../../domUtil");
7
7
  const ActionsUtils_1 = require("./ActionsUtils");
8
8
  class ClickAndHoldStep extends MablStep_1.MablStep {
9
9
  constructor(name, args, actions) {
10
+ var _a;
10
11
  super(name, args, actions);
11
12
  this.findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(this.actions);
12
- this.clickArgs = this.parseArgs(args) ?? { isHtml5: false };
13
+ this.clickArgs = (_a = this.parseArgs(args)) !== null && _a !== void 0 ? _a : { isHtml5: false };
13
14
  }
14
15
  parseArgs(args) {
15
16
  if (args.length === 0) {
@@ -101,6 +101,7 @@ class CreateVariableStep extends MablStep_1.MablStep {
101
101
  return step;
102
102
  }
103
103
  getFormattedStep() {
104
+ var _a;
104
105
  const step = this.toStepDescriptor();
105
106
  const stepName = this.getStepName();
106
107
  const formatted = {
@@ -127,7 +128,7 @@ class CreateVariableStep extends MablStep_1.MablStep {
127
128
  generator: step.generator,
128
129
  name: this.variableName,
129
130
  selector: step.generator.find.findTarget.selector,
130
- selectorAncestors: (step.generator.find.findTarget.auxiliaryDescriptors ?? []).map((descriptor) => descriptor.selector),
131
+ selectorAncestors: ((_a = step.generator.find.findTarget.auxiliaryDescriptors) !== null && _a !== void 0 ? _a : []).map((descriptor) => descriptor.selector),
131
132
  };
132
133
  break;
133
134
  case CreateVariableStepDescriptor_1.VariableGenerator.JAVASCRIPT:
@@ -8,9 +8,10 @@ const AwaitPDFDownloadAction_1 = require("../actions/AwaitPDFDownloadAction");
8
8
  const domUtil_1 = require("../../domUtil");
9
9
  class DownloadStep extends MablStep_1.MablStep {
10
10
  constructor(name, args, actions) {
11
+ var _a;
11
12
  super(name, args, actions);
12
13
  this.validate();
13
- this.fileAttributes = (this.getActionArgs()[0] ?? {});
14
+ this.fileAttributes = ((_a = this.getActionArgs()[0]) !== null && _a !== void 0 ? _a : {});
14
15
  this.awaitDownloadAction = this.actions[0];
15
16
  }
16
17
  validate() {
@@ -43,6 +43,7 @@ class EnterTextStep extends MablStep_1.MablStep {
43
43
  }
44
44
  }
45
45
  getFormattedStep() {
46
+ var _a;
46
47
  const step = this.toStepDescriptor();
47
48
  const stepName = this.getStepName();
48
49
  const formatted = {
@@ -56,7 +57,7 @@ class EnterTextStep extends MablStep_1.MablStep {
56
57
  }
57
58
  if (step.find.findType === domUtil_1.FindType.FIND_ONE) {
58
59
  formatted[stepName].selector = step.find.findTarget.selector;
59
- if (step.find.findTarget.auxiliaryDescriptors?.length) {
60
+ if ((_a = step.find.findTarget.auxiliaryDescriptors) === null || _a === void 0 ? void 0 : _a.length) {
60
61
  formatted[stepName].selectorAncestors =
61
62
  step.find.findTarget.auxiliaryDescriptors.map((descriptor) => descriptor.selector);
62
63
  }
@@ -43,6 +43,6 @@ exports.EvaluateFlowStep = EvaluateFlowStep;
43
43
  EvaluateFlowStep.mablScriptStepNames = ['evaluate_flow'];
44
44
  EvaluateFlowStep.yamlMablScriptNames = [exports.EVALUATE_FLOW_STEP_NAME];
45
45
  function isEvaluateFlowStep(step) {
46
- return step?.getStepName() === exports.EVALUATE_FLOW_STEP_NAME;
46
+ return (step === null || step === void 0 ? void 0 : step.getStepName()) === exports.EVALUATE_FLOW_STEP_NAME;
47
47
  }
48
48
  exports.isEvaluateFlowStep = isEvaluateFlowStep;
@@ -33,13 +33,14 @@ class IfConditionStep extends MablStep_1.MablStep {
33
33
  return 'If';
34
34
  }
35
35
  toStepDescriptor() {
36
+ var _a, _b;
36
37
  const conditionDescriptor = this.conditionAction !== undefined
37
- ? this.conditionAction?.conditionDescriptor
38
+ ? (_a = this.conditionAction) === null || _a === void 0 ? void 0 : _a.conditionDescriptor
38
39
  : { conditionType: ConditionDescriptor_1.ConditionType.Truthy };
39
40
  const find = this.primaryAction.toDescriptor();
40
41
  return {
41
42
  find,
42
- extractDescriptor: this.extractAction?.extractDescriptor,
43
+ extractDescriptor: (_b = this.extractAction) === null || _b === void 0 ? void 0 : _b.extractDescriptor,
43
44
  conditionDescriptor,
44
45
  onFailure: AssertStep_1.OnFailure.FailImmediately,
45
46
  descriptorToActionMap: new Map().set(find, this.primaryAction),
@@ -136,10 +137,11 @@ class IfConditionStep extends MablStep_1.MablStep {
136
137
  return `${this.actions.reduce((mablscript, action) => `${mablscript}${action.toMablscript()}.`, '')}conditional_if()`;
137
138
  }
138
139
  getInputVariables() {
140
+ var _a, _b, _c, _d;
139
141
  return (0, MablAction_1.distinctStrings)([
140
142
  ...this.primaryAction.getInputVariables(),
141
- ...(this.conditionAction?.getInputVariables() ?? []),
142
- ...(this.extractAction?.getInputVariables() ?? []),
143
+ ...((_b = (_a = this.conditionAction) === null || _a === void 0 ? void 0 : _a.getInputVariables()) !== null && _b !== void 0 ? _b : []),
144
+ ...((_d = (_c = this.extractAction) === null || _c === void 0 ? void 0 : _c.getInputVariables()) !== null && _d !== void 0 ? _d : []),
143
145
  ]);
144
146
  }
145
147
  }
@@ -8,9 +8,10 @@ const domUtil_1 = require("../../domUtil");
8
8
  const ActionsUtils_1 = require("./ActionsUtils");
9
9
  class ReleaseStep extends MablStep_1.MablStep {
10
10
  constructor(name, args, actions) {
11
+ var _a;
11
12
  super(name, args, actions);
12
13
  this.findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(this.actions);
13
- this.releaseArgs = this.parseArgs(args) ?? { isHtml5: false };
14
+ this.releaseArgs = (_a = this.parseArgs(args)) !== null && _a !== void 0 ? _a : { isHtml5: false };
14
15
  }
15
16
  parseArgs(args) {
16
17
  if (args.length === 0) {