@mablhq/mabl-cli 1.58.25 → 1.59.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 (105) hide show
  1. package/api/basicApiClient.js +15 -21
  2. package/api/mablApiClient.js +54 -43
  3. package/api/mablApiClientFactory.js +1 -1
  4. package/auth/OktaClient.js +2 -1
  5. package/browserEngines/chromiumBrowserEngine.js +2 -2
  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/cloudMonitoringPerformanceMetrics.js +28 -56
  25. package/browserTestMonitoring/distributions.js +1 -6
  26. package/browserTestMonitoring/metricsRecorder.js +47 -30
  27. package/commands/commandUtil/branches.js +3 -2
  28. package/commands/commandUtil/codeInsights.js +16 -13
  29. package/commands/commandUtil/fileUtil.js +1 -1
  30. package/commands/commandUtil/util.js +5 -3
  31. package/commands/commandUtil/versionUtil.js +5 -4
  32. package/commands/config/config_cmds/list.js +2 -2
  33. package/commands/datatables/datatables_cmds/create.js +3 -2
  34. package/commands/datatables/datatables_cmds/export.js +5 -3
  35. package/commands/datatables/datatables_cmds/list.js +2 -1
  36. package/commands/datatables/datatables_cmds/scenarios.js +2 -1
  37. package/commands/datatables/datatables_cmds/update.js +11 -11
  38. package/commands/datatables/utils.js +9 -9
  39. package/commands/deploy/deploy_cmds/awaitDeploymentCompletion.js +8 -6
  40. package/commands/deploy/deploy_cmds/create.js +13 -11
  41. package/commands/deploy/deploy_cmds/executionResultPresenter.js +11 -8
  42. package/commands/deploy/deploy_cmds/list.js +4 -3
  43. package/commands/deploy/deploy_cmds/watch.js +2 -1
  44. package/commands/environments/environments_cmds/create.js +2 -1
  45. package/commands/environments/environments_cmds/delete.js +2 -1
  46. package/commands/environments/environments_cmds/update.js +2 -1
  47. package/commands/environments/environments_cmds/urls_cmds/list.js +2 -1
  48. package/commands/flows/flows_cmds/export.js +5 -4
  49. package/commands/plans/plans_cmds/describe.js +2 -1
  50. package/commands/tests/mobileEmulationUtil.js +7 -5
  51. package/commands/tests/testsUtil.js +46 -42
  52. package/commands/tests/tests_cmds/export.js +2 -1
  53. package/commands/tests/tests_cmds/import.js +5 -4
  54. package/commands/tests/tests_cmds/run-cloud.js +34 -15
  55. package/commands/tests/tests_cmds/run.js +11 -11
  56. package/commands/users/users_cmds/list.js +2 -2
  57. package/commands/workspaces/workspace_cmds/copy.js +2 -1
  58. package/core/execution/ApiTestUtils.js +94 -82
  59. package/core/messaging/logLineMessaging.js +3 -2
  60. package/core/messaging/messaging.js +7 -6
  61. package/core/trainer/trainingSessions.js +32 -16
  62. package/coreWebVitals/index.js +18 -14
  63. package/execution/index.js +1 -1
  64. package/functions/apiTest/utils.js +5 -4
  65. package/http/MablHttpAgent.js +6 -4
  66. package/http/RequestSecurityError.js +1 -1
  67. package/http/axiosProxyConfig.js +5 -3
  68. package/http/httpUtil.js +3 -2
  69. package/http/requestInterceptor.js +15 -11
  70. package/mablApi/index.js +1 -1
  71. package/mablscript/MablAction.js +3 -2
  72. package/mablscript/MablStep.js +4 -2
  73. package/mablscript/MablSymbol.js +1 -1
  74. package/mablscript/actions/ConditionAction.js +4 -2
  75. package/mablscript/actions/FindAction.js +4 -2
  76. package/mablscript/diffing/diffingUtil.js +7 -8
  77. package/mablscript/importer.js +2 -1
  78. package/mablscript/steps/AccessibilityCheck.js +9 -7
  79. package/mablscript/steps/AssertStep.js +16 -11
  80. package/mablscript/steps/ClickAndHoldStep.js +2 -1
  81. package/mablscript/steps/CreateVariableStep.js +2 -1
  82. package/mablscript/steps/DownloadStep.js +2 -1
  83. package/mablscript/steps/EnterTextStep.js +2 -1
  84. package/mablscript/steps/EvaluateFlowStep.js +1 -1
  85. package/mablscript/steps/IfConditionStep.js +6 -4
  86. package/mablscript/steps/ReleaseStep.js +2 -1
  87. package/mablscript/steps/SendHttpRequestStep.js +4 -2
  88. package/mablscript/steps/SendKeyStep.js +1 -1
  89. package/mablscript/steps/SetCookieStep.js +8 -7
  90. package/mablscript/steps/SetViewportStep.js +1 -1
  91. package/mablscript/steps/SwitchContextStep.js +6 -3
  92. package/mablscript/steps/SyntheticStep.js +2 -1
  93. package/middleware.js +2 -1
  94. package/package.json +3 -3
  95. package/popupDismissal/index.js +5 -4
  96. package/providers/authenticationProvider.js +6 -5
  97. package/providers/cliConfigProvider.js +12 -10
  98. package/providers/exportRequestProvider.js +5 -3
  99. package/providers/logging/loggingProvider.js +1 -1
  100. package/reporters/mochAwesome/mochAwesomeReporter.js +14 -12
  101. package/util/TestOutputWriter.js +12 -8
  102. package/util/actionabilityUtil.js +1 -1
  103. package/util/analytics.js +9 -6
  104. package/util/browserTestUtils.js +2 -1
  105. package/util/markdownUtil.js +11 -9
@@ -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) {
@@ -27,9 +27,10 @@ class SendHttpRequestStep extends MablStep_1.MablStep {
27
27
  return formatted;
28
28
  }
29
29
  static fromYaml(_stepName, stepArgs) {
30
+ var _a;
30
31
  const formatted = stepArgs;
31
32
  if (formatted.assertions) {
32
- formatted.assertions = formatted.assertions?.map((assertion) => ({
33
+ formatted.assertions = (_a = formatted.assertions) === null || _a === void 0 ? void 0 : _a.map((assertion) => ({
33
34
  ...assertion,
34
35
  assertion: AssertStep_1.assertionStepToField[`Assert${assertion.assertion}`],
35
36
  }));
@@ -46,7 +47,8 @@ class SendHttpRequestStep extends MablStep_1.MablStep {
46
47
  return MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.sendRequest);
47
48
  }
48
49
  getOutputVariables() {
49
- return this.sendRequest.variables?.map((variable) => variable.name) ?? [];
50
+ var _a, _b;
51
+ return (_b = (_a = this.sendRequest.variables) === null || _a === void 0 ? void 0 : _a.map((variable) => variable.name)) !== null && _b !== void 0 ? _b : [];
50
52
  }
51
53
  }
52
54
  exports.SendHttpRequestStep = SendHttpRequestStep;
@@ -19,7 +19,7 @@ class SendKeyStep extends MablStep_1.MablStep {
19
19
  throw new Error(`Unexpected find action for ${name} step: ${JSON.stringify(this.actions[0])}`);
20
20
  }
21
21
  const keys = this.getActionArgs();
22
- if (!keys?.length) {
22
+ if (!(keys === null || keys === void 0 ? void 0 : keys.length)) {
23
23
  throw new Error(`${name} step expects at least one key`);
24
24
  }
25
25
  if (keys.every(SendKeyStepDescriptor_1.isCrossPlatformKeyPress)) {
@@ -38,16 +38,17 @@ class SetCookieStep extends MablStep_1.MablStep {
38
38
  return new SetCookieStep('set_cookie', [stepArgs], []);
39
39
  }
40
40
  toMablscript() {
41
+ var _a, _b, _c, _d, _e, _f, _g;
41
42
  const cookieSelector = {
42
43
  name: this.cookieName,
43
44
  value: this.cookieValue,
44
- domain: this.cookieOptions?.domain,
45
- path: this.cookieOptions?.path,
46
- expiry: this.cookieOptions?.expires,
47
- http_only: this.cookieOptions?.httpOnly,
48
- secure: this.cookieOptions?.secure,
49
- same_site: this.cookieOptions?.sameSite,
50
- url: this.cookieOptions?.url,
45
+ domain: (_a = this.cookieOptions) === null || _a === void 0 ? void 0 : _a.domain,
46
+ path: (_b = this.cookieOptions) === null || _b === void 0 ? void 0 : _b.path,
47
+ expiry: (_c = this.cookieOptions) === null || _c === void 0 ? void 0 : _c.expires,
48
+ http_only: (_d = this.cookieOptions) === null || _d === void 0 ? void 0 : _d.httpOnly,
49
+ secure: (_e = this.cookieOptions) === null || _e === void 0 ? void 0 : _e.secure,
50
+ same_site: (_f = this.cookieOptions) === null || _f === void 0 ? void 0 : _f.sameSite,
51
+ url: (_g = this.cookieOptions) === null || _g === void 0 ? void 0 : _g.url,
51
52
  };
52
53
  return `set_cookie(${(0, domUtil_1.buildStepArgumentString)({
53
54
  params: cookieSelector,
@@ -6,7 +6,7 @@ class SetViewportStep extends MablStep_1.MablStep {
6
6
  constructor(name, args, actions) {
7
7
  super(name, args, actions);
8
8
  const viewportArg = this.getActionArgs()[0];
9
- this.size = viewportArg?.size;
9
+ this.size = viewportArg === null || viewportArg === void 0 ? void 0 : viewportArg.size;
10
10
  }
11
11
  getStepName() {
12
12
  return 'SetViewport';
@@ -60,6 +60,7 @@ class SwitchContextStep extends MablStep_1.MablStep {
60
60
  return this.switch;
61
61
  }
62
62
  getFormattedStep() {
63
+ var _a;
63
64
  const step = this.toStepDescriptor();
64
65
  const stepName = this.getStepName();
65
66
  const formatted = {
@@ -77,7 +78,7 @@ class SwitchContextStep extends MablStep_1.MablStep {
77
78
  }
78
79
  if ((0, SwitchContextStepDescriptor_1.isSwitchFrame)(step)) {
79
80
  formatted[stepName].selector = step.frame.findTarget.selector;
80
- if (step.frame.findTarget.auxiliaryDescriptors?.length) {
81
+ if ((_a = step.frame.findTarget.auxiliaryDescriptors) === null || _a === void 0 ? void 0 : _a.length) {
81
82
  formatted[stepName].selectorAncestors =
82
83
  step.frame.findTarget.auxiliaryDescriptors.map((descriptor) => descriptor.selector);
83
84
  }
@@ -94,13 +95,15 @@ class SwitchContextStep extends MablStep_1.MablStep {
94
95
  return new SwitchContextStep('switch_context_to', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
95
96
  }
96
97
  toMablscript() {
98
+ var _a;
97
99
  if ((0, SwitchContextStepDescriptor_1.isSwitchRoot)(this.switch) && this.switch.frame === 'root') {
98
100
  return 'switch_context_to("root")';
99
101
  }
100
- return `${this.findAction?.toMablscript()}.switch_context_to()`;
102
+ return `${(_a = this.findAction) === null || _a === void 0 ? void 0 : _a.toMablscript()}.switch_context_to()`;
101
103
  }
102
104
  getInputVariables() {
103
- return this.findAction?.getInputVariables() ?? [];
105
+ var _a, _b;
106
+ return (_b = (_a = this.findAction) === null || _a === void 0 ? void 0 : _a.getInputVariables()) !== null && _b !== void 0 ? _b : [];
104
107
  }
105
108
  }
106
109
  exports.SwitchContextStep = SwitchContextStep;
@@ -10,7 +10,8 @@ class SyntheticStep extends MablStep_1.MablStep {
10
10
  this.actionSourceIndexInStep = 0;
11
11
  }
12
12
  getStepName() {
13
- return this.stepName ?? 'Synthetic Step';
13
+ var _a;
14
+ return (_a = this.stepName) !== null && _a !== void 0 ? _a : 'Synthetic Step';
14
15
  }
15
16
  setStepName(stepName) {
16
17
  this.stepName = stepName;
package/middleware.js CHANGED
@@ -2,6 +2,7 @@
2
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
+ var _a;
5
6
  Object.defineProperty(exports, "__esModule", { value: true });
6
7
  exports.CLI_MIDDLEWARE = void 0;
7
8
  const chalk_1 = __importDefault(require("chalk"));
@@ -14,7 +15,7 @@ const pureUtil_1 = require("./util/pureUtil");
14
15
  const simple_update_notifier_1 = __importDefault(require("simple-update-notifier"));
15
16
  const cliPackage = require('./package.json');
16
17
  const UPDATE_CHECK_INTERVAL_MILLISECONDS = 24 * 60 * 60 * 1000;
17
- const MIN_SUPPORTED_NODE_VERSION = (0, versionUtil_1.extractNodeVersionTuple)(cliPackage?.engines?.node);
18
+ const MIN_SUPPORTED_NODE_VERSION = (0, versionUtil_1.extractNodeVersionTuple)((_a = cliPackage === null || cliPackage === void 0 ? void 0 : cliPackage.engines) === null || _a === void 0 ? void 0 : _a.node);
18
19
  exports.CLI_MIDDLEWARE = [
19
20
  () => {
20
21
  (0, logLineMessaging_1.registerConsoleLoggerForOutput)(messaging_1.mablEventEmitter);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mablhq/mabl-cli",
3
- "version": "1.58.25",
3
+ "version": "1.59.5",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "The official mabl command line interface tool",
6
6
  "main": "index.js",
@@ -26,7 +26,7 @@
26
26
  "@opentelemetry/api": "1.3.0",
27
27
  "@opentelemetry/resources": "1.11.0",
28
28
  "@opentelemetry/sdk-metrics": "1.8.0",
29
- "@playwright/test": "1.36.2",
29
+ "@playwright/test": "1.37.1",
30
30
  "@types/fs-extra": "8.1.1",
31
31
  "@types/serve-handler": "6.1.0",
32
32
  "@types/tmp": "0.2.0",
@@ -75,7 +75,7 @@
75
75
  "newman": "5.3.2",
76
76
  "open": "6.4.0",
77
77
  "ora": "4.0.4",
78
- "playwright-core": "1.36.2",
78
+ "playwright-core": "1.37.1",
79
79
  "pluralize": "8.0.0",
80
80
  "pngjs": "6.0.0",
81
81
  "portfinder": "1.0.28",
@@ -44,7 +44,7 @@ function getEffectiveZIndex(element) {
44
44
  if (zIndex && zIndex !== ZINDEX_AUTO) {
45
45
  return parseInt(zIndex, 10);
46
46
  }
47
- current = current?.parentElement ? current.parentElement : undefined;
47
+ current = (current === null || current === void 0 ? void 0 : current.parentElement) ? current.parentElement : undefined;
48
48
  }
49
49
  return 0;
50
50
  }
@@ -91,8 +91,9 @@ function developCloseCandidates(candidates) {
91
91
  const domCovering = [];
92
92
  const actionableElements = [];
93
93
  candidate.elements.forEach((element) => {
94
- if (element?.offsetParent) {
95
- if (['BUTTON', 'A', 'DIV'].includes(element.tagName?.toUpperCase()) &&
94
+ var _a;
95
+ if (element === null || element === void 0 ? void 0 : element.offsetParent) {
96
+ if (['BUTTON', 'A', 'DIV'].includes((_a = element.tagName) === null || _a === void 0 ? void 0 : _a.toUpperCase()) &&
96
97
  checkElementAttributes(element) &&
97
98
  !actionableElements.includes(element)) {
98
99
  actionableElements.push(element);
@@ -170,7 +171,7 @@ function getAllElementsAbove(targetElement, elements) {
170
171
  return [];
171
172
  }
172
173
  const targetZindex = getEffectiveZIndex(targetElement);
173
- const zIndexAboveTarget = Math.min(...elements?.map((el) => getEffectiveZIndex(el)));
174
+ const zIndexAboveTarget = Math.min(...elements === null || elements === void 0 ? void 0 : elements.map((el) => getEffectiveZIndex(el)));
174
175
  if (zIndexAboveTarget <= targetZindex) {
175
176
  return [];
176
177
  }