@mablhq/mabl-cli 2.0.3 → 2.1.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 (79) hide show
  1. package/commands/tests/tests_cmds/run-mobile.js +1 -1
  2. package/commands/tests/tests_cmds/run.js +1 -1
  3. package/execution/index.js +5 -5
  4. package/http/MablHttpAgent.js +1 -4
  5. package/http/RequestFilteringHttpAgent.js +3 -3
  6. package/http/axiosProxyConfig.js +10 -7
  7. package/http/httpUtil.js +10 -6
  8. package/index.js +3 -2
  9. package/mablscript/MablAction.js +5 -1
  10. package/mablscript/MablStep.js +13 -3
  11. package/mablscript/MablStepV2.js +10 -4
  12. package/mablscript/actions/AwaitDownloadAction.js +1 -1
  13. package/mablscript/actions/ConditionAction.js +1 -1
  14. package/mablscript/actions/CountAction.js +1 -1
  15. package/mablscript/actions/ExtractAction.js +1 -1
  16. package/mablscript/actions/FindAction.js +1 -1
  17. package/mablscript/actions/GenerateEmailAddressAction.js +1 -1
  18. package/mablscript/actions/GenerateRandomStringAction.js +1 -1
  19. package/mablscript/actions/GetUrlAction.js +1 -1
  20. package/mablscript/actions/GetVariableValue.js +1 -1
  21. package/mablscript/actions/JavaScriptAction.js +6 -2
  22. package/mablscript/importer.js +3 -3
  23. package/mablscript/mobile/steps/CreateVariableMobileStep.js +1 -1
  24. package/mablscript/mobile/steps/EnterTextStep.js +2 -2
  25. package/mablscript/mobile/steps/NavigateBackStep.js +1 -1
  26. package/mablscript/mobile/steps/NavigateHomeStep.js +1 -1
  27. package/mablscript/mobile/steps/ScrollStep.js +1 -1
  28. package/mablscript/mobile/steps/SetOrientationStep.js +1 -1
  29. package/mablscript/mobile/steps/TapStep.js +2 -2
  30. package/mablscript/mobile/steps/actions/MobileFindAction.js +1 -1
  31. package/mablscript/mobile/steps/stepUtil.js +20 -17
  32. package/mablscript/mobile/tests/steps/CreateVariableMobileStep.mobiletest.js +13 -2
  33. package/mablscript/mobile/tests/steps/EnterTextStep.mobiletest.js +5 -0
  34. package/mablscript/mobile/tests/steps/NavigateBackStep.mobiletest.js +7 -2
  35. package/mablscript/mobile/tests/steps/NavigateHomeStep.mobiletest.js +7 -2
  36. package/mablscript/mobile/tests/steps/ScrollStep.mobiletest.js +9 -0
  37. package/mablscript/mobile/tests/steps/SetOrientationStep.mobiletest.js +5 -0
  38. package/mablscript/mobile/tests/steps/TapStep.mobiletest.js +4 -0
  39. package/mablscript/steps/AccessibilityCheck.js +20 -9
  40. package/mablscript/steps/AssertStep.js +6 -1
  41. package/mablscript/steps/AssertStepOld.js +5 -2
  42. package/mablscript/steps/AwaitTabStep.js +5 -2
  43. package/mablscript/steps/AwaitUploadsStep.js +6 -4
  44. package/mablscript/steps/ClearCookiesStep.js +6 -4
  45. package/mablscript/steps/ClickAndHoldStep.js +10 -3
  46. package/mablscript/steps/ClickStep.js +10 -3
  47. package/mablscript/steps/CreateVariableStep.js +16 -6
  48. package/mablscript/steps/DoubleClickStep.js +10 -3
  49. package/mablscript/steps/DownloadStep.js +4 -2
  50. package/mablscript/steps/EchoStep.js +5 -3
  51. package/mablscript/steps/ElseIfConditionStep.js +6 -2
  52. package/mablscript/steps/ElseStep.js +6 -4
  53. package/mablscript/steps/EndStep.js +6 -4
  54. package/mablscript/steps/EnterAuthCodeStep.js +10 -3
  55. package/mablscript/steps/EnterTextStep.js +8 -2
  56. package/mablscript/steps/EvaluateFlowStep.js +5 -2
  57. package/mablscript/steps/EvaluateJavaScriptStep.js +9 -3
  58. package/mablscript/steps/HoverStep.js +10 -3
  59. package/mablscript/steps/IfConditionStep.js +8 -2
  60. package/mablscript/steps/NavigateStep.js +5 -2
  61. package/mablscript/steps/OpenEmailStep.js +5 -2
  62. package/mablscript/steps/ReleaseStep.js +10 -3
  63. package/mablscript/steps/RemoveCookieStep.js +5 -2
  64. package/mablscript/steps/RightClickStep.js +10 -3
  65. package/mablscript/steps/SelectStep.js +9 -3
  66. package/mablscript/steps/SendHttpRequestStep.js +5 -2
  67. package/mablscript/steps/SendKeyStep.js +10 -3
  68. package/mablscript/steps/SetCookieStep.js +5 -2
  69. package/mablscript/steps/SetFilesStep.js +9 -3
  70. package/mablscript/steps/SetViewportStep.js +5 -3
  71. package/mablscript/steps/SwitchContextStep.js +14 -3
  72. package/mablscript/steps/SyntheticStep.js +1 -1
  73. package/mablscript/steps/VisitUrlStep.js +5 -2
  74. package/mablscript/steps/WaitStep.js +5 -2
  75. package/mablscript/steps/WaitUntilStep.js +6 -3
  76. package/observers/ObserverBase.js +9 -0
  77. package/observers/mockObserver.js +3 -3
  78. package/package.json +4 -4
  79. package/util/javaScriptStepMigration.js +1 -0
@@ -21,6 +21,7 @@ describe('EnterText steps parse correctly', () => {
21
21
  const enterTextStepDescriptor = {
22
22
  find,
23
23
  text: 'Mauro',
24
+ actionCode: 'enter_text',
24
25
  };
25
26
  const steps = [
26
27
  {
@@ -44,8 +45,10 @@ describe('EnterText steps parse correctly', () => {
44
45
  },
45
46
  };
46
47
  const enterTextStepDescriptor = {
48
+ id: 'TypingTypesForTypers',
47
49
  find,
48
50
  text: new MablSymbol_1.MablSymbol('user.input'),
51
+ actionCode: 'enter_text',
49
52
  };
50
53
  const steps = [
51
54
  {
@@ -58,11 +61,13 @@ describe('EnterText steps parse correctly', () => {
58
61
  'varInFind',
59
62
  'user.input',
60
63
  ]);
64
+ expect(enterTextStep.stepId()).toEqual(enterTextStepDescriptor.id);
61
65
  });
62
66
  it('Parses a WebView EnterText step with a Find One selector and a variable', () => {
63
67
  const enterTextStepDescriptor = {
64
68
  find: TestMobileFindDescriptors_1.iOSWebViewTextFieldMobileFindDescriptor,
65
69
  text: new MablSymbol_1.MablSymbol('user.input'),
70
+ actionCode: 'enter_text',
66
71
  };
67
72
  const steps = [
68
73
  {
@@ -4,17 +4,22 @@ const NavigateBackStep_1 = require("../../steps/NavigateBackStep");
4
4
  const StepTestsUtil_1 = require("../StepTestsUtil");
5
5
  describe('NavigateBack steps parse correctly', () => {
6
6
  it('Parses a NavigateBack step', () => {
7
- const navigateBackStepDescriptor = {};
7
+ const navigateBackStepDescriptor = {
8
+ actionCode: 'navigate_back',
9
+ id: 'WeHaveToGoBack',
10
+ };
8
11
  const steps = [
9
12
  {
10
13
  NavigateBack: navigateBackStepDescriptor,
11
14
  },
12
15
  ];
13
16
  (0, StepTestsUtil_1.parseAndValidateYamlConversion)(steps, NavigateBackStep_1.NavigateBackStep.stepName, navigateBackStepDescriptor);
17
+ const navBackStep = new NavigateBackStep_1.NavigateBackStep(navigateBackStepDescriptor);
18
+ expect(navBackStep.stepId()).toEqual(navigateBackStepDescriptor.id);
14
19
  });
15
20
  it('Humanizes a NavigateHome back', () => {
16
21
  const stepYaml = {
17
- NavigateBack: {},
22
+ NavigateBack: { actionCode: 'navigate_back' },
18
23
  };
19
24
  const step = (0, StepTestsUtil_1.loadRawStepIntoMablStep)(stepYaml);
20
25
  expect(step.stepDescription()).toEqual(`Navigate back`);
@@ -4,17 +4,22 @@ const NavigateHomeStep_1 = require("../../steps/NavigateHomeStep");
4
4
  const StepTestsUtil_1 = require("../StepTestsUtil");
5
5
  describe('NavigateHome steps parse correctly', () => {
6
6
  it('Parses a NavigateHome step', () => {
7
- const navigateHomeStepDescriptor = {};
7
+ const navigateHomeStepDescriptor = {
8
+ actionCode: 'navigate_home',
9
+ id: 'OhHomeLetMeComeHome',
10
+ };
8
11
  const steps = [
9
12
  {
10
13
  NavigateHome: navigateHomeStepDescriptor,
11
14
  },
12
15
  ];
13
16
  (0, StepTestsUtil_1.parseAndValidateYamlConversion)(steps, NavigateHomeStep_1.NavigateHomeStep.stepName, navigateHomeStepDescriptor);
17
+ const navHomeStep = new NavigateHomeStep_1.NavigateHomeStep(navigateHomeStepDescriptor);
18
+ expect(navHomeStep.stepId()).toEqual(navigateHomeStepDescriptor.id);
14
19
  });
15
20
  it('Humanizes a NavigateHome step', () => {
16
21
  const stepYaml = {
17
- NavigateHome: {},
22
+ NavigateHome: { actionCode: 'navigate_home' },
18
23
  };
19
24
  const step = (0, StepTestsUtil_1.loadRawStepIntoMablStep)(stepYaml);
20
25
  expect(step.stepDescription()).toEqual(`Navigate home`);
@@ -6,6 +6,7 @@ describe('Scroll steps parse correctly', () => {
6
6
  it('Parses a Scroll step', () => {
7
7
  const windowSize = { width: 1440, height: 2392 };
8
8
  const scrollStepDescriptor = {
9
+ id: 'scrolliePolieOlie',
9
10
  coordinates: {
10
11
  from: {
11
12
  xPercent: 1074 / windowSize.width,
@@ -16,6 +17,7 @@ describe('Scroll steps parse correctly', () => {
16
17
  yPercent: 100 / windowSize.height,
17
18
  },
18
19
  },
20
+ actionCode: 'scroll',
19
21
  };
20
22
  const steps = [
21
23
  {
@@ -23,6 +25,8 @@ describe('Scroll steps parse correctly', () => {
23
25
  },
24
26
  ];
25
27
  (0, StepTestsUtil_1.parseAndValidateYamlConversion)(steps, ScrollStep_1.ScrollStep.stepName, scrollStepDescriptor);
28
+ const scrollStep = new ScrollStep_1.ScrollStep(scrollStepDescriptor);
29
+ expect(scrollStep.stepId()).toEqual(scrollStepDescriptor.id);
26
30
  });
27
31
  it('Humanizes a scroll step', () => {
28
32
  const windowSize = { width: 1440, height: 2392 };
@@ -38,6 +42,7 @@ describe('Scroll steps parse correctly', () => {
38
42
  yPercent: 100 / windowSize.height,
39
43
  },
40
44
  },
45
+ actionCode: 'scroll',
41
46
  },
42
47
  };
43
48
  const step = (0, StepTestsUtil_1.loadRawStepIntoMablStep)(stepYaml);
@@ -56,6 +61,7 @@ describe('Scroll steps parse correctly', () => {
56
61
  yPercent: 0.865454,
57
62
  },
58
63
  },
64
+ actionCode: 'scroll',
59
65
  },
60
66
  };
61
67
  const scrollUpStep = (0, StepTestsUtil_1.loadRawStepIntoMablStep)(scrollUpStepYaml);
@@ -72,6 +78,7 @@ describe('Scroll steps parse correctly', () => {
72
78
  yPercent: 0.0874,
73
79
  },
74
80
  },
81
+ actionCode: 'scroll',
75
82
  },
76
83
  };
77
84
  const scrollDownStep = (0, StepTestsUtil_1.loadRawStepIntoMablStep)(scrollDownStepYaml);
@@ -88,6 +95,7 @@ describe('Scroll steps parse correctly', () => {
88
95
  yPercent: 0.4574,
89
96
  },
90
97
  },
98
+ actionCode: 'scroll',
91
99
  },
92
100
  };
93
101
  const swipeRightStep = (0, StepTestsUtil_1.loadRawStepIntoMablStep)(swipeRightStepYaml);
@@ -104,6 +112,7 @@ describe('Scroll steps parse correctly', () => {
104
112
  yPercent: 0.4574,
105
113
  },
106
114
  },
115
+ actionCode: 'scroll',
107
116
  },
108
117
  };
109
118
  const swipeLeftStep = (0, StepTestsUtil_1.loadRawStepIntoMablStep)(swipeLeftStepYaml);
@@ -6,7 +6,9 @@ const StepTestsUtil_1 = require("../StepTestsUtil");
6
6
  describe('SetOrientation steps parse correctly', () => {
7
7
  it('Parses a SetOrientation step', () => {
8
8
  const setOrientationStepDescriptor = {
9
+ id: 'theOrientalExpress',
9
10
  orientation: SetOrientationStepDescriptor_1.Orientation.Landscape,
11
+ actionCode: 'set_orientation',
10
12
  };
11
13
  const steps = [
12
14
  {
@@ -14,11 +16,14 @@ describe('SetOrientation steps parse correctly', () => {
14
16
  },
15
17
  ];
16
18
  (0, StepTestsUtil_1.parseAndValidateYamlConversion)(steps, SetOrientationStep_1.SetOrientationStep.stepName, setOrientationStepDescriptor);
19
+ const orientationStep = new SetOrientationStep_1.SetOrientationStep(setOrientationStepDescriptor);
20
+ expect(orientationStep.stepId()).toEqual(setOrientationStepDescriptor.id);
17
21
  });
18
22
  it('Humanizes a SetOrientation step', () => {
19
23
  const stepYaml = {
20
24
  SetOrientation: {
21
25
  orientation: SetOrientationStepDescriptor_1.Orientation.Landscape,
26
+ actionCode: 'set_orientation',
22
27
  },
23
28
  };
24
29
  const step = (0, StepTestsUtil_1.loadRawStepIntoMablStep)(stepYaml);
@@ -19,8 +19,10 @@ describe('Tap steps parse correctly', () => {
19
19
  },
20
20
  };
21
21
  const stepDescriptor = {
22
+ id: 'TappyMcTapperson',
22
23
  find,
23
24
  type: TapStepDescriptor_1.TapType.tap,
25
+ actionCode: 'tap',
24
26
  };
25
27
  const steps = [
26
28
  {
@@ -29,12 +31,14 @@ describe('Tap steps parse correctly', () => {
29
31
  ];
30
32
  (0, StepTestsUtil_1.parseAndValidateYamlConversion)(steps, TapStep_1.TapStep.stepName, stepDescriptor);
31
33
  const tapStep = new TapStep_1.TapStep(stepDescriptor);
34
+ expect(tapStep.stepId()).toEqual(stepDescriptor.id);
32
35
  expect(tapStep.getInputVariables()).toStrictEqual(['varInFind']);
33
36
  });
34
37
  it('Parses a WebView Tap step', () => {
35
38
  const stepDescriptor = {
36
39
  find: TestMobileFindDescriptors_1.iOSWebViewTextFieldMobileFindDescriptor,
37
40
  type: TapStepDescriptor_1.TapType.tap,
41
+ actionCode: 'tap',
38
42
  };
39
43
  const steps = [
40
44
  {
@@ -14,7 +14,7 @@ var AccessibilityCheckSeverity;
14
14
  })(AccessibilityCheckSeverity = exports.AccessibilityCheckSeverity || (exports.AccessibilityCheckSeverity = {}));
15
15
  class AccessibilityCheckStep extends MablStep_1.MablStep {
16
16
  constructor(name, args, actions) {
17
- super(name, args, actions);
17
+ super(name, args, actions, 'accessibility_check');
18
18
  if (this.actions.length) {
19
19
  this.findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(this.actions);
20
20
  }
@@ -40,6 +40,7 @@ class AccessibilityCheckStep extends MablStep_1.MablStep {
40
40
  ...this.checkConfig,
41
41
  find,
42
42
  descriptorToActionMap: new Map().set(find, this),
43
+ actionCode: this.actionCode,
43
44
  };
44
45
  default:
45
46
  throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
@@ -50,11 +51,13 @@ class AccessibilityCheckStep extends MablStep_1.MablStep {
50
51
  rules: (_b = this.checkConfig) === null || _b === void 0 ? void 0 : _b.rules,
51
52
  disabledRules: (_c = this.checkConfig) === null || _c === void 0 ? void 0 : _c.disabledRules,
52
53
  failOn: (_d = this.checkConfig) === null || _d === void 0 ? void 0 : _d.failOn,
54
+ actionCode: this.actionCode,
53
55
  };
54
56
  }
55
57
  getFormattedStep(_fullLocatorsOn) {
58
+ let finalStep;
56
59
  if (this.findAction) {
57
- return {
60
+ finalStep = {
58
61
  AccessibilityCheck: {
59
62
  ...super.annotationsAsYml(),
60
63
  ...this.findAction.toYaml(),
@@ -62,12 +65,18 @@ class AccessibilityCheckStep extends MablStep_1.MablStep {
62
65
  },
63
66
  };
64
67
  }
65
- return {
66
- AccessibilityCheck: {
67
- ...super.annotationsAsYml(),
68
- ...this.checkConfig,
69
- },
70
- };
68
+ else {
69
+ finalStep = {
70
+ AccessibilityCheck: {
71
+ ...super.annotationsAsYml(),
72
+ ...this.checkConfig,
73
+ },
74
+ };
75
+ }
76
+ if (this.stepId()) {
77
+ finalStep.AccessibilityCheck.id = this.stepId();
78
+ }
79
+ return finalStep;
71
80
  }
72
81
  static fromYaml(_stepName, stepArgs) {
73
82
  const actions = [];
@@ -80,7 +89,9 @@ class AccessibilityCheckStep extends MablStep_1.MablStep {
80
89
  disabledRules: stepArgs.disabledRules,
81
90
  failOn: stepArgs.failOn,
82
91
  };
83
- return new AccessibilityCheckStep(AccessibilityCheckStep.mablScriptStepNames[0], [checkConfig], actions);
92
+ const step = new AccessibilityCheckStep(AccessibilityCheckStep.mablScriptStepNames[0], [checkConfig], actions);
93
+ step.setStepId(stepArgs.id);
94
+ return step;
84
95
  }
85
96
  toMablscript() {
86
97
  var _a, _b, _c;
@@ -45,7 +45,7 @@ Object.entries(exports.assertionStepToField).forEach(([stepType, field]) => (exp
45
45
  class AssertStep extends MablStep_1.MablStep {
46
46
  constructor(name, args, actions) {
47
47
  var _a, _b;
48
- super(name, args, actions);
48
+ super(name, args, actions, 'assert');
49
49
  const firstAction = actions[0];
50
50
  if (firstAction instanceof FindAction_1.FindAction ||
51
51
  firstAction instanceof MobileFindAction_1.MobileFindAction ||
@@ -129,6 +129,7 @@ class AssertStep extends MablStep_1.MablStep {
129
129
  onFailure: this.onFailure,
130
130
  observationScope: this.observationScope,
131
131
  descriptorToActionMap,
132
+ actionCode: this.actionCode,
132
133
  };
133
134
  }
134
135
  getFormattedStep(_fullLocatorsOn) {
@@ -163,6 +164,9 @@ class AssertStep extends MablStep_1.MablStep {
163
164
  }
164
165
  result[this.getStepName()] =
165
166
  MablStep_1.MablStep.cloneAndRemoveUndefinedEntriesFromObject(formatted);
167
+ if (this.stepId()) {
168
+ result[this.getStepName()].id = this.stepId();
169
+ }
166
170
  return result;
167
171
  }
168
172
  static fromYaml(stepName, stepArgs) {
@@ -223,6 +227,7 @@ class AssertStep extends MablStep_1.MablStep {
223
227
  if (stepArgs.annotation) {
224
228
  assertStep.setAnnotation(stepArgs.annotation);
225
229
  }
230
+ assertStep.setStepId(stepArgs.id);
226
231
  return assertStep;
227
232
  }
228
233
  toMablscript() {
@@ -27,7 +27,7 @@ const oldToNewAssertionTypes = {
27
27
  };
28
28
  class AssertStepOld extends MablStep_1.MablStep {
29
29
  constructor(name, args, actions) {
30
- super(name, args, actions);
30
+ super(name, args, actions, name);
31
31
  this.assertionType = '';
32
32
  this.assertAttribute = '';
33
33
  this.validate();
@@ -127,6 +127,9 @@ class AssertStepOld extends MablStep_1.MablStep {
127
127
  onFailure: this.onFailure,
128
128
  observationScope: this.observationScope,
129
129
  };
130
+ if (this.stepId()) {
131
+ result[this.getStepName()].id = this.stepId();
132
+ }
130
133
  return result;
131
134
  }
132
135
  getNewAssertionStep() {
@@ -145,7 +148,7 @@ class AssertStepOld extends MablStep_1.MablStep {
145
148
  return result;
146
149
  }
147
150
  static fromYaml(stepName, _stepArgs) {
148
- return new MablStep_1.MablStep(stepName, [], []);
151
+ return new MablStep_1.MablStep(stepName, [], [], 'assert');
149
152
  }
150
153
  }
151
154
  exports.AssertStepOld = AssertStepOld;
@@ -5,7 +5,7 @@ const domUtil_1 = require("../../domUtil");
5
5
  const MablStep_1 = require("../MablStep");
6
6
  class AwaitTabStep extends MablStep_1.MablStep {
7
7
  constructor(name, args, actions) {
8
- super(name, args, actions);
8
+ super(name, args, actions, 'await_tab');
9
9
  this.tab = this.getActionArgs()[0];
10
10
  }
11
11
  getStepName() {
@@ -14,10 +14,13 @@ class AwaitTabStep extends MablStep_1.MablStep {
14
14
  toStepDescriptor() {
15
15
  return {
16
16
  tab: this.tab,
17
+ actionCode: this.actionCode,
17
18
  };
18
19
  }
19
20
  static fromYaml(_stepName, stepArgs) {
20
- return new AwaitTabStep('await_tab', [stepArgs.tab], []);
21
+ const step = new AwaitTabStep('await_tab', [stepArgs.tab], []);
22
+ step.setStepId(stepArgs.id);
23
+ return step;
21
24
  }
22
25
  toMablscript() {
23
26
  const mablscriptSelectorChunks = ['selector_type: "tab"'];
@@ -4,16 +4,18 @@ exports.AwaitUploadsStep = void 0;
4
4
  const MablStep_1 = require("../MablStep");
5
5
  class AwaitUploadsStep extends MablStep_1.MablStep {
6
6
  constructor(name, args, actions) {
7
- super(name, args, actions);
7
+ super(name, args, actions, 'await_uploads');
8
8
  }
9
9
  getStepName() {
10
10
  return 'AwaitUploads';
11
11
  }
12
12
  toStepDescriptor() {
13
- return {};
13
+ return { actionCode: this.actionCode };
14
14
  }
15
- static fromYaml(_stepName, _stepArgs) {
16
- return new AwaitUploadsStep('await_uploads', [], []);
15
+ static fromYaml(_stepName, stepArgs) {
16
+ const step = new AwaitUploadsStep('await_uploads', [], []);
17
+ step.setStepId(stepArgs.id);
18
+ return step;
17
19
  }
18
20
  toMablscript() {
19
21
  return `await_uploads()`;
@@ -4,16 +4,18 @@ exports.ClearCookiesStep = void 0;
4
4
  const MablStep_1 = require("../MablStep");
5
5
  class ClearCookiesStep extends MablStep_1.MablStep {
6
6
  constructor(name, args, actions) {
7
- super(name, args, actions);
7
+ super(name, args, actions, 'clear_cookies');
8
8
  }
9
9
  getStepName() {
10
10
  return 'ClearCookies';
11
11
  }
12
12
  toStepDescriptor() {
13
- return {};
13
+ return { actionCode: this.actionCode };
14
14
  }
15
- static fromYaml(_stepName, _stepArgs) {
16
- return new ClearCookiesStep('clear_cookies', [], []);
15
+ static fromYaml(_stepName, stepArgs) {
16
+ const step = new ClearCookiesStep('clear_cookies', [], []);
17
+ step.setStepId(stepArgs.id);
18
+ return step;
17
19
  }
18
20
  toMablscript() {
19
21
  return `clear_cookies()`;
@@ -8,7 +8,7 @@ const ActionsUtils_1 = require("./ActionsUtils");
8
8
  class ClickAndHoldStep extends MablStep_1.MablStep {
9
9
  constructor(name, args, actions) {
10
10
  var _a;
11
- super(name, args, actions);
11
+ super(name, args, actions, 'click_and_hold');
12
12
  this.findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(this.actions);
13
13
  this.clickArgs = (_a = this.parseArgs(args)) !== null && _a !== void 0 ? _a : { isHtml5: false };
14
14
  }
@@ -38,21 +38,28 @@ class ClickAndHoldStep extends MablStep_1.MablStep {
38
38
  find,
39
39
  isHtml5: this.clickArgs.isHtml5,
40
40
  descriptorToActionMap: new Map().set(find, this.findAction),
41
+ actionCode: this.actionCode,
41
42
  };
42
43
  default:
43
44
  throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
44
45
  }
45
46
  }
46
47
  getFormattedStep(_fullLocatorsOn) {
47
- return {
48
+ const step = {
48
49
  ClickAndHold: {
49
50
  ...super.annotationsAsYml(),
50
51
  ...this.findAction.toYaml(),
51
52
  },
52
53
  };
54
+ if (this.stepId()) {
55
+ step.ClickAndHold.id = this.stepId();
56
+ }
57
+ return step;
53
58
  }
54
59
  static fromYaml(_stepName, stepArgs) {
55
- return new ClickAndHoldStep('click_and_hold', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
60
+ const step = new ClickAndHoldStep('click_and_hold', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
61
+ step.setStepId(stepArgs.id);
62
+ return step;
56
63
  }
57
64
  toMablscript() {
58
65
  return `${this.findAction.toMablscript()}.click_and_hold({isHtml5:${this.clickArgs.isHtml5}})`;
@@ -7,7 +7,7 @@ const domUtil_1 = require("../../domUtil");
7
7
  const ActionsUtils_1 = require("./ActionsUtils");
8
8
  class ClickStep extends MablStep_1.MablStep {
9
9
  constructor(name, args, actions) {
10
- super(name, args, actions);
10
+ super(name, args, actions, 'click');
11
11
  this.findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(this.actions);
12
12
  }
13
13
  getStepName() {
@@ -23,21 +23,28 @@ class ClickStep extends MablStep_1.MablStep {
23
23
  return {
24
24
  find,
25
25
  descriptorToActionMap: new Map().set(find, this.findAction),
26
+ actionCode: this.actionCode,
26
27
  };
27
28
  default:
28
29
  throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
29
30
  }
30
31
  }
31
32
  getFormattedStep(_fullLocatorsOn) {
32
- return {
33
+ const step = {
33
34
  Click: {
34
35
  ...super.annotationsAsYml(),
35
36
  ...this.findAction.toYaml(),
36
37
  },
37
38
  };
39
+ if (this.stepId()) {
40
+ step.Click.id = this.stepId();
41
+ }
42
+ return step;
38
43
  }
39
44
  static fromYaml(_stepName, stepArgs) {
40
- return new ClickStep('click', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
45
+ const step = new ClickStep('click', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
46
+ step.setStepId(stepArgs.id);
47
+ return step;
41
48
  }
42
49
  toMablscript() {
43
50
  return `${this.findAction.toMablscript()}.click()`;
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isCreateVariableStep = exports.CreateVariableStep = void 0;
4
+ const domUtil_1 = require("../../domUtil");
5
+ const CountAction_1 = require("../actions/CountAction");
4
6
  const ExtractAction_1 = require("../actions/ExtractAction");
5
- const MablStep_1 = require("../MablStep");
6
7
  const FindAction_1 = require("../actions/FindAction");
7
8
  const GenerateEmailAddressAction_1 = require("../actions/GenerateEmailAddressAction");
8
9
  const GenerateRandomStringAction_1 = require("../actions/GenerateRandomStringAction");
9
- const CreateVariableStepDescriptor_1 = require("../types/CreateVariableStepDescriptor");
10
- const domUtil_1 = require("../../domUtil");
11
10
  const JavaScriptAction_1 = require("../actions/JavaScriptAction");
12
- const CountAction_1 = require("../actions/CountAction");
11
+ const MablStep_1 = require("../MablStep");
12
+ const CreateVariableStepDescriptor_1 = require("../types/CreateVariableStepDescriptor");
13
13
  class CreateVariableStep extends MablStep_1.MablStep {
14
14
  constructor(name, args, actions) {
15
- super(name, args, actions);
15
+ super(name, args, actions, 'mablscript_as');
16
16
  this.variableName = this.getActionArgs()[0];
17
17
  this.generationType = this.calculateGenerationType();
18
18
  }
@@ -57,12 +57,14 @@ class CreateVariableStep extends MablStep_1.MablStep {
57
57
  },
58
58
  find,
59
59
  descriptorToActionMap: new Map().set(find, findAction),
60
+ actionCode: this.actionCode,
60
61
  };
61
62
  break;
62
63
  case CreateVariableStepDescriptor_1.VariableGenerator.EMAIL:
63
64
  step = {
64
65
  name: this.variableName,
65
66
  generator: { type: CreateVariableStepDescriptor_1.VariableGenerator.EMAIL },
67
+ actionCode: this.actionCode,
66
68
  };
67
69
  break;
68
70
  case CreateVariableStepDescriptor_1.VariableGenerator.JAVASCRIPT:
@@ -72,6 +74,7 @@ class CreateVariableStep extends MablStep_1.MablStep {
72
74
  type: CreateVariableStepDescriptor_1.VariableGenerator.JAVASCRIPT,
73
75
  javaScript: this.actions[0].javaScript,
74
76
  },
77
+ actionCode: this.actionCode,
75
78
  };
76
79
  break;
77
80
  case CreateVariableStepDescriptor_1.VariableGenerator.PATTERN:
@@ -82,6 +85,7 @@ class CreateVariableStep extends MablStep_1.MablStep {
82
85
  pattern: this.actions[0]
83
86
  .generateString,
84
87
  },
88
+ actionCode: this.actionCode,
85
89
  };
86
90
  break;
87
91
  case CreateVariableStepDescriptor_1.VariableGenerator.ELEMENT_COUNT:
@@ -95,6 +99,7 @@ class CreateVariableStep extends MablStep_1.MablStep {
95
99
  find: countFind,
96
100
  },
97
101
  descriptorToActionMap: new Map().set(countFind, countFindAction),
102
+ actionCode: this.actionCode,
98
103
  };
99
104
  break;
100
105
  }
@@ -148,6 +153,9 @@ class CreateVariableStep extends MablStep_1.MablStep {
148
153
  name: this.variableName,
149
154
  };
150
155
  }
156
+ if (this.stepId()) {
157
+ formatted[stepName].id = this.stepId();
158
+ }
151
159
  return formatted;
152
160
  }
153
161
  static fromYaml(_stepName, stepArgs) {
@@ -179,7 +187,9 @@ class CreateVariableStep extends MablStep_1.MablStep {
179
187
  ]));
180
188
  break;
181
189
  }
182
- return new CreateVariableStep('as', [variableName], actions);
190
+ const step = new CreateVariableStep('as', [variableName], actions);
191
+ step.setStepId(stepArgs.id);
192
+ return step;
183
193
  }
184
194
  toMablscript() {
185
195
  return `${this.actions.reduce((mablscript, action) => `${mablscript}${action.toMablscript()}.`, '')}as("${this.variableName}")`;
@@ -6,7 +6,7 @@ const FindAction_1 = require("../actions/FindAction");
6
6
  const domUtil_1 = require("../../domUtil");
7
7
  class DoubleClickStep extends MablStep_1.MablStep {
8
8
  constructor(name, args, actions) {
9
- super(name, args, actions);
9
+ super(name, args, actions, 'double_click');
10
10
  this.validate();
11
11
  this.findAction = this.actions[0];
12
12
  }
@@ -29,21 +29,28 @@ class DoubleClickStep extends MablStep_1.MablStep {
29
29
  return {
30
30
  find,
31
31
  descriptorToActionMap: new Map().set(find, this.findAction),
32
+ actionCode: this.actionCode,
32
33
  };
33
34
  default:
34
35
  throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
35
36
  }
36
37
  }
37
38
  getFormattedStep(_fullLocatorsOn) {
38
- return {
39
+ const step = {
39
40
  DoubleClick: {
40
41
  ...super.annotationsAsYml(),
41
42
  ...this.findAction.toYaml(),
42
43
  },
43
44
  };
45
+ if (this.stepId()) {
46
+ step.DoubleClick.id = this.stepId();
47
+ }
48
+ return step;
44
49
  }
45
50
  static fromYaml(_stepName, stepArgs) {
46
- return new DoubleClickStep('double_click', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
51
+ const step = new DoubleClickStep('double_click', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
52
+ step.setStepId(stepArgs.id);
53
+ return step;
47
54
  }
48
55
  toMablscript() {
49
56
  return `${this.findAction.toMablscript()}.double_click()`;
@@ -9,7 +9,7 @@ const domUtil_1 = require("../../domUtil");
9
9
  class DownloadStep extends MablStep_1.MablStep {
10
10
  constructor(name, args, actions) {
11
11
  var _a;
12
- super(name, args, actions);
12
+ super(name, args, actions, 'assert_download');
13
13
  this.validate();
14
14
  this.fileAttributes = ((_a = this.getActionArgs()[0]) !== null && _a !== void 0 ? _a : {});
15
15
  this.awaitDownloadAction = this.actions[0];
@@ -76,7 +76,9 @@ class DownloadStep extends MablStep_1.MablStep {
76
76
  else {
77
77
  awaitDownloadAction = new AwaitDownloadAction_1.AwaitDownloadAction('await_download', []);
78
78
  }
79
- return new DownloadStep('assert_download', [fileAttributes], [awaitDownloadAction]);
79
+ const step = new DownloadStep('assert_download', [fileAttributes], [awaitDownloadAction]);
80
+ step.setStepId(stepArgs.id);
81
+ return step;
80
82
  }
81
83
  toMablscript() {
82
84
  const mablArgs = (0, domUtil_1.buildStepArgumentString)({
@@ -6,17 +6,19 @@ const domUtil_1 = require("../../domUtil");
6
6
  const MablAction_1 = require("../MablAction");
7
7
  class EchoStep extends MablStep_1.MablStep {
8
8
  constructor(name, args, actions) {
9
- super(name, args, actions);
9
+ super(name, args, actions, 'echo');
10
10
  this.echoValue = (0, MablAction_1.parseArgument)(this.getActionArgs()[0]);
11
11
  }
12
12
  getStepName() {
13
13
  return EchoStep.stepName;
14
14
  }
15
15
  toStepDescriptor() {
16
- return { value: this.echoValue.toString() };
16
+ return { value: this.echoValue.toString(), actionCode: this.actionCode };
17
17
  }
18
18
  static fromYaml(_stepName, stepArgs) {
19
- return new EchoStep(EchoStep.stepName, [stepArgs.value], []);
19
+ const step = new EchoStep(EchoStep.stepName, [stepArgs.value], []);
20
+ step.setStepId(stepArgs.id);
21
+ return step;
20
22
  }
21
23
  toMablscript() {
22
24
  const stringEchoValue = `${this.echoValue}`;
@@ -8,9 +8,13 @@ class ElseIfConditionStep extends IfConditionStep_1.IfConditionStep {
8
8
  return 'ElseIf';
9
9
  }
10
10
  static fromYaml(_stepName, stepArgs) {
11
- const actions = [new MablAction_1.MablAction('conditional_else', [])];
11
+ const actions = [
12
+ new MablAction_1.MablAction('conditional_else', 'conditional_else_if', []),
13
+ ];
12
14
  actions.push(...IfConditionStep_1.IfConditionStep.getActionsFromYamlForCondition(stepArgs));
13
- return new ElseIfConditionStep('conditional_else_if', [], actions);
15
+ const step = new ElseIfConditionStep('conditional_else_if', [], actions);
16
+ step.setStepId(stepArgs.id);
17
+ return step;
14
18
  }
15
19
  toMablscript() {
16
20
  const actions = this.actions.reduce((mablscript, action) => `${mablscript}${action.toMablscript()}.`, '');