@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
@@ -4,16 +4,18 @@ exports.ElseStep = void 0;
4
4
  const MablStep_1 = require("../MablStep");
5
5
  class ElseStep extends MablStep_1.MablStep {
6
6
  constructor(name, args, actions) {
7
- super(name, args, actions);
7
+ super(name, args, actions, 'conditional_else');
8
8
  }
9
9
  getStepName() {
10
10
  return 'Else';
11
11
  }
12
12
  toStepDescriptor() {
13
- return {};
13
+ return { actionCode: this.actionCode };
14
14
  }
15
- static fromYaml(_stepName, _stepArgs) {
16
- return new ElseStep('conditional_else', [], []);
15
+ static fromYaml(_stepName, stepArgs) {
16
+ const step = new ElseStep('conditional_else', [], []);
17
+ step.setStepId(stepArgs.id);
18
+ return step;
17
19
  }
18
20
  toMablscript() {
19
21
  return `conditional_else()`;
@@ -4,16 +4,18 @@ exports.EndStep = void 0;
4
4
  const MablStep_1 = require("../MablStep");
5
5
  class EndStep extends MablStep_1.MablStep {
6
6
  constructor(name, args, actions) {
7
- super(name, args, actions);
7
+ super(name, args, actions, 'conditional_end');
8
8
  }
9
9
  getStepName() {
10
10
  return 'End';
11
11
  }
12
12
  toStepDescriptor() {
13
- return {};
13
+ return { actionCode: this.actionCode };
14
14
  }
15
- static fromYaml(_stepName, _stepArgs) {
16
- return new EndStep('conditional_end', [], []);
15
+ static fromYaml(_stepName, stepArgs) {
16
+ const step = new EndStep('conditional_end', [], []);
17
+ step.setStepId(stepArgs.id);
18
+ return step;
17
19
  }
18
20
  toMablscript() {
19
21
  return `conditional_end()`;
@@ -7,7 +7,7 @@ const domUtil_1 = require("../../domUtil");
7
7
  const ActionsUtils_1 = require("./ActionsUtils");
8
8
  class EnterAuthCodeStep extends MablStep_1.MablStep {
9
9
  constructor(name, args, actions) {
10
- super(name, args, actions);
10
+ super(name, args, actions, 'enter_auth_code');
11
11
  this.findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(this.actions);
12
12
  }
13
13
  getStepName() {
@@ -23,21 +23,28 @@ class EnterAuthCodeStep 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
  EnterAuthCode: {
34
35
  ...super.annotationsAsYml(),
35
36
  ...this.findAction.toYaml(),
36
37
  },
37
38
  };
39
+ if (this.stepId()) {
40
+ step.EnterAuthCode.id = this.stepId();
41
+ }
42
+ return step;
38
43
  }
39
44
  static fromYaml(_stepName, stepArgs) {
40
- return new EnterAuthCodeStep('enter_auth_code', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
45
+ const step = new EnterAuthCodeStep('enter_auth_code', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
46
+ step.setStepId(stepArgs.id);
47
+ return step;
41
48
  }
42
49
  toMablscript() {
43
50
  return `${this.findAction.toMablscript()}.enter_auth_code()`;
@@ -7,7 +7,7 @@ const MablStep_1 = require("../MablStep");
7
7
  const domUtil_1 = require("../../domUtil");
8
8
  class EnterTextStep extends MablStep_1.MablStep {
9
9
  constructor(name, args, actions) {
10
- super(name, args, actions);
10
+ super(name, args, actions, 'enter_text');
11
11
  const arg = this.getActionArgs()[0];
12
12
  this.text = (0, MablAction_1.parseArgument)(arg);
13
13
  this.validate();
@@ -37,6 +37,7 @@ class EnterTextStep extends MablStep_1.MablStep {
37
37
  find,
38
38
  descriptorToActionMap: new Map().set(find, this.findAction),
39
39
  text: this.text,
40
+ actionCode: this.actionCode,
40
41
  };
41
42
  default:
42
43
  throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
@@ -67,10 +68,15 @@ class EnterTextStep extends MablStep_1.MablStep {
67
68
  }
68
69
  formatted[stepName].findType = FindAction_1.findTypesToFormattedType[step.find.findType];
69
70
  formatted[stepName].text = this.text.toString();
71
+ if (this.stepId()) {
72
+ formatted[stepName].id = this.stepId();
73
+ }
70
74
  return formatted;
71
75
  }
72
76
  static fromYaml(_stepName, stepArgs) {
73
- return new EnterTextStep('enter_text', [stepArgs.text], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
77
+ const step = new EnterTextStep('enter_text', [stepArgs.text], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
78
+ step.setStepId(stepArgs.id);
79
+ return step;
74
80
  }
75
81
  toMablscript() {
76
82
  const enterText = typeof this.text === 'string'
@@ -6,7 +6,7 @@ const MablStep_1 = require("../MablStep");
6
6
  exports.EVALUATE_FLOW_STEP_NAME = 'EvaluateFlow';
7
7
  class EvaluateFlowStep extends MablStep_1.MablStep {
8
8
  constructor(name, args, actions) {
9
- super(name, args, actions);
9
+ super(name, args, actions, 'evaluate_flow');
10
10
  if (args.length < 1 || args.length > 2) {
11
11
  throw new Error('EvaluateFlowStep expects 1 or 2 arguments');
12
12
  }
@@ -22,11 +22,14 @@ class EvaluateFlowStep extends MablStep_1.MablStep {
22
22
  return {
23
23
  descriptor: this.flowDescriptor,
24
24
  config: this.config,
25
+ actionCode: this.actionCode,
25
26
  };
26
27
  }
27
28
  static fromYaml(_stepName, stepArgs) {
28
29
  const { descriptor, config } = stepArgs;
29
- return new EvaluateFlowStep(EvaluateFlowStep.mablScriptStepNames[0], [descriptor, config], []);
30
+ const step = new EvaluateFlowStep(EvaluateFlowStep.mablScriptStepNames[0], [descriptor, config], []);
31
+ step.setStepId(stepArgs.id);
32
+ return step;
30
33
  }
31
34
  toMablscript() {
32
35
  const flowReference = (0, domUtil_1.buildStepArgumentString)({
@@ -6,7 +6,7 @@ const JavaScriptAction_1 = require("../actions/JavaScriptAction");
6
6
  const STEP_NAME = 'EvaluateJavaScript';
7
7
  class EvaluateJavaScriptStep extends MablStep_1.MablStep {
8
8
  constructor(name, args, actions) {
9
- super(name, args, actions || []);
9
+ super(name, args, actions || [], 'evaluate_js');
10
10
  this.evaluateJsAction = new JavaScriptAction_1.JavaScriptAction(JavaScriptAction_1.JavaScriptAction.mablscriptName, args);
11
11
  }
12
12
  getStepName() {
@@ -16,16 +16,22 @@ class EvaluateJavaScriptStep extends MablStep_1.MablStep {
16
16
  return this.evaluateJsAction.toDescriptor();
17
17
  }
18
18
  getFormattedStep() {
19
- return {
19
+ const step = {
20
20
  [STEP_NAME]: {
21
21
  ...super.annotationsAsYml(),
22
22
  ...this.evaluateJsAction.toYaml(),
23
23
  },
24
24
  };
25
+ if (this.stepId()) {
26
+ step[STEP_NAME].id = this.stepId();
27
+ }
28
+ return step;
25
29
  }
26
30
  static fromYaml(_stepName, stepArgs) {
27
31
  const evaluateJsAction = JavaScriptAction_1.JavaScriptAction.fromYaml(stepArgs);
28
- return new EvaluateJavaScriptStep(evaluateJsAction.name, evaluateJsAction.args);
32
+ const step = new EvaluateJavaScriptStep(evaluateJsAction.name, evaluateJsAction.args);
33
+ step.setStepId(stepArgs.id);
34
+ return step;
29
35
  }
30
36
  toMablscript() {
31
37
  return this.evaluateJsAction.toMablscript();
@@ -6,7 +6,7 @@ const MablStep_1 = require("../MablStep");
6
6
  const domUtil_1 = require("../../domUtil");
7
7
  class HoverStep extends MablStep_1.MablStep {
8
8
  constructor(name, args, actions) {
9
- super(name, args, actions);
9
+ super(name, args, actions, 'hover');
10
10
  this.validate();
11
11
  this.findAction = this.actions[0];
12
12
  }
@@ -28,21 +28,28 @@ class HoverStep extends MablStep_1.MablStep {
28
28
  return {
29
29
  find,
30
30
  descriptorToActionMap: new Map().set(find, this.findAction),
31
+ actionCode: this.actionCode,
31
32
  };
32
33
  default:
33
34
  throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
34
35
  }
35
36
  }
36
37
  getFormattedStep(_fullLocatorsOn) {
37
- return {
38
+ const step = {
38
39
  Hover: {
39
40
  ...super.annotationsAsYml(),
40
41
  ...this.findAction.toYaml(),
41
42
  },
42
43
  };
44
+ if (this.stepId()) {
45
+ step.Hover.id = this.stepId();
46
+ }
47
+ return step;
43
48
  }
44
49
  static fromYaml(_stepName, stepArgs) {
45
- return new HoverStep('hover', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
50
+ const step = new HoverStep('hover', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
51
+ step.setStepId(stepArgs.id);
52
+ return step;
46
53
  }
47
54
  toMablscript() {
48
55
  return `${this.findAction.toMablscript()}.hover()`;
@@ -14,7 +14,7 @@ const GetUrlAction_1 = require("../actions/GetUrlAction");
14
14
  const ConditionDescriptor_1 = require("../types/ConditionDescriptor");
15
15
  class IfConditionStep extends MablStep_1.MablStep {
16
16
  constructor(name, args, actions) {
17
- super(name, args, actions);
17
+ super(name, args, actions, 'conditional_if');
18
18
  const candidatePrimaryActions = actions.filter((action) => action instanceof FindAction_1.FindAction ||
19
19
  action instanceof GetVariableValue_1.GetVariableValue ||
20
20
  action instanceof GetUrlAction_1.GetUrlAction ||
@@ -44,11 +44,15 @@ class IfConditionStep extends MablStep_1.MablStep {
44
44
  conditionDescriptor,
45
45
  onFailure: AssertStep_1.OnFailure.FailImmediately,
46
46
  descriptorToActionMap: new Map().set(find, this.primaryAction),
47
+ actionCode: this.actionCode,
47
48
  };
48
49
  }
49
50
  getFormattedStep(_fullLocatorsOn) {
50
51
  const result = {};
51
52
  result[this.getStepName()] = this.toYamlConditionDetails();
53
+ if (this.stepId()) {
54
+ result[this.getStepName()].id = this.stepId();
55
+ }
52
56
  return result;
53
57
  }
54
58
  toYamlConditionDetails() {
@@ -132,7 +136,9 @@ class IfConditionStep extends MablStep_1.MablStep {
132
136
  }
133
137
  static fromYaml(_stepName, stepArgs) {
134
138
  const actions = IfConditionStep.getActionsFromYamlForCondition(stepArgs);
135
- return new IfConditionStep('conditional_if', [], actions);
139
+ const step = new IfConditionStep('conditional_if', [], actions);
140
+ step.setStepId(stepArgs.id);
141
+ return step;
136
142
  }
137
143
  toMablscript() {
138
144
  return `${this.actions.reduce((mablscript, action) => `${mablscript}${action.toMablscript()}.`, '')}conditional_if()`;
@@ -4,7 +4,7 @@ exports.NavigateStep = void 0;
4
4
  const MablStep_1 = require("../MablStep");
5
5
  class NavigateStep extends MablStep_1.MablStep {
6
6
  constructor(name, args, actions) {
7
- super(name, args, actions);
7
+ super(name, args, actions, 'navigate');
8
8
  this.navigation = this.getActionArgs()[0];
9
9
  }
10
10
  getStepName() {
@@ -13,10 +13,13 @@ class NavigateStep extends MablStep_1.MablStep {
13
13
  toStepDescriptor() {
14
14
  return {
15
15
  navigation: this.navigation,
16
+ actionCode: this.actionCode,
16
17
  };
17
18
  }
18
19
  static fromYaml(_stepName, stepArgs) {
19
- return new NavigateStep('navigate', [stepArgs.navigation], []);
20
+ const step = new NavigateStep('navigate', [stepArgs.navigation], []);
21
+ step.setStepId(stepArgs.id);
22
+ return step;
20
23
  }
21
24
  toMablscript() {
22
25
  return `navigate("${this.navigation}")`;
@@ -5,7 +5,7 @@ const FindAction_1 = require("../actions/FindAction");
5
5
  const MablStep_1 = require("../MablStep");
6
6
  class OpenEmailStep extends MablStep_1.MablStep {
7
7
  constructor(name, args, actions) {
8
- super(name, args, actions);
8
+ super(name, args, actions, 'open_email');
9
9
  this.tabUuid = this.getActionArgs()[0] || {};
10
10
  this.validate();
11
11
  this.findAction = this.actions[0];
@@ -25,10 +25,13 @@ class OpenEmailStep extends MablStep_1.MablStep {
25
25
  selector: find.findTarget.selector,
26
26
  findType: 'FindEmail',
27
27
  configuration: find.findTarget.configuration,
28
+ actionCode: this.actionCode,
28
29
  };
29
30
  }
30
31
  static fromYaml(_stepName, stepArgs) {
31
- return new OpenEmailStep('open_email', [stepArgs.tab], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
32
+ const step = new OpenEmailStep('open_email', [stepArgs.tab], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
33
+ step.setStepId(stepArgs.id);
34
+ return step;
32
35
  }
33
36
  toMablscript() {
34
37
  return `${this.findAction.toMablscript()}.open_email("${this.tabUuid}")`;
@@ -9,7 +9,7 @@ const ActionsUtils_1 = require("./ActionsUtils");
9
9
  class ReleaseStep extends MablStep_1.MablStep {
10
10
  constructor(name, args, actions) {
11
11
  var _a;
12
- super(name, args, actions);
12
+ super(name, args, actions, 'release');
13
13
  this.findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(this.actions);
14
14
  this.releaseArgs = (_a = this.parseArgs(args)) !== null && _a !== void 0 ? _a : { isHtml5: false };
15
15
  }
@@ -39,21 +39,28 @@ class ReleaseStep extends MablStep_1.MablStep {
39
39
  find,
40
40
  isHtml5: this.releaseArgs.isHtml5,
41
41
  descriptorToActionMap: new Map().set(find, this.findAction),
42
+ actionCode: this.actionCode,
42
43
  };
43
44
  default:
44
45
  throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
45
46
  }
46
47
  }
47
48
  getFormattedStep(_fullLocatorsOn) {
48
- return {
49
+ const step = {
49
50
  Release: {
50
51
  ...super.annotationsAsYml(),
51
52
  ...this.findAction.toYaml(),
52
53
  },
53
54
  };
55
+ if (this.stepId()) {
56
+ step.Release.id = this.stepId();
57
+ }
58
+ return step;
54
59
  }
55
60
  static fromYaml(_stepName, stepArgs) {
56
- return new ReleaseStep('release', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
61
+ const step = new ReleaseStep('release', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
62
+ step.setStepId(stepArgs.id);
63
+ return step;
57
64
  }
58
65
  toMablscript() {
59
66
  const args = (0, MablAction_1.convertObjectToMablscriptArgs)(this.releaseArgs);
@@ -7,7 +7,7 @@ const CookieUtils_1 = require("./CookieUtils");
7
7
  const domUtil_1 = require("../../domUtil");
8
8
  class RemoveCookieStep extends MablStep_1.MablStep {
9
9
  constructor(name, args, actions) {
10
- super(name, args, actions);
10
+ super(name, args, actions, 'remove_cookie');
11
11
  this.cookieName = CookieUtils_1.CookieUtils.normalizeName(this.getActionArgs()[0].name);
12
12
  }
13
13
  getStepName() {
@@ -16,10 +16,13 @@ class RemoveCookieStep extends MablStep_1.MablStep {
16
16
  toStepDescriptor() {
17
17
  return {
18
18
  name: this.cookieName,
19
+ actionCode: this.actionCode,
19
20
  };
20
21
  }
21
22
  static fromYaml(_stepName, stepArgs) {
22
- return new RemoveCookieStep('remove_cookie', [stepArgs], []);
23
+ const step = new RemoveCookieStep('remove_cookie', [stepArgs], []);
24
+ step.setStepId(stepArgs.id);
25
+ return step;
23
26
  }
24
27
  toMablscript() {
25
28
  return `remove_cookie({ name : "${(0, domUtil_1.escapeMablscriptString)(this.cookieName)}" })`;
@@ -7,7 +7,7 @@ const domUtil_1 = require("../../domUtil");
7
7
  const ActionsUtils_1 = require("./ActionsUtils");
8
8
  class RightClickStep extends MablStep_1.MablStep {
9
9
  constructor(name, args, actions) {
10
- super(name, args, actions);
10
+ super(name, args, actions, 'right_click');
11
11
  this.findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(this.actions);
12
12
  }
13
13
  getStepName() {
@@ -23,21 +23,28 @@ class RightClickStep 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
  RightClick: {
34
35
  ...super.annotationsAsYml(),
35
36
  ...this.findAction.toYaml(),
36
37
  },
37
38
  };
39
+ if (this.stepId()) {
40
+ step.RightClick.id = this.stepId();
41
+ }
42
+ return step;
38
43
  }
39
44
  static fromYaml(_stepName, stepArgs) {
40
- return new RightClickStep('right_click', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
45
+ const step = new RightClickStep('right_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()}.right_click()`;
@@ -7,7 +7,7 @@ const MablStep_1 = require("../MablStep");
7
7
  const domUtil_1 = require("../../domUtil");
8
8
  class SelectStep extends MablStep_1.MablStep {
9
9
  constructor(name, args, actions) {
10
- super(name, args, actions);
10
+ super(name, args, actions, 'select');
11
11
  this.selectOptions = this.getActionArgs()[0];
12
12
  this.selectOptionType = this.getActionArgs()[1];
13
13
  this.validate();
@@ -45,18 +45,24 @@ class SelectStep extends MablStep_1.MablStep {
45
45
  delete stepArgs.selectorAncestors;
46
46
  delete stepArgs.selectOptionType;
47
47
  const selectOptions = stepArgs;
48
- return new SelectStep('select', [selectOptions, selectOptionType], [findAction]);
48
+ const step = new SelectStep('select', [selectOptions, selectOptionType], [findAction]);
49
+ step.setStepId(stepArgs.id);
50
+ return step;
49
51
  }
50
52
  getFormattedStep(_fullLocatorsOn) {
51
53
  const step = this.selectOptions;
52
54
  const { find, ...ymlStep } = step;
53
- return {
55
+ const finalStep = {
54
56
  Select: {
55
57
  ...ymlStep,
56
58
  ...super.annotationsAsYml(),
57
59
  ...this.findAction.toYaml(),
58
60
  },
59
61
  };
62
+ if (this.stepId()) {
63
+ finalStep.Select.id = this.stepId();
64
+ }
65
+ return finalStep;
60
66
  }
61
67
  toMablscript() {
62
68
  const selectOptionType = this.selectOptionType
@@ -10,7 +10,7 @@ const evalAssertionType = {};
10
10
  Object.entries(AssertStep_1.assertionStepToField).forEach(([stepType, field]) => (evalAssertionType[field] = `${stepType.split('Assert')[1]}`));
11
11
  class SendHttpRequestStep extends MablStep_1.MablStep {
12
12
  constructor(name, args, actions) {
13
- super(name, args, actions);
13
+ super(name, args, actions, 'send_http_request');
14
14
  this.sendRequest = this.getActionArgs()[0];
15
15
  }
16
16
  getStepName() {
@@ -24,6 +24,7 @@ class SendHttpRequestStep extends MablStep_1.MablStep {
24
24
  assertion: evalAssertionType[assertion.assertion],
25
25
  }));
26
26
  }
27
+ formatted.actionCode = this.actionCode;
27
28
  return formatted;
28
29
  }
29
30
  static fromYaml(_stepName, stepArgs) {
@@ -35,7 +36,9 @@ class SendHttpRequestStep extends MablStep_1.MablStep {
35
36
  assertion: AssertStep_1.assertionStepToField[`Assert${assertion.assertion}`],
36
37
  }));
37
38
  }
38
- return new SendHttpRequestStep(SendHttpRequestStep.stepName, [formatted], []);
39
+ const step = new SendHttpRequestStep(SendHttpRequestStep.stepName, [formatted], []);
40
+ step.setStepId(stepArgs.id);
41
+ return step;
39
42
  }
40
43
  toMablscript() {
41
44
  return `send_http_request(${(0, domUtil_1.buildStepArgumentString)({
@@ -8,7 +8,7 @@ const SendKeyStepDescriptor_1 = require("../types/SendKeyStepDescriptor");
8
8
  const STEP_NAME = 'SendKeys';
9
9
  class SendKeyStep extends MablStep_1.MablStep {
10
10
  constructor(name, args, actions) {
11
- super(name, args, actions);
11
+ super(name, args, actions, 'send_keys');
12
12
  if (this.actions.length !== 1 && !(this.actions[0] instanceof FindAction_1.FindAction)) {
13
13
  throw new Error(`${name} step should have one sub-action and it should be a find`);
14
14
  }
@@ -43,24 +43,31 @@ class SendKeyStep extends MablStep_1.MablStep {
43
43
  find,
44
44
  keys: this.keys,
45
45
  descriptorToActionMap: new Map().set(find, this.findAction),
46
+ actionCode: this.actionCode,
46
47
  };
47
48
  default:
48
49
  throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
49
50
  }
50
51
  }
51
52
  getFormattedStep() {
52
- return {
53
+ const step = {
53
54
  [STEP_NAME]: {
54
55
  ...super.annotationsAsYml(),
55
56
  sendKeys: this.keys,
56
57
  ...this.findAction.toYaml(),
57
58
  },
58
59
  };
60
+ if (this.stepId()) {
61
+ step[STEP_NAME].id = this.stepId();
62
+ }
63
+ return step;
59
64
  }
60
65
  static fromYaml(_stepName, stepArgs) {
61
- return new SendKeyStep('send_keys', stepArgs.sendKeys, [
66
+ const step = new SendKeyStep('send_keys', stepArgs.sendKeys, [
62
67
  FindAction_1.FindAction.findActionFromStepArgs(stepArgs),
63
68
  ]);
69
+ step.setStepId(stepArgs.id);
70
+ return step;
64
71
  }
65
72
  toMablscript() {
66
73
  const keysToSend = this.keys
@@ -7,7 +7,7 @@ const CookieUtils_1 = require("./CookieUtils");
7
7
  const domUtil_1 = require("../../domUtil");
8
8
  class SetCookieStep extends MablStep_1.MablStep {
9
9
  constructor(name, args, actions) {
10
- super(name, args, actions);
10
+ super(name, args, actions, 'set_cookie');
11
11
  const cookieSelector = this.getActionArgs()[0];
12
12
  this.cookieName = CookieUtils_1.CookieUtils.normalizeName(cookieSelector.name);
13
13
  this.cookieValue = CookieUtils_1.CookieUtils.normalizeValue(cookieSelector.value);
@@ -32,10 +32,13 @@ class SetCookieStep extends MablStep_1.MablStep {
32
32
  name: this.cookieName,
33
33
  value: this.cookieValue,
34
34
  options: this.cookieOptions,
35
+ actionCode: this.actionCode,
35
36
  };
36
37
  }
37
38
  static fromYaml(_stepName, stepArgs) {
38
- return new SetCookieStep('set_cookie', [stepArgs], []);
39
+ const step = new SetCookieStep('set_cookie', [stepArgs], []);
40
+ step.setStepId(stepArgs.id);
41
+ return step;
39
42
  }
40
43
  toMablscript() {
41
44
  var _a, _b, _c, _d, _e, _f, _g;
@@ -7,7 +7,7 @@ const MablStep_1 = require("../MablStep");
7
7
  const domUtil_1 = require("../../domUtil");
8
8
  class SetFilesStep extends MablStep_1.MablStep {
9
9
  constructor(name, args, actions) {
10
- super(name, args, actions);
10
+ super(name, args, actions, 'set_files');
11
11
  this.files = this.getActionArgs();
12
12
  this.validate();
13
13
  this.findAction = this.actions[0];
@@ -37,18 +37,24 @@ class SetFilesStep extends MablStep_1.MablStep {
37
37
  }
38
38
  }
39
39
  getFormattedStep(_fullLocatorsOn) {
40
- return {
40
+ const step = {
41
41
  SetFiles: {
42
42
  ...super.annotationsAsYml(),
43
43
  ...this.findAction.toYaml(),
44
44
  files: this.files,
45
45
  },
46
46
  };
47
+ if (this.stepId()) {
48
+ step.SetFiles.id = this.stepId();
49
+ }
50
+ return step;
47
51
  }
48
52
  static fromYaml(_stepName, stepArgs) {
49
- return new SetFilesStep('set_files', stepArgs.files, [
53
+ const step = new SetFilesStep('set_files', stepArgs.files, [
50
54
  FindAction_1.FindAction.findActionFromStepArgs(stepArgs),
51
55
  ]);
56
+ step.setStepId(stepArgs.id);
57
+ return step;
52
58
  }
53
59
  toMablscript() {
54
60
  const files = this.files
@@ -4,7 +4,7 @@ exports.SetViewportStep = void 0;
4
4
  const MablStep_1 = require("../MablStep");
5
5
  class SetViewportStep extends MablStep_1.MablStep {
6
6
  constructor(name, args, actions) {
7
- super(name, args, actions);
7
+ super(name, args, actions, 'set_viewport');
8
8
  const viewportArg = this.getActionArgs()[0];
9
9
  this.size = viewportArg === null || viewportArg === void 0 ? void 0 : viewportArg.size;
10
10
  }
@@ -12,10 +12,12 @@ class SetViewportStep extends MablStep_1.MablStep {
12
12
  return 'SetViewport';
13
13
  }
14
14
  toStepDescriptor() {
15
- return { size: this.size };
15
+ return { size: this.size, actionCode: this.actionCode };
16
16
  }
17
17
  static fromYaml(_stepName, stepArgs) {
18
- return new SetViewportStep('set_viewport', [stepArgs], []);
18
+ const step = new SetViewportStep('set_viewport', [stepArgs], []);
19
+ step.setStepId(stepArgs.id);
20
+ return step;
19
21
  }
20
22
  toMablscript() {
21
23
  let sizeArg;
@@ -7,7 +7,7 @@ const SwitchContextStepDescriptor_1 = require("../types/SwitchContextStepDescrip
7
7
  const domUtil_1 = require("../../domUtil");
8
8
  class SwitchContextStep extends MablStep_1.MablStep {
9
9
  constructor(name, args, actions) {
10
- super(name, args, actions);
10
+ super(name, args, actions, 'switch_context_to');
11
11
  const maybeRoot = this.getActionArgs()[0];
12
12
  if (maybeRoot !== undefined && maybeRoot !== 'root') {
13
13
  throw new Error(`Unexpected argument for ${name} step: ${JSON.stringify(maybeRoot)}`);
@@ -15,6 +15,7 @@ class SwitchContextStep extends MablStep_1.MablStep {
15
15
  if (maybeRoot === 'root') {
16
16
  this.switch = {
17
17
  frame: 'root',
18
+ actionCode: this.actionCode,
18
19
  };
19
20
  Object.freeze(this.switch);
20
21
  return;
@@ -32,6 +33,7 @@ class SwitchContextStep extends MablStep_1.MablStep {
32
33
  tab: findDescriptor,
33
34
  find: findDescriptor,
34
35
  descriptorToActionMap: new Map().set(findDescriptor, this.findAction),
36
+ actionCode: this.actionCode,
35
37
  };
36
38
  Object.freeze(this.switch);
37
39
  return;
@@ -41,6 +43,7 @@ class SwitchContextStep extends MablStep_1.MablStep {
41
43
  frame: findDescriptor,
42
44
  find: findDescriptor,
43
45
  descriptorToActionMap: new Map().set(findDescriptor, this.findAction),
46
+ actionCode: this.actionCode,
44
47
  };
45
48
  Object.freeze(this.switch);
46
49
  return;
@@ -86,13 +89,21 @@ class SwitchContextStep extends MablStep_1.MablStep {
86
89
  if ((0, SwitchContextStepDescriptor_1.isSwitchRoot)(step) && step.frame === 'root') {
87
90
  formatted[stepName].switch = 'root';
88
91
  }
92
+ if (this.stepId()) {
93
+ formatted[stepName].id = this.stepId();
94
+ }
89
95
  return formatted;
90
96
  }
91
97
  static fromYaml(_stepName, stepArgs) {
98
+ let step;
92
99
  if (stepArgs.switch) {
93
- return new SwitchContextStep('switch_context_to', [stepArgs.switch], []);
100
+ step = new SwitchContextStep('switch_context_to', [stepArgs.switch], []);
101
+ }
102
+ else {
103
+ step = new SwitchContextStep('switch_context_to', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
94
104
  }
95
- return new SwitchContextStep('switch_context_to', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
105
+ step.setStepId(stepArgs.id);
106
+ return step;
96
107
  }
97
108
  toMablscript() {
98
109
  var _a;