@mablhq/mabl-cli 1.62.1 → 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.
- package/api/basicApiClient.js +10 -10
- package/api/mablApiClient.js +39 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +6 -6
- package/cli.js +1 -0
- package/commands/app-files/app-files.js +5 -0
- package/commands/app-files/app-files_cmds/create.js +98 -0
- package/commands/app-files/app-files_cmds/delete.js +31 -0
- package/commands/app-files/app-files_cmds/download.js +50 -0
- package/commands/app-files/app-files_cmds/list.js +72 -0
- package/commands/config/config_cmds/install.js +92 -0
- package/commands/constants.js +9 -2
- package/commands/tests/testsUtil.js +9 -1
- package/commands/tests/tests_cmds/run-mobile.js +218 -0
- package/commands/tests/tests_cmds/run.js +1 -1
- package/core/util.js +36 -2
- package/env/defaultEnv.js +2 -1
- package/env/dev.js +2 -1
- package/env/env.js +3 -1
- package/env/local.js +2 -1
- package/env/prod.js +2 -1
- package/execution/index.js +13 -1
- package/execution/runAppiumServer.js +133 -0
- package/http/MablHttpAgent.js +1 -4
- package/http/RequestFilteringHttpAgent.js +3 -3
- package/http/axiosProxyConfig.js +10 -7
- package/http/httpUtil.js +10 -6
- package/index.js +3 -2
- package/mablApi/index.js +1 -1
- package/mablscript/MablAction.js +6 -2
- package/mablscript/MablStep.js +41 -5
- package/mablscript/MablStepV2.js +57 -0
- package/mablscript/MablSymbol.js +6 -2
- package/mablscript/actions/AwaitDownloadAction.js +1 -1
- package/mablscript/actions/ConditionAction.js +1 -1
- package/mablscript/actions/CountAction.js +1 -1
- package/mablscript/actions/ExtractAction.js +12 -7
- package/mablscript/actions/FindAction.js +6 -6
- package/mablscript/actions/GenerateEmailAddressAction.js +1 -1
- package/mablscript/actions/GenerateRandomStringAction.js +1 -1
- package/mablscript/actions/GetUrlAction.js +1 -1
- package/mablscript/actions/GetVariableValue.js +1 -1
- package/mablscript/actions/JavaScriptAction.js +25 -14
- package/mablscript/importer.js +99 -16
- package/mablscript/mobile/steps/CreateVariableMobileStep.js +53 -0
- package/mablscript/mobile/steps/EnterTextStep.js +41 -0
- package/mablscript/mobile/steps/NavigateBackStep.js +20 -0
- package/mablscript/mobile/steps/NavigateHomeStep.js +21 -0
- package/mablscript/mobile/steps/ScrollStep.js +37 -0
- package/mablscript/mobile/steps/SetOrientationStep.js +20 -0
- package/mablscript/mobile/steps/TapStep.js +37 -0
- package/mablscript/mobile/steps/actions/MobileFindAction.js +23 -0
- package/mablscript/mobile/steps/stepUtil.js +74 -0
- package/mablscript/mobile/tests/StepTestsUtil.js +20 -0
- package/mablscript/mobile/tests/TestMobileFindDescriptors.js +215 -0
- package/mablscript/mobile/tests/steps/CreateVariableMobileStep.mobiletest.js +298 -0
- package/mablscript/mobile/tests/steps/EnterTextStep.mobiletest.js +79 -0
- package/mablscript/mobile/tests/steps/GeneralHumanization.mobiletest.js +167 -0
- package/mablscript/mobile/tests/steps/NavigateBackStep.mobiletest.js +27 -0
- package/mablscript/mobile/tests/steps/NavigateHomeStep.mobiletest.js +27 -0
- package/mablscript/mobile/tests/steps/ScrollStep.mobiletest.js +121 -0
- package/mablscript/mobile/tests/steps/SetOrientationStep.mobiletest.js +32 -0
- package/mablscript/mobile/tests/steps/TapStep.mobiletest.js +57 -0
- package/mablscript/steps/AccessibilityCheck.js +20 -9
- package/mablscript/steps/AssertStep.js +54 -39
- package/mablscript/steps/AssertStepOld.js +35 -4
- package/mablscript/steps/AwaitTabStep.js +5 -2
- package/mablscript/steps/AwaitUploadsStep.js +6 -4
- package/mablscript/steps/ClearCookiesStep.js +6 -4
- package/mablscript/steps/ClickAndHoldStep.js +10 -3
- package/mablscript/steps/ClickStep.js +10 -3
- package/mablscript/steps/CreateVariableStep.js +25 -8
- package/mablscript/steps/DoubleClickStep.js +10 -3
- package/mablscript/steps/DownloadStep.js +4 -2
- package/mablscript/steps/EchoStep.js +8 -5
- package/mablscript/steps/ElseIfConditionStep.js +14 -4
- package/mablscript/steps/ElseStep.js +8 -5
- package/mablscript/steps/EndStep.js +8 -5
- package/mablscript/steps/EnterAuthCodeStep.js +10 -3
- package/mablscript/steps/EnterTextStep.js +8 -2
- package/mablscript/steps/EvaluateFlowStep.js +5 -2
- package/mablscript/steps/EvaluateJavaScriptStep.js +15 -4
- package/mablscript/steps/HoverStep.js +10 -3
- package/mablscript/steps/IfConditionStep.js +25 -12
- package/mablscript/steps/NavigateStep.js +5 -2
- package/mablscript/steps/OpenEmailStep.js +5 -2
- package/mablscript/steps/ReleaseStep.js +10 -3
- package/mablscript/steps/RemoveCookieStep.js +5 -2
- package/mablscript/steps/RightClickStep.js +10 -3
- package/mablscript/steps/SelectStep.js +9 -3
- package/mablscript/steps/SendHttpRequestStep.js +8 -4
- package/mablscript/steps/SendKeyStep.js +10 -3
- package/mablscript/steps/SetCookieStep.js +5 -2
- package/mablscript/steps/SetFilesStep.js +9 -3
- package/mablscript/steps/SetViewportStep.js +5 -3
- package/mablscript/steps/SwitchContextStep.js +14 -3
- package/mablscript/steps/SyntheticStep.js +1 -1
- package/mablscript/steps/VisitUrlStep.js +5 -2
- package/mablscript/steps/WaitStep.js +8 -4
- package/mablscript/steps/WaitUntilStep.js +6 -3
- package/mablscript/types/GetVariableDescriptor.js +8 -3
- package/mablscript/types/mobile/CreateVariableMobileStepDescriptor.js +9 -0
- package/mablscript/types/mobile/EnterTextStepDescriptor.js +2 -0
- package/mablscript/types/mobile/NavigateBackStepDescriptor.js +2 -0
- package/mablscript/types/mobile/NavigateHomeStepDescriptor.js +2 -0
- package/mablscript/types/mobile/ScrollStepDescriptor.js +2 -0
- package/mablscript/types/mobile/SetOrientationStepDescriptor.js +8 -0
- package/mablscript/types/mobile/StepWithMobileFindDescriptor.js +2 -0
- package/mablscript/types/mobile/TapStepDescriptor.js +8 -0
- package/mablscriptFind/index.js +1 -1
- package/observers/ObserverBase.js +9 -0
- package/observers/mockObserver.js +3 -3
- package/package.json +11 -6
- package/resources/webdriver.js +21 -0
- package/upload/index.js +5 -0
- package/util/FileCache.js +180 -0
- package/util/Lazy.js +90 -0
- package/util/MobileAppFileCache.js +102 -0
- package/util/RichPromise.js +3 -1
- package/util/javaScriptStepMigration.js +1 -0
- package/webdriver/index.js +41 -0
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CreateVariableStep = void 0;
|
|
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
|
|
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
|
}
|
|
19
19
|
getStepName() {
|
|
20
|
-
return
|
|
20
|
+
return CreateVariableStep.stepName;
|
|
21
21
|
}
|
|
22
22
|
calculateGenerationType() {
|
|
23
23
|
if (this.actions.length === 2 && this.actions[0] instanceof FindAction_1.FindAction) {
|
|
@@ -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
|
-
|
|
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}")`;
|
|
@@ -192,5 +202,12 @@ class CreateVariableStep extends MablStep_1.MablStep {
|
|
|
192
202
|
}
|
|
193
203
|
}
|
|
194
204
|
exports.CreateVariableStep = CreateVariableStep;
|
|
205
|
+
CreateVariableStep.stepName = 'CreateVariable';
|
|
195
206
|
CreateVariableStep.mablScriptStepNames = ['as'];
|
|
196
207
|
CreateVariableStep.yamlMablScriptNames = ['CreateVariable', 'GenerateEmailAddress'];
|
|
208
|
+
function isCreateVariableStep(value) {
|
|
209
|
+
return ((value === null || value === void 0 ? void 0 : value.getStepName) &&
|
|
210
|
+
value.getStepName() === CreateVariableStep.stepName &&
|
|
211
|
+
!!value.generationType);
|
|
212
|
+
}
|
|
213
|
+
exports.isCreateVariableStep = isCreateVariableStep;
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
return
|
|
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
|
-
|
|
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}`;
|
|
@@ -27,5 +29,6 @@ class EchoStep extends MablStep_1.MablStep {
|
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
exports.EchoStep = EchoStep;
|
|
32
|
+
EchoStep.stepName = 'Echo';
|
|
30
33
|
EchoStep.mablScriptStepNames = ['echo'];
|
|
31
|
-
EchoStep.yamlMablScriptNames = [
|
|
34
|
+
EchoStep.yamlMablScriptNames = [EchoStep.stepName];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ElseIfConditionStep = void 0;
|
|
3
|
+
exports.isElseIfConditionStep = exports.ElseIfConditionStep = void 0;
|
|
4
4
|
const MablAction_1 = require("../MablAction");
|
|
5
5
|
const IfConditionStep_1 = require("./IfConditionStep");
|
|
6
6
|
class ElseIfConditionStep extends IfConditionStep_1.IfConditionStep {
|
|
@@ -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 = [
|
|
11
|
+
const actions = [
|
|
12
|
+
new MablAction_1.MablAction('conditional_else', 'conditional_else_if', []),
|
|
13
|
+
];
|
|
12
14
|
actions.push(...IfConditionStep_1.IfConditionStep.getActionsFromYamlForCondition(stepArgs));
|
|
13
|
-
|
|
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()}.`, '');
|
|
@@ -18,5 +22,11 @@ class ElseIfConditionStep extends IfConditionStep_1.IfConditionStep {
|
|
|
18
22
|
}
|
|
19
23
|
}
|
|
20
24
|
exports.ElseIfConditionStep = ElseIfConditionStep;
|
|
21
|
-
ElseIfConditionStep.
|
|
25
|
+
ElseIfConditionStep.stepName = 'conditional_else_if';
|
|
26
|
+
ElseIfConditionStep.mablScriptStepNames = [ElseIfConditionStep.stepName];
|
|
22
27
|
ElseIfConditionStep.yamlMablScriptNames = ['ElseIf'];
|
|
28
|
+
function isElseIfConditionStep(value) {
|
|
29
|
+
return ((value === null || value === void 0 ? void 0 : value.getStepName) &&
|
|
30
|
+
(value === null || value === void 0 ? void 0 : value.getStepName()) === ElseIfConditionStep.yamlMablScriptNames[0]);
|
|
31
|
+
}
|
|
32
|
+
exports.isElseIfConditionStep = isElseIfConditionStep;
|
|
@@ -4,21 +4,24 @@ 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,
|
|
16
|
-
|
|
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()`;
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
exports.ElseStep = ElseStep;
|
|
23
|
-
ElseStep.
|
|
25
|
+
ElseStep.stepName = 'conditional_else';
|
|
26
|
+
ElseStep.mablScriptStepNames = [ElseStep.stepName];
|
|
24
27
|
ElseStep.yamlMablScriptNames = ['Else'];
|
|
@@ -4,21 +4,24 @@ 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,
|
|
16
|
-
|
|
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()`;
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
exports.EndStep = EndStep;
|
|
23
|
-
EndStep.
|
|
25
|
+
EndStep.stepName = 'conditional_end';
|
|
26
|
+
EndStep.mablScriptStepNames = [EndStep.stepName];
|
|
24
27
|
EndStep.yamlMablScriptNames = ['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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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)({
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EvaluateJavaScriptStep = void 0;
|
|
3
|
+
exports.isEvaluateJavaScriptStep = exports.EvaluateJavaScriptStep = void 0;
|
|
4
4
|
const MablStep_1 = require("../MablStep");
|
|
5
5
|
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
|
-
|
|
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
|
-
|
|
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();
|
|
@@ -35,5 +41,10 @@ class EvaluateJavaScriptStep extends MablStep_1.MablStep {
|
|
|
35
41
|
}
|
|
36
42
|
}
|
|
37
43
|
exports.EvaluateJavaScriptStep = EvaluateJavaScriptStep;
|
|
44
|
+
EvaluateJavaScriptStep.stepName = STEP_NAME;
|
|
38
45
|
EvaluateJavaScriptStep.mablScriptStepNames = [JavaScriptAction_1.JavaScriptAction.mablscriptName];
|
|
39
46
|
EvaluateJavaScriptStep.yamlMablScriptNames = [STEP_NAME];
|
|
47
|
+
function isEvaluateJavaScriptStep(value) {
|
|
48
|
+
return (value === null || value === void 0 ? void 0 : value.getStepName) && (value === null || value === void 0 ? void 0 : value.getStepName()) === STEP_NAME;
|
|
49
|
+
}
|
|
50
|
+
exports.isEvaluateJavaScriptStep = isEvaluateJavaScriptStep;
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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()`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IfConditionStep = void 0;
|
|
3
|
+
exports.isIfConditionStep = exports.IfConditionStep = void 0;
|
|
4
4
|
const ConditionAction_1 = require("../actions/ConditionAction");
|
|
5
5
|
const GetVariableValue_1 = require("../actions/GetVariableValue");
|
|
6
6
|
const AssertStep_1 = require("./AssertStep");
|
|
@@ -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() {
|
|
@@ -56,7 +60,7 @@ class IfConditionStep extends MablStep_1.MablStep {
|
|
|
56
60
|
if (this.conditionAction) {
|
|
57
61
|
details.condition =
|
|
58
62
|
AssertStep_1.fieldToAssertionStep[this.conditionAction.conditionAttribute];
|
|
59
|
-
if (this.conditionAction.conditionValueAttribute) {
|
|
63
|
+
if (this.conditionAction.conditionValueAttribute !== undefined) {
|
|
60
64
|
details.conditionValue = this.conditionAction.conditionValueAttribute;
|
|
61
65
|
}
|
|
62
66
|
if (this.conditionAction.options !== undefined) {
|
|
@@ -67,12 +71,13 @@ class IfConditionStep extends MablStep_1.MablStep {
|
|
|
67
71
|
details.variableName = this.substituteMablscriptVariable(this.primaryAction.variable);
|
|
68
72
|
}
|
|
69
73
|
if (this.primaryAction instanceof JavaScriptAction_1.JavaScriptAction) {
|
|
70
|
-
const jsYaml = this.primaryAction.
|
|
71
|
-
if (jsYaml.
|
|
72
|
-
details.
|
|
74
|
+
const jsYaml = JavaScriptAction_1.JavaScriptAction.toYamlFromJavaScriptDescriptor(this.primaryAction.javaScript);
|
|
75
|
+
if (jsYaml.snippet) {
|
|
76
|
+
details.snippet = jsYaml.snippet;
|
|
77
|
+
details.snippet.parameterOverrides = jsYaml.parameterOverrides;
|
|
73
78
|
}
|
|
74
|
-
|
|
75
|
-
details.
|
|
79
|
+
else {
|
|
80
|
+
details.snippet = jsYaml;
|
|
76
81
|
}
|
|
77
82
|
}
|
|
78
83
|
if (this.extractAction) {
|
|
@@ -114,8 +119,8 @@ class IfConditionStep extends MablStep_1.MablStep {
|
|
|
114
119
|
`{{@${stepArgs.variableName}}}`,
|
|
115
120
|
]));
|
|
116
121
|
}
|
|
117
|
-
if (stepArgs.
|
|
118
|
-
actions.push(JavaScriptAction_1.JavaScriptAction.fromYaml(stepArgs));
|
|
122
|
+
if (stepArgs.snippet) {
|
|
123
|
+
actions.push(JavaScriptAction_1.JavaScriptAction.fromYaml(stepArgs.snippet));
|
|
119
124
|
}
|
|
120
125
|
if (stepArgs.condition) {
|
|
121
126
|
const conditionType = AssertStep_1.assertionStepToField[stepArgs.condition];
|
|
@@ -131,7 +136,9 @@ class IfConditionStep extends MablStep_1.MablStep {
|
|
|
131
136
|
}
|
|
132
137
|
static fromYaml(_stepName, stepArgs) {
|
|
133
138
|
const actions = IfConditionStep.getActionsFromYamlForCondition(stepArgs);
|
|
134
|
-
|
|
139
|
+
const step = new IfConditionStep('conditional_if', [], actions);
|
|
140
|
+
step.setStepId(stepArgs.id);
|
|
141
|
+
return step;
|
|
135
142
|
}
|
|
136
143
|
toMablscript() {
|
|
137
144
|
return `${this.actions.reduce((mablscript, action) => `${mablscript}${action.toMablscript()}.`, '')}conditional_if()`;
|
|
@@ -146,5 +153,11 @@ class IfConditionStep extends MablStep_1.MablStep {
|
|
|
146
153
|
}
|
|
147
154
|
}
|
|
148
155
|
exports.IfConditionStep = IfConditionStep;
|
|
149
|
-
IfConditionStep.
|
|
156
|
+
IfConditionStep.stepName = 'conditional_if';
|
|
157
|
+
IfConditionStep.mablScriptStepNames = [IfConditionStep.stepName];
|
|
150
158
|
IfConditionStep.yamlMablScriptNames = ['If'];
|
|
159
|
+
function isIfConditionStep(value) {
|
|
160
|
+
return ((value === null || value === void 0 ? void 0 : value.getStepName) &&
|
|
161
|
+
(value === null || value === void 0 ? void 0 : value.getStepName()) === IfConditionStep.yamlMablScriptNames[0]);
|
|
162
|
+
}
|
|
163
|
+
exports.isIfConditionStep = isIfConditionStep;
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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}")`;
|