@mablhq/mabl-cli 2.71.0 → 2.72.0

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 (58) hide show
  1. package/execution/index.js +1 -1
  2. package/mablscript/MablStepV2.js +40 -10
  3. package/mablscript/MablStepWithFindAction.js +126 -2
  4. package/mablscript/actions/AwaitDownloadAction.js +4 -3
  5. package/mablscript/actions/AwaitPDFDownloadAction.js +6 -5
  6. package/mablscript/actions/ConditionAction.js +2 -1
  7. package/mablscript/actions/ExtractAction.js +8 -13
  8. package/mablscript/actions/FindAction.js +20 -0
  9. package/mablscript/actions/GetVariableValue.js +15 -4
  10. package/mablscript/actions/JavaScriptAction.js +25 -39
  11. package/mablscript/diffing/diffingUtil.js +5 -5
  12. package/mablscript/importer.js +79 -59
  13. package/mablscript/mobile/steps/CreateVariableMobileStep.js +3 -1
  14. package/mablscript/steps/AbstractAssertionsAndVariablesStep.js +10 -8
  15. package/mablscript/steps/AccessibilityCheck.js +76 -36
  16. package/mablscript/steps/AssertStep.js +266 -86
  17. package/mablscript/steps/AssertStepOld.js +69 -139
  18. package/mablscript/steps/AwaitTabStep.js +30 -9
  19. package/mablscript/steps/AwaitUploadsStep.js +22 -8
  20. package/mablscript/steps/ClearCookiesStep.js +22 -8
  21. package/mablscript/steps/ClickAndHoldStep.js +45 -47
  22. package/mablscript/steps/ClickStep.js +36 -33
  23. package/mablscript/steps/CreateVariableStep.js +169 -137
  24. package/mablscript/steps/DatabaseQueryStep.js +14 -4
  25. package/mablscript/steps/DoubleClickStep.js +37 -40
  26. package/mablscript/steps/DownloadStep.js +79 -63
  27. package/mablscript/steps/EchoStep.js +26 -8
  28. package/mablscript/steps/ElseIfConditionStep.js +23 -12
  29. package/mablscript/steps/ElseStep.js +22 -9
  30. package/mablscript/steps/EndStep.js +22 -9
  31. package/mablscript/steps/EnterAuthCodeStep.js +36 -34
  32. package/mablscript/steps/EnterTextStep.js +51 -64
  33. package/mablscript/steps/EvaluateFlowStep.js +39 -18
  34. package/mablscript/steps/EvaluateJavaScriptStep.js +17 -19
  35. package/mablscript/steps/HoverStep.js +37 -39
  36. package/mablscript/steps/IfConditionStep.js +139 -99
  37. package/mablscript/steps/NavigateStep.js +29 -9
  38. package/mablscript/steps/OpenEmailStep.js +39 -21
  39. package/mablscript/steps/ReleaseStep.js +46 -38
  40. package/mablscript/steps/RemoveCookieStep.js +25 -9
  41. package/mablscript/steps/RightClickStep.js +36 -33
  42. package/mablscript/steps/SelectStep.js +69 -46
  43. package/mablscript/steps/SendHttpRequestStep.js +13 -4
  44. package/mablscript/steps/SendKeyStep.js +174 -50
  45. package/mablscript/steps/SetCookieStep.js +56 -23
  46. package/mablscript/steps/SetFilesStep.js +42 -43
  47. package/mablscript/steps/SetViewportStep.js +39 -13
  48. package/mablscript/steps/StepGroupStep.js +70 -0
  49. package/mablscript/steps/SwitchContextStep.js +89 -83
  50. package/mablscript/steps/SyntheticStep.js +1 -1
  51. package/mablscript/steps/VisitUrlStep.js +30 -22
  52. package/mablscript/steps/WaitStep.js +20 -9
  53. package/mablscript/steps/WaitUntilStep.js +31 -14
  54. package/mablscript/types/AssertStepDescriptor.js +2 -0
  55. package/mablscript/types/ConditionDescriptor.js +5 -5
  56. package/mablscript/types/GetVariableDescriptor.js +0 -8
  57. package/mablscript/types/StepGroupStepDescriptor.js +2 -0
  58. package/package.json +1 -1
@@ -2,53 +2,26 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SwitchContextStep = void 0;
4
4
  const FindAction_1 = require("../actions/FindAction");
5
- const MablStep_1 = require("../MablStep");
5
+ const MablStepV2_1 = require("../MablStepV2");
6
6
  const SwitchContextStepDescriptor_1 = require("../types/SwitchContextStepDescriptor");
7
7
  const domUtil_1 = require("../../domUtil");
8
- class SwitchContextStep extends MablStep_1.MablStep {
9
- constructor(name, args, actions) {
10
- super(name, args, actions, 'switch_context_to');
11
- const maybeRoot = this.getActionArgs()[0];
12
- if (maybeRoot !== undefined && maybeRoot !== 'root') {
13
- throw new Error(`Unexpected argument for ${name} step: ${JSON.stringify(maybeRoot)}`);
8
+ const mablscriptFind_1 = require("../../mablscriptFind");
9
+ class SwitchContextStep extends MablStepV2_1.MablStepV2 {
10
+ constructor(descriptor) {
11
+ super(SwitchContextStep.stepName, descriptor, SwitchContextStep.actionCode);
12
+ if ((0, SwitchContextStepDescriptor_1.isSwitchRoot)(descriptor) || (0, SwitchContextStepDescriptor_1.isSwitchFrame)(descriptor)) {
13
+ this.frame = descriptor.frame;
14
14
  }
15
- if (maybeRoot === 'root') {
16
- this.switch = {
17
- frame: 'root',
18
- actionCode: this.actionCode,
19
- };
20
- Object.freeze(this.switch);
21
- return;
15
+ else if ((0, SwitchContextStepDescriptor_1.isSwitchTab)(descriptor)) {
16
+ this.tab = descriptor.tab;
22
17
  }
23
- if (actions.length !== 1) {
24
- throw new Error(`No find action for ${name} step`);
25
- }
26
- this.findAction = new FindAction_1.FindAction(this.actions[0].name, this.actions[0].args);
27
- if (this.actions[0].actionSourceIndexInStep !== undefined) {
28
- this.findAction.setActionSourceIndexInStep(this.actions[0].actionSourceIndexInStep);
29
- }
30
- const findDescriptor = this.findAction.toDescriptor();
31
- if (findDescriptor.findType === domUtil_1.FindType.FIND_TAB) {
32
- this.switch = {
33
- tab: findDescriptor,
34
- find: findDescriptor,
35
- descriptorToActionMap: new Map().set(findDescriptor, this.findAction),
36
- actionCode: this.actionCode,
37
- };
38
- Object.freeze(this.switch);
39
- return;
18
+ else {
19
+ throw new Error(`Invalid SwitchContextStepDescriptor: ${JSON.stringify(descriptor)}`);
40
20
  }
41
- if (findDescriptor.findType === domUtil_1.FindType.FIND_ONE) {
42
- this.switch = {
43
- frame: findDescriptor,
44
- find: findDescriptor,
45
- descriptorToActionMap: new Map().set(findDescriptor, this.findAction),
46
- actionCode: this.actionCode,
47
- };
48
- Object.freeze(this.switch);
49
- return;
21
+ if (descriptor.find) {
22
+ this.findAction = FindAction_1.FindAction.findActionFromStepArgs(descriptor);
23
+ this.findAction.setActionSourceIndexInStep(0);
50
24
  }
51
- throw new Error(`Unexpected find type for ${name} step: ${findDescriptor.findType}`);
52
25
  }
53
26
  validate() {
54
27
  if (this.actions.length === 0 ||
@@ -57,55 +30,22 @@ class SwitchContextStep extends MablStep_1.MablStep {
57
30
  }
58
31
  }
59
32
  getStepName() {
60
- return 'SwitchContext';
33
+ return SwitchContextStep.stepName;
61
34
  }
62
35
  toStepDescriptor() {
63
- return this.switch;
64
- }
65
- getFormattedStep() {
66
- const step = this.toStepDescriptor();
67
- const stepName = this.getStepName();
68
- const formatted = {
69
- [stepName]: {},
70
- };
71
- if (this.annotationsOnStep()) {
72
- formatted[stepName].annotation = this.annotation;
73
- }
74
- if (this.description) {
75
- formatted[stepName].description = this.description;
76
- }
77
- if ((0, SwitchContextStepDescriptor_1.isSwitchTab)(step)) {
78
- formatted[stepName].findType = 'FindTab';
79
- formatted[stepName].selector = step.tab.findTarget;
80
- }
81
- if ((0, SwitchContextStepDescriptor_1.isSwitchFrame)(step)) {
82
- formatted[stepName].selector = step.frame.findTarget.selector;
83
- if (step.frame.findTarget.auxiliaryDescriptors?.length) {
84
- formatted[stepName].selectorAncestors =
85
- step.frame.findTarget.auxiliaryDescriptors.map((descriptor) => descriptor.selector);
86
- }
87
- }
88
- if ((0, SwitchContextStepDescriptor_1.isSwitchRoot)(step) && step.frame === 'root') {
89
- formatted[stepName].switch = 'root';
90
- }
91
- if (this.stepId()) {
92
- formatted[stepName].id = this.stepId();
93
- }
94
- return formatted;
36
+ return buildStepDescriptor(this.findAction);
95
37
  }
96
38
  static fromYaml(_stepName, stepArgs) {
97
- let step;
98
39
  if (stepArgs.switch) {
99
- step = new SwitchContextStep('switch_context_to', [stepArgs.switch], []);
40
+ return SwitchContextStep.fromLegacyMablscript([stepArgs.switch], []);
100
41
  }
101
- else {
102
- step = new SwitchContextStep('switch_context_to', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
42
+ else if (stepArgs.selector) {
43
+ return SwitchContextStep.fromLegacyMablscript([], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
103
44
  }
104
- step.setStepId(stepArgs.id);
105
- return step;
45
+ return new SwitchContextStep(stepArgs);
106
46
  }
107
47
  toMablscript() {
108
- if ((0, SwitchContextStepDescriptor_1.isSwitchRoot)(this.switch) && this.switch.frame === 'root') {
48
+ if ((0, SwitchContextStepDescriptor_1.isSwitchRoot)(this.descriptor) && this.descriptor.frame === 'root') {
109
49
  return 'switch_context_to("root")';
110
50
  }
111
51
  return `${this.findAction?.toMablscript()}.switch_context_to()`;
@@ -113,7 +53,73 @@ class SwitchContextStep extends MablStep_1.MablStep {
113
53
  getInputVariables() {
114
54
  return this.findAction?.getInputVariables() ?? [];
115
55
  }
56
+ stepDescription() {
57
+ if ((0, SwitchContextStepDescriptor_1.isSwitchRoot)(this.descriptor) && this.descriptor.frame === 'root') {
58
+ return 'Switch context to the root frame';
59
+ }
60
+ if (this.findAction) {
61
+ const findDescriptor = this.findAction.toDescriptor();
62
+ if (findDescriptor.findType === domUtil_1.FindType.FIND_TAB) {
63
+ if (typeof findDescriptor.findTarget === 'string') {
64
+ return `Switch context to ${findDescriptor.findTarget} tab`;
65
+ }
66
+ return `Switch context to ${(0, mablscriptFind_1.humanizeTabSelector)(findDescriptor.findTarget)}`;
67
+ }
68
+ else if (findDescriptor.findType === domUtil_1.FindType.FIND_ONE) {
69
+ return `Switch context to ${(0, mablscriptFind_1.humanizeFindOneDescriptor)(findDescriptor.findTarget)}`;
70
+ }
71
+ }
72
+ return 'Switch context';
73
+ }
74
+ static fromLegacyMablscript(args, actions) {
75
+ const maybeRoot = args[0];
76
+ if (maybeRoot !== undefined && maybeRoot !== 'root') {
77
+ throw new Error(`Unexpected argument for ${name} step: ${JSON.stringify(maybeRoot)}`);
78
+ }
79
+ if (maybeRoot === 'root') {
80
+ return new SwitchContextStep({
81
+ frame: 'root',
82
+ });
83
+ }
84
+ if (actions.length !== 1) {
85
+ throw new Error(`No find action for ${name} step`);
86
+ }
87
+ const findAction = new FindAction_1.FindAction(actions[0].name, actions[0].args);
88
+ if (actions[0].actionSourceIndexInStep !== undefined) {
89
+ findAction.setActionSourceIndexInStep(actions[0].actionSourceIndexInStep);
90
+ }
91
+ const stepDescriptor = buildStepDescriptor(findAction);
92
+ return new SwitchContextStep(stepDescriptor);
93
+ }
116
94
  }
117
95
  exports.SwitchContextStep = SwitchContextStep;
118
- SwitchContextStep.mablScriptStepNames = ['switch_context_to'];
119
- SwitchContextStep.yamlMablScriptNames = ['SwitchContext'];
96
+ SwitchContextStep.stepName = 'SwitchContext';
97
+ SwitchContextStep.actionCode = 'switch_context_to';
98
+ SwitchContextStep.mablScriptStepNames = [SwitchContextStep.actionCode];
99
+ SwitchContextStep.yamlMablScriptNames = [SwitchContextStep.stepName];
100
+ function buildStepDescriptor(findAction) {
101
+ if (!findAction) {
102
+ return {
103
+ frame: 'root',
104
+ actionCode: SwitchContextStep.actionCode,
105
+ };
106
+ }
107
+ const findDescriptor = findAction.toDescriptor();
108
+ if (findDescriptor.findType === domUtil_1.FindType.FIND_TAB) {
109
+ return {
110
+ tab: findDescriptor,
111
+ find: findDescriptor,
112
+ descriptorToActionMap: new Map().set(findDescriptor, findAction),
113
+ actionCode: SwitchContextStep.actionCode,
114
+ };
115
+ }
116
+ if (findDescriptor.findType === domUtil_1.FindType.FIND_ONE) {
117
+ return {
118
+ frame: findDescriptor,
119
+ find: findDescriptor,
120
+ descriptorToActionMap: new Map().set(findDescriptor, findAction),
121
+ actionCode: SwitchContextStep.actionCode,
122
+ };
123
+ }
124
+ throw new Error(`Unexpected find type for SwitchContext step: ${findDescriptor.findType}`);
125
+ }
@@ -4,7 +4,7 @@ exports.SyntheticStep = exports.DEFAULT_STEP_SOURCE_INDEX_IN_FLOW = void 0;
4
4
  const MablStep_1 = require("../MablStep");
5
5
  exports.DEFAULT_STEP_SOURCE_INDEX_IN_FLOW = -1;
6
6
  class SyntheticStep extends MablStep_1.MablStep {
7
- constructor(name, args = [], actions = [], stepSourceIndexInFlow = exports.DEFAULT_STEP_SOURCE_INDEX_IN_FLOW) {
7
+ constructor(name, args, actions, stepSourceIndexInFlow = exports.DEFAULT_STEP_SOURCE_INDEX_IN_FLOW) {
8
8
  super(name, args, actions, name);
9
9
  this.stepSourceIndexInFlow = stepSourceIndexInFlow;
10
10
  this.actionSourceIndexInStep = 0;
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VisitUrlStep = void 0;
4
- const MablStep_1 = require("../MablStep");
5
4
  const MablAction_1 = require("../MablAction");
6
5
  const domUtil_1 = require("../../domUtil");
7
- class VisitUrlStep extends MablStep_1.MablStep {
8
- constructor(name, args, actions) {
9
- super(name, args, actions, 'visit_url');
10
- const arg = this.getActionArgs()[0];
11
- this.url = VisitUrlStep.normalizeUrl(arg);
6
+ const MablStepV2_1 = require("../MablStepV2");
7
+ class VisitUrlStep extends MablStepV2_1.MablStepV2 {
8
+ constructor(descriptor) {
9
+ descriptor.url = VisitUrlStep.sanitizeUrl(descriptor.url);
10
+ super(VisitUrlStep.stepName, descriptor, VisitUrlStep.actionCode);
11
+ this.url = descriptor.url;
12
12
  }
13
13
  getStepName() {
14
- return 'VisitUrl';
14
+ return VisitUrlStep.stepName;
15
15
  }
16
16
  toStepDescriptor() {
17
17
  return {
@@ -19,10 +19,14 @@ class VisitUrlStep extends MablStep_1.MablStep {
19
19
  actionCode: this.actionCode,
20
20
  };
21
21
  }
22
- static fromYaml(_stepName, stepArgs) {
23
- const step = new VisitUrlStep('visit_url', [stepArgs.url], []);
24
- step.setStepId(stepArgs.id);
25
- return step;
22
+ static fromYaml(_stepName, stepDescriptor) {
23
+ return new VisitUrlStep(stepDescriptor);
24
+ }
25
+ static fromLegacyMablscript(args, _actions) {
26
+ const stepDescriptor = {
27
+ url: VisitUrlStep.sanitizeUrl(args[0]),
28
+ };
29
+ return new VisitUrlStep(stepDescriptor);
26
30
  }
27
31
  toMablscript() {
28
32
  const resolvedUrl = this.substituteMablscriptVariable((0, domUtil_1.escapeMablscriptString)(this.url.toString()));
@@ -34,27 +38,29 @@ class VisitUrlStep extends MablStep_1.MablStep {
34
38
  getInputVariables() {
35
39
  return MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.url);
36
40
  }
37
- static normalizeUrl(param) {
41
+ stepDescription() {
42
+ const inputVariables = this.getInputVariables();
43
+ if (inputVariables.length > 0) {
44
+ const variableName = inputVariables[0];
45
+ return `Visit URL assigned to variable "${variableName}"`;
46
+ }
47
+ return `Visit URL "${this.url}"`;
48
+ }
49
+ static sanitizeUrl(param) {
38
50
  const trimmed = param.trim();
39
- if (param === '') {
51
+ if (trimmed === '') {
40
52
  throw new Error('Missing URL');
41
53
  }
42
- if (trimmed.indexOf('{{@') >= 0) {
43
- return trimmed;
44
- }
45
54
  if (trimmed.indexOf('[not yet evaluated]') >= 0) {
46
55
  throw new Error('Unresolved variable found in URL');
47
56
  }
48
- if (/^http[s]?:\/\//.test(trimmed)) {
49
- return trimmed;
50
- }
51
57
  if (VisitUrlStep.isFileUrl(trimmed)) {
52
58
  if (VisitUrlStep.isTestOverride()) {
53
59
  return trimmed;
54
60
  }
55
61
  throw new Error('Access to local files is not permitted');
56
62
  }
57
- return `http://${trimmed}`;
63
+ return trimmed;
58
64
  }
59
65
  static isTestOverride() {
60
66
  return process.env.MABL_SIMULATION === 'mabl-local-testing';
@@ -64,5 +70,7 @@ class VisitUrlStep extends MablStep_1.MablStep {
64
70
  }
65
71
  }
66
72
  exports.VisitUrlStep = VisitUrlStep;
67
- VisitUrlStep.mablScriptStepNames = ['visit_url'];
68
- VisitUrlStep.yamlMablScriptNames = ['VisitUrl'];
73
+ VisitUrlStep.stepName = 'VisitUrl';
74
+ VisitUrlStep.actionCode = 'visit_url';
75
+ VisitUrlStep.mablScriptStepNames = [VisitUrlStep.actionCode];
76
+ VisitUrlStep.yamlMablScriptNames = [VisitUrlStep.stepName];
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WaitStep = void 0;
4
- const MablStep_1 = require("../MablStep");
5
- class WaitStep extends MablStep_1.MablStep {
6
- constructor(name, args, actions) {
7
- super(name, args, actions, 'wait');
8
- this.milliseconds = WaitStep.validateWait(this.getActionArgs()[0]);
4
+ const MablStepV2_1 = require("../MablStepV2");
5
+ class WaitStep extends MablStepV2_1.MablStepV2 {
6
+ constructor(descriptor) {
7
+ super(WaitStep.stepName, descriptor, WaitStep.actionCode);
8
+ this.milliseconds = descriptor.milliseconds;
9
9
  }
10
10
  getStepName() {
11
11
  return WaitStep.stepName;
@@ -17,13 +17,23 @@ class WaitStep extends MablStep_1.MablStep {
17
17
  };
18
18
  }
19
19
  static fromYaml(_stepName, stepArgs) {
20
- const step = new WaitStep(WaitStep.stepName, [stepArgs.milliseconds], []);
21
- step.setStepId(stepArgs.id);
22
- return step;
20
+ const stepDescriptor = {
21
+ milliseconds: WaitStep.validateWait(stepArgs.milliseconds),
22
+ };
23
+ return new WaitStep(stepDescriptor);
24
+ }
25
+ static fromLegacyMablscript(args, _actions) {
26
+ const stepDescriptor = {
27
+ milliseconds: WaitStep.validateWait(args[0]),
28
+ };
29
+ return new WaitStep(stepDescriptor);
23
30
  }
24
31
  toMablscript() {
25
32
  return `wait(${this.milliseconds})`;
26
33
  }
34
+ stepDescription() {
35
+ return `Wait for ${this.milliseconds / 1000} seconds`;
36
+ }
27
37
  static validateWait(wait) {
28
38
  if (typeof wait !== 'number') {
29
39
  throw new Error(`Invalid wait argument [${wait}]`);
@@ -33,5 +43,6 @@ class WaitStep extends MablStep_1.MablStep {
33
43
  }
34
44
  exports.WaitStep = WaitStep;
35
45
  WaitStep.stepName = 'Wait';
36
- WaitStep.mablScriptStepNames = ['wait'];
46
+ WaitStep.actionCode = 'wait';
47
+ WaitStep.mablScriptStepNames = [WaitStep.actionCode];
37
48
  WaitStep.yamlMablScriptNames = [WaitStep.stepName];
@@ -3,18 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WaitUntilStep = void 0;
4
4
  const domUtil_1 = require("../../domUtil");
5
5
  const MablStepWithFindAction_1 = require("../MablStepWithFindAction");
6
+ const ActionsUtils_1 = require("./ActionsUtils");
6
7
  class WaitUntilStep extends MablStepWithFindAction_1.MablStepWithFindAction {
7
- constructor(name, args, actions) {
8
- super(name, args, actions, 'wait_until');
9
- if ((0, domUtil_1.isFindElementType)(this.actions[0].getActionName())) {
10
- this.findAction = this.actions[0];
11
- }
12
- else {
13
- throw new Error(`Unexpected find action for ${name} step: ${JSON.stringify(this.actions[0])}`);
14
- }
8
+ constructor(descriptor, findAction) {
9
+ super(WaitUntilStep.stepName, descriptor, WaitUntilStep.actionCode, findAction);
15
10
  }
16
11
  getStepName() {
17
- return 'WaitUntil';
12
+ return WaitUntilStep.stepName;
18
13
  }
19
14
  toStepDescriptor() {
20
15
  const find = this.findAction.toDescriptor();
@@ -29,10 +24,13 @@ class WaitUntilStep extends MablStepWithFindAction_1.MablStepWithFindAction {
29
24
  throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType} is not supported`);
30
25
  }
31
26
  }
32
- static fromYaml(_stepName, stepArgs) {
33
- const step = new WaitUntilStep('wait', [], []);
34
- step.setStepId(stepArgs.id);
35
- return step;
27
+ static fromYaml(_stepName, _stepArgs) {
28
+ throw new Error('YAML support for WaitUntilStep is not yet implemented');
29
+ }
30
+ static fromLegacyMablscript(_args, actions) {
31
+ const findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(actions);
32
+ const stepDescriptor = buildStepDescriptor(findAction);
33
+ return new WaitUntilStep(stepDescriptor, findAction);
36
34
  }
37
35
  toMablscript() {
38
36
  return `${this.findAction.toMablscript()}.evaluate_presence("present").assert()`;
@@ -40,7 +38,26 @@ class WaitUntilStep extends MablStepWithFindAction_1.MablStepWithFindAction {
40
38
  getInputVariables() {
41
39
  return this.findAction.getInputVariables();
42
40
  }
41
+ stepDescription() {
42
+ const elementDescription = this.humanizeFind();
43
+ return `Wait until ${elementDescription} is present`;
44
+ }
43
45
  }
44
46
  exports.WaitUntilStep = WaitUntilStep;
47
+ WaitUntilStep.stepName = 'WaitUntil';
48
+ WaitUntilStep.actionCode = 'wait_until';
45
49
  WaitUntilStep.mablScriptStepNames = [];
46
- WaitUntilStep.yamlMablScriptNames = ['WaitUntil'];
50
+ WaitUntilStep.yamlMablScriptNames = [WaitUntilStep.stepName];
51
+ function buildStepDescriptor(findAction) {
52
+ const find = findAction.toDescriptor();
53
+ switch (find.findType) {
54
+ case domUtil_1.FindType.FIND_ONE:
55
+ return {
56
+ find,
57
+ descriptorToActionMap: new Map().set(find, findAction),
58
+ actionCode: WaitUntilStep.actionCode,
59
+ };
60
+ default:
61
+ throw new Error(`Error generating step descriptor for ${WaitUntilStep.stepName}: Unexpected find type ${find.findType} is not supported`);
62
+ }
63
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -9,6 +9,7 @@ exports.isPresenceCondition = isPresenceCondition;
9
9
  exports.isAIPromptCondition = isAIPromptCondition;
10
10
  exports.isAbsenceExpected = isAbsenceExpected;
11
11
  exports.getAssertionConditionFieldFromDescriptor = getAssertionConditionFieldFromDescriptor;
12
+ const MablSymbol_1 = require("../MablSymbol");
12
13
  var ConditionType;
13
14
  (function (ConditionType) {
14
15
  ConditionType["AIPrompt"] = "ai_prompt";
@@ -52,13 +53,12 @@ function getOptionalComparisonType(descriptor) {
52
53
  return undefined;
53
54
  }
54
55
  function getOptionalComparatorValue(descriptor) {
55
- if (descriptor === undefined) {
56
+ if (descriptor?.conditionType !== ConditionType.Comparison) {
56
57
  return undefined;
57
58
  }
58
- if (descriptor.conditionType === ConditionType.Comparison) {
59
- return descriptor.comparatorValue.toString();
60
- }
61
- return undefined;
59
+ return (0, MablSymbol_1.isMablSymbolObject)(descriptor.comparatorValue)
60
+ ? `{{@${descriptor.comparatorValue.name}}}`
61
+ : descriptor.comparatorValue;
62
62
  }
63
63
  function getOptionalConditionOptions(descriptor) {
64
64
  if (descriptor === undefined ||
@@ -2,15 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GET_VARIABLE_VALUE = void 0;
4
4
  exports.isGetVariableDescriptor = isGetVariableDescriptor;
5
- exports.newGetVariableDescriptor = newGetVariableDescriptor;
6
- exports.convertGetVariableDescriptorToYaml = convertGetVariableDescriptorToYaml;
7
5
  exports.GET_VARIABLE_VALUE = 'GetVariable';
8
6
  function isGetVariableDescriptor(value) {
9
7
  return value.kind === exports.GET_VARIABLE_VALUE;
10
8
  }
11
- function newGetVariableDescriptor(variable) {
12
- return { kind: exports.GET_VARIABLE_VALUE, variable };
13
- }
14
- function convertGetVariableDescriptorToYaml(descriptor) {
15
- return { ...descriptor, variable: descriptor.variable.toString() };
16
- }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mablhq/mabl-cli",
3
- "version": "2.71.0",
3
+ "version": "2.72.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "The official mabl command line interface tool",
6
6
  "main": "index.js",