@mablhq/mabl-cli 2.72.0 → 2.72.4
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/browserLauncher/index.js +3 -3
- package/core/execution/ApiTestUtils.js +12 -2
- package/execution/index.js +1 -1
- package/mablscript/MablStepV2.js +10 -40
- package/mablscript/MablStepWithFindAction.js +2 -126
- package/mablscript/actions/AwaitDownloadAction.js +3 -4
- package/mablscript/actions/AwaitPDFDownloadAction.js +5 -6
- package/mablscript/actions/ConditionAction.js +1 -2
- package/mablscript/actions/ExtractAction.js +13 -8
- package/mablscript/actions/FindAction.js +0 -20
- package/mablscript/actions/GetVariableValue.js +4 -15
- package/mablscript/actions/JavaScriptAction.js +39 -25
- package/mablscript/diffing/diffingUtil.js +5 -5
- package/mablscript/importer.js +59 -79
- package/mablscript/mobile/steps/CreateVariableMobileStep.js +1 -3
- package/mablscript/mobile/steps/stepUtil.js +2 -2
- package/mablscript/steps/AbstractAssertionsAndVariablesStep.js +8 -10
- package/mablscript/steps/AccessibilityCheck.js +36 -76
- package/mablscript/steps/AssertStep.js +86 -266
- package/mablscript/steps/AssertStepOld.js +139 -69
- package/mablscript/steps/AwaitTabStep.js +9 -30
- package/mablscript/steps/AwaitUploadsStep.js +8 -22
- package/mablscript/steps/ClearCookiesStep.js +8 -22
- package/mablscript/steps/ClickAndHoldStep.js +47 -45
- package/mablscript/steps/ClickStep.js +33 -36
- package/mablscript/steps/CreateVariableStep.js +137 -169
- package/mablscript/steps/DatabaseQueryStep.js +4 -14
- package/mablscript/steps/DoubleClickStep.js +40 -37
- package/mablscript/steps/DownloadStep.js +63 -79
- package/mablscript/steps/EchoStep.js +8 -26
- package/mablscript/steps/ElseIfConditionStep.js +12 -23
- package/mablscript/steps/ElseStep.js +9 -22
- package/mablscript/steps/EndStep.js +9 -22
- package/mablscript/steps/EnterAuthCodeStep.js +34 -36
- package/mablscript/steps/EnterTextStep.js +64 -51
- package/mablscript/steps/EvaluateFlowStep.js +18 -39
- package/mablscript/steps/EvaluateJavaScriptStep.js +19 -17
- package/mablscript/steps/HoverStep.js +39 -37
- package/mablscript/steps/IfConditionStep.js +99 -139
- package/mablscript/steps/NavigateStep.js +9 -29
- package/mablscript/steps/OpenEmailStep.js +21 -39
- package/mablscript/steps/ReleaseStep.js +38 -46
- package/mablscript/steps/RemoveCookieStep.js +9 -25
- package/mablscript/steps/RightClickStep.js +33 -36
- package/mablscript/steps/SelectStep.js +46 -69
- package/mablscript/steps/SendHttpRequestStep.js +4 -13
- package/mablscript/steps/SendKeyStep.js +50 -174
- package/mablscript/steps/SetCookieStep.js +23 -56
- package/mablscript/steps/SetFilesStep.js +43 -42
- package/mablscript/steps/SetViewportStep.js +13 -39
- package/mablscript/steps/SwitchContextStep.js +83 -89
- package/mablscript/steps/SyntheticStep.js +1 -1
- package/mablscript/steps/VisitUrlStep.js +22 -30
- package/mablscript/steps/WaitStep.js +9 -20
- package/mablscript/steps/WaitUntilStep.js +14 -31
- package/mablscript/types/ConditionDescriptor.js +5 -5
- package/mablscript/types/GetVariableDescriptor.js +8 -0
- package/package.json +3 -3
- package/mablscript/steps/StepGroupStep.js +0 -70
- package/mablscript/types/AssertStepDescriptor.js +0 -2
- package/mablscript/types/StepGroupStepDescriptor.js +0 -2
|
@@ -1,111 +1,95 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DownloadStep = void 0;
|
|
4
|
-
const
|
|
4
|
+
const MablStep_1 = require("../MablStep");
|
|
5
5
|
const MablAction_1 = require("../MablAction");
|
|
6
6
|
const AwaitDownloadAction_1 = require("../actions/AwaitDownloadAction");
|
|
7
7
|
const AwaitPDFDownloadAction_1 = require("../actions/AwaitPDFDownloadAction");
|
|
8
8
|
const domUtil_1 = require("../../domUtil");
|
|
9
|
-
class DownloadStep extends
|
|
10
|
-
constructor(
|
|
11
|
-
super(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
throw new Error('DownloadPdfStep must have a tabIdentifier');
|
|
16
|
-
}
|
|
17
|
-
this.awaitDownloadAction = new AwaitPDFDownloadAction_1.AwaitPDFDownloadAction('await_pdf', [
|
|
18
|
-
{ uuid: descriptor.tabIdentifier },
|
|
19
|
-
]);
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
this.awaitDownloadAction = new AwaitDownloadAction_1.AwaitDownloadAction('await_download', []);
|
|
23
|
-
}
|
|
24
|
-
this.fileAttributes =
|
|
25
|
-
DownloadStep.populateDownloadArgsFromDescriptor(descriptor);
|
|
26
|
-
}
|
|
27
|
-
static populateDownloadArgsFromDescriptor(descriptor) {
|
|
28
|
-
return {
|
|
29
|
-
file_name: descriptor.fileName,
|
|
30
|
-
file_mime_type: descriptor.mimeType,
|
|
31
|
-
file_md5: descriptor.fileMd5,
|
|
32
|
-
file_sha256: descriptor.fileSha256,
|
|
33
|
-
file_size_bytes: descriptor.sizeBytes,
|
|
34
|
-
file_size_bytes_max: descriptor.sizeBytesMax,
|
|
35
|
-
file_size_bytes_min: descriptor.sizeBytesMin,
|
|
36
|
-
};
|
|
9
|
+
class DownloadStep extends MablStep_1.MablStep {
|
|
10
|
+
constructor(name, args, actions) {
|
|
11
|
+
super(name, args, actions, 'assert_download');
|
|
12
|
+
this.validate();
|
|
13
|
+
this.fileAttributes = (this.getActionArgs()[0] ?? {});
|
|
14
|
+
this.awaitDownloadAction = this.actions[0];
|
|
37
15
|
}
|
|
38
|
-
validate(
|
|
39
|
-
if (actions.length !== 1 &&
|
|
16
|
+
validate() {
|
|
17
|
+
if (this.actions.length !== 1 &&
|
|
18
|
+
!(this.actions[0] instanceof AwaitDownloadAction_1.AwaitDownloadAction)) {
|
|
40
19
|
throw new Error('Download step should contain an await download sub action');
|
|
41
20
|
}
|
|
42
21
|
}
|
|
43
22
|
getStepName() {
|
|
44
23
|
if (this.isPDFDownload()) {
|
|
45
|
-
return
|
|
24
|
+
return 'DownloadPdfStep';
|
|
46
25
|
}
|
|
47
|
-
return DownloadStep
|
|
26
|
+
return 'DownloadStep';
|
|
48
27
|
}
|
|
49
28
|
isPDFDownload() {
|
|
50
29
|
return this.awaitDownloadAction instanceof AwaitPDFDownloadAction_1.AwaitPDFDownloadAction;
|
|
51
30
|
}
|
|
52
31
|
toStepDescriptor() {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
DownloadStep.validateLegacyActions(actions);
|
|
63
|
-
const fileAttributes = (args[0] ?? {});
|
|
64
|
-
const awaitDownloadAction = actions[0];
|
|
65
|
-
const stepDescriptor = {
|
|
66
|
-
fileName: fileAttributes.file_name,
|
|
67
|
-
mimeType: fileAttributes.file_mime_type,
|
|
68
|
-
sizeBytes: fileAttributes.file_size_bytes,
|
|
69
|
-
sizeBytesMax: fileAttributes.file_size_bytes_max,
|
|
70
|
-
sizeBytesMin: fileAttributes.file_size_bytes_min,
|
|
71
|
-
fileMd5: fileAttributes.file_md5,
|
|
72
|
-
fileSha256: fileAttributes.file_sha256,
|
|
73
|
-
};
|
|
74
|
-
const isPdfDownload = awaitDownloadAction instanceof AwaitPDFDownloadAction_1.AwaitPDFDownloadAction;
|
|
75
|
-
if (isPdfDownload) {
|
|
76
|
-
stepDescriptor.tabIdentifier = awaitDownloadAction.pdfUUID;
|
|
32
|
+
const formatted = {};
|
|
33
|
+
if (this.isPDFDownload()) {
|
|
34
|
+
formatted.tabIdentifier = this.actions[0].pdfUUID;
|
|
35
|
+
}
|
|
36
|
+
if (this.fileAttributes.file_name !== undefined) {
|
|
37
|
+
formatted.fileName = this.fileAttributes.file_name;
|
|
38
|
+
}
|
|
39
|
+
if (this.fileAttributes.file_mime_type !== undefined) {
|
|
40
|
+
formatted.mimeType = this.fileAttributes.file_mime_type;
|
|
77
41
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
42
|
+
if (this.fileAttributes.file_md5 !== undefined) {
|
|
43
|
+
formatted.fileMd5 = this.fileAttributes.file_md5;
|
|
44
|
+
}
|
|
45
|
+
if (this.fileAttributes.file_sha256 !== undefined) {
|
|
46
|
+
formatted.fileSha256 = this.fileAttributes.file_sha256;
|
|
47
|
+
}
|
|
48
|
+
if (this.fileAttributes.file_size_bytes !== undefined) {
|
|
49
|
+
formatted.sizeBytes = this.fileAttributes.file_size_bytes;
|
|
50
|
+
}
|
|
51
|
+
if (this.fileAttributes.file_size_bytes_max !== undefined) {
|
|
52
|
+
formatted.sizeBytesMax = this.fileAttributes.file_size_bytes_max;
|
|
53
|
+
}
|
|
54
|
+
if (this.fileAttributes.file_size_bytes_min !== undefined) {
|
|
55
|
+
formatted.sizeBytesMin = this.fileAttributes.file_size_bytes_min;
|
|
56
|
+
}
|
|
57
|
+
return formatted;
|
|
82
58
|
}
|
|
83
|
-
static
|
|
84
|
-
|
|
85
|
-
|
|
59
|
+
static fromYaml(_stepName, stepArgs) {
|
|
60
|
+
const fileAttributes = {};
|
|
61
|
+
const assertDownload = stepArgs;
|
|
62
|
+
fileAttributes.file_name = assertDownload.fileName;
|
|
63
|
+
fileAttributes.file_mime_type = assertDownload.mimeType;
|
|
64
|
+
fileAttributes.file_md5 = assertDownload.fileMd5;
|
|
65
|
+
fileAttributes.file_sha256 = assertDownload.fileSha256;
|
|
66
|
+
fileAttributes.file_size_bytes = assertDownload.sizeBytes;
|
|
67
|
+
fileAttributes.file_size_bytes_max = assertDownload.sizeBytesMax;
|
|
68
|
+
fileAttributes.file_size_bytes_min = assertDownload.sizeBytesMin;
|
|
69
|
+
let awaitDownloadAction;
|
|
70
|
+
if (assertDownload.tabIdentifier) {
|
|
71
|
+
awaitDownloadAction = new AwaitPDFDownloadAction_1.AwaitPDFDownloadAction('await_pdf', [
|
|
72
|
+
{ uuid: assertDownload.tabIdentifier },
|
|
73
|
+
]);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
awaitDownloadAction = new AwaitDownloadAction_1.AwaitDownloadAction('await_download', []);
|
|
86
77
|
}
|
|
78
|
+
const step = new DownloadStep('assert_download', [fileAttributes], [awaitDownloadAction]);
|
|
79
|
+
step.setStepId(stepArgs.id);
|
|
80
|
+
return step;
|
|
87
81
|
}
|
|
88
82
|
toMablscript() {
|
|
89
|
-
const meaningfulAttributes = DownloadStep.populateDownloadArgsFromDescriptor(this.toStepDescriptor());
|
|
90
83
|
const mablArgs = (0, domUtil_1.buildStepArgumentString)({
|
|
91
|
-
params:
|
|
84
|
+
params: { ...this.fileAttributes },
|
|
92
85
|
legacy: true,
|
|
93
86
|
});
|
|
94
|
-
return `${this.awaitDownloadAction.toMablscript()}.assert_download(${mablArgs
|
|
87
|
+
return `${this.awaitDownloadAction.toMablscript()}.assert_download(${mablArgs ? mablArgs : ''})`;
|
|
95
88
|
}
|
|
96
89
|
getInputVariables() {
|
|
97
|
-
return MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.
|
|
98
|
-
}
|
|
99
|
-
stepDescription() {
|
|
100
|
-
return 'Assert file download';
|
|
90
|
+
return MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.fileAttributes);
|
|
101
91
|
}
|
|
102
92
|
}
|
|
103
93
|
exports.DownloadStep = DownloadStep;
|
|
104
|
-
DownloadStep.
|
|
105
|
-
DownloadStep.
|
|
106
|
-
DownloadStep.actionCode = 'assert_download';
|
|
107
|
-
DownloadStep.mablScriptStepNames = [DownloadStep.actionCode];
|
|
108
|
-
DownloadStep.yamlMablScriptNames = [
|
|
109
|
-
DownloadStep.stepName,
|
|
110
|
-
DownloadStep.pdfStepName,
|
|
111
|
-
];
|
|
94
|
+
DownloadStep.mablScriptStepNames = ['assert_download'];
|
|
95
|
+
DownloadStep.yamlMablScriptNames = ['DownloadStep', 'DownloadPdfStep'];
|
|
@@ -1,39 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EchoStep = void 0;
|
|
4
|
+
const MablStep_1 = require("../MablStep");
|
|
4
5
|
const domUtil_1 = require("../../domUtil");
|
|
5
6
|
const MablAction_1 = require("../MablAction");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
this.echoValue = descriptor.value;
|
|
11
|
-
}
|
|
12
|
-
static getStepName() {
|
|
13
|
-
return EchoStep.stepName;
|
|
7
|
+
class EchoStep extends MablStep_1.MablStep {
|
|
8
|
+
constructor(name, args, actions) {
|
|
9
|
+
super(name, args, actions, 'echo');
|
|
10
|
+
this.echoValue = (0, MablAction_1.parseArgument)(this.getActionArgs()[0]);
|
|
14
11
|
}
|
|
15
12
|
getStepName() {
|
|
16
13
|
return EchoStep.stepName;
|
|
17
14
|
}
|
|
18
15
|
toStepDescriptor() {
|
|
19
|
-
return { value: this.echoValue, actionCode: this.actionCode };
|
|
16
|
+
return { value: this.echoValue.toString(), actionCode: this.actionCode };
|
|
20
17
|
}
|
|
21
18
|
static fromYaml(_stepName, stepArgs) {
|
|
22
|
-
const
|
|
23
|
-
actionCode: EchoStep.actionCode,
|
|
24
|
-
value: (0, MablAction_1.parseArgument)(stepArgs.value),
|
|
25
|
-
};
|
|
26
|
-
const step = new EchoStep(stepDescriptor);
|
|
19
|
+
const step = new EchoStep(EchoStep.stepName, [stepArgs.value], []);
|
|
27
20
|
step.setStepId(stepArgs.id);
|
|
28
21
|
return step;
|
|
29
22
|
}
|
|
30
|
-
static fromLegacyMablscript(args, _actions) {
|
|
31
|
-
const stepDescriptor = {
|
|
32
|
-
actionCode: EchoStep.actionCode,
|
|
33
|
-
value: (0, MablAction_1.parseArgument)(args[0]),
|
|
34
|
-
};
|
|
35
|
-
return new EchoStep(stepDescriptor);
|
|
36
|
-
}
|
|
37
23
|
toMablscript() {
|
|
38
24
|
const stringEchoValue = `${this.echoValue}`;
|
|
39
25
|
return `echo("${(0, domUtil_1.escapeMablscriptString)(stringEchoValue)}")`;
|
|
@@ -41,12 +27,8 @@ class EchoStep extends MablStepV2_1.MablStepV2 {
|
|
|
41
27
|
getInputVariables() {
|
|
42
28
|
return MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.echoValue);
|
|
43
29
|
}
|
|
44
|
-
stepDescription() {
|
|
45
|
-
return `Echo: "${this.echoValue}"`;
|
|
46
|
-
}
|
|
47
30
|
}
|
|
48
31
|
exports.EchoStep = EchoStep;
|
|
49
32
|
EchoStep.stepName = 'Echo';
|
|
50
|
-
EchoStep.
|
|
51
|
-
EchoStep.mablScriptStepNames = [EchoStep.actionCode];
|
|
33
|
+
EchoStep.mablScriptStepNames = ['echo'];
|
|
52
34
|
EchoStep.yamlMablScriptNames = [EchoStep.stepName];
|
|
@@ -2,41 +2,30 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ElseIfConditionStep = void 0;
|
|
4
4
|
exports.isElseIfConditionStep = isElseIfConditionStep;
|
|
5
|
+
const MablAction_1 = require("../MablAction");
|
|
5
6
|
const IfConditionStep_1 = require("./IfConditionStep");
|
|
6
7
|
class ElseIfConditionStep extends IfConditionStep_1.IfConditionStep {
|
|
7
|
-
constructor(descriptor, stepActions) {
|
|
8
|
-
super(ElseIfConditionStep.stepName, ElseIfConditionStep.actionCode, descriptor, stepActions);
|
|
9
|
-
}
|
|
10
8
|
getStepName() {
|
|
11
|
-
return
|
|
9
|
+
return 'ElseIf';
|
|
12
10
|
}
|
|
13
11
|
static fromYaml(_stepName, stepArgs) {
|
|
14
|
-
const actions =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
const actions = [
|
|
13
|
+
new MablAction_1.MablAction('conditional_else', 'conditional_else_if', []),
|
|
14
|
+
];
|
|
15
|
+
actions.push(...IfConditionStep_1.IfConditionStep.getActionsFromYamlForCondition(stepArgs));
|
|
16
|
+
const step = new ElseIfConditionStep('conditional_else_if', [], actions);
|
|
18
17
|
step.setStepId(stepArgs.id);
|
|
19
18
|
return step;
|
|
20
19
|
}
|
|
21
|
-
static fromLegacyMablscript(_args, actions) {
|
|
22
|
-
const validatedActions = IfConditionStep_1.IfConditionStep.validateAndParseActions(actions);
|
|
23
|
-
const stepDescriptor = IfConditionStep_1.IfConditionStep.buildDescriptor(validatedActions);
|
|
24
|
-
return new ElseIfConditionStep(stepDescriptor, validatedActions);
|
|
25
|
-
}
|
|
26
20
|
toMablscript() {
|
|
27
|
-
const actions =
|
|
28
|
-
|
|
29
|
-
this.extractAction,
|
|
30
|
-
this.conditionAction,
|
|
31
|
-
].filter(Boolean);
|
|
32
|
-
return `conditional_else().${actions.reduce((mablscript, action) => `${mablscript}${action?.toMablscript()}.`, '')}conditional_else_if()`;
|
|
21
|
+
const actions = this.actions.reduce((mablscript, action) => `${mablscript}${action.toMablscript()}.`, '');
|
|
22
|
+
return `conditional_else()${actions}conditional_else_if()`;
|
|
33
23
|
}
|
|
34
24
|
}
|
|
35
25
|
exports.ElseIfConditionStep = ElseIfConditionStep;
|
|
36
|
-
ElseIfConditionStep.stepName = '
|
|
37
|
-
ElseIfConditionStep.
|
|
38
|
-
ElseIfConditionStep.
|
|
39
|
-
ElseIfConditionStep.yamlMablScriptNames = [ElseIfConditionStep.stepName];
|
|
26
|
+
ElseIfConditionStep.stepName = 'conditional_else_if';
|
|
27
|
+
ElseIfConditionStep.mablScriptStepNames = [ElseIfConditionStep.stepName];
|
|
28
|
+
ElseIfConditionStep.yamlMablScriptNames = ['ElseIf'];
|
|
40
29
|
function isElseIfConditionStep(value) {
|
|
41
30
|
return (value?.getStepName &&
|
|
42
31
|
value?.getStepName() === ElseIfConditionStep.yamlMablScriptNames[0]);
|
|
@@ -1,40 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ElseStep = void 0;
|
|
4
|
-
const
|
|
5
|
-
class ElseStep extends
|
|
6
|
-
constructor(
|
|
7
|
-
super(
|
|
4
|
+
const MablStep_1 = require("../MablStep");
|
|
5
|
+
class ElseStep extends MablStep_1.MablStep {
|
|
6
|
+
constructor(name, args, actions) {
|
|
7
|
+
super(name, args, actions, 'conditional_else');
|
|
8
8
|
}
|
|
9
9
|
getStepName() {
|
|
10
|
-
return
|
|
10
|
+
return 'Else';
|
|
11
11
|
}
|
|
12
12
|
toStepDescriptor() {
|
|
13
13
|
return { actionCode: this.actionCode };
|
|
14
14
|
}
|
|
15
15
|
static fromYaml(_stepName, stepArgs) {
|
|
16
|
-
const
|
|
17
|
-
actionCode: ElseStep.actionCode,
|
|
18
|
-
};
|
|
19
|
-
const step = new ElseStep(stepDescriptor);
|
|
16
|
+
const step = new ElseStep('conditional_else', [], []);
|
|
20
17
|
step.setStepId(stepArgs.id);
|
|
21
18
|
return step;
|
|
22
19
|
}
|
|
23
|
-
static fromLegacyMablscript(_args, _actions) {
|
|
24
|
-
const stepDescriptor = {
|
|
25
|
-
actionCode: ElseStep.actionCode,
|
|
26
|
-
};
|
|
27
|
-
return new ElseStep(stepDescriptor);
|
|
28
|
-
}
|
|
29
20
|
toMablscript() {
|
|
30
21
|
return `conditional_else()`;
|
|
31
22
|
}
|
|
32
|
-
stepDescription() {
|
|
33
|
-
return 'ELSE';
|
|
34
|
-
}
|
|
35
23
|
}
|
|
36
24
|
exports.ElseStep = ElseStep;
|
|
37
|
-
ElseStep.stepName = '
|
|
38
|
-
ElseStep.
|
|
39
|
-
ElseStep.
|
|
40
|
-
ElseStep.yamlMablScriptNames = [ElseStep.stepName];
|
|
25
|
+
ElseStep.stepName = 'conditional_else';
|
|
26
|
+
ElseStep.mablScriptStepNames = [ElseStep.stepName];
|
|
27
|
+
ElseStep.yamlMablScriptNames = ['Else'];
|
|
@@ -1,40 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EndStep = void 0;
|
|
4
|
-
const
|
|
5
|
-
class EndStep extends
|
|
6
|
-
constructor(
|
|
7
|
-
super(
|
|
4
|
+
const MablStep_1 = require("../MablStep");
|
|
5
|
+
class EndStep extends MablStep_1.MablStep {
|
|
6
|
+
constructor(name, args, actions) {
|
|
7
|
+
super(name, args, actions, 'conditional_end');
|
|
8
8
|
}
|
|
9
9
|
getStepName() {
|
|
10
|
-
return
|
|
10
|
+
return 'End';
|
|
11
11
|
}
|
|
12
12
|
toStepDescriptor() {
|
|
13
13
|
return { actionCode: this.actionCode };
|
|
14
14
|
}
|
|
15
15
|
static fromYaml(_stepName, stepArgs) {
|
|
16
|
-
const
|
|
17
|
-
actionCode: EndStep.actionCode,
|
|
18
|
-
};
|
|
19
|
-
const step = new EndStep(stepDescriptor);
|
|
16
|
+
const step = new EndStep('conditional_end', [], []);
|
|
20
17
|
step.setStepId(stepArgs.id);
|
|
21
18
|
return step;
|
|
22
19
|
}
|
|
23
|
-
static fromLegacyMablscript(_args, _actions) {
|
|
24
|
-
const stepDescriptor = {
|
|
25
|
-
actionCode: EndStep.actionCode,
|
|
26
|
-
};
|
|
27
|
-
return new EndStep(stepDescriptor);
|
|
28
|
-
}
|
|
29
20
|
toMablscript() {
|
|
30
21
|
return `conditional_end()`;
|
|
31
22
|
}
|
|
32
|
-
stepDescription() {
|
|
33
|
-
return 'END';
|
|
34
|
-
}
|
|
35
23
|
}
|
|
36
24
|
exports.EndStep = EndStep;
|
|
37
|
-
EndStep.stepName = '
|
|
38
|
-
EndStep.
|
|
39
|
-
EndStep.
|
|
40
|
-
EndStep.yamlMablScriptNames = [EndStep.stepName];
|
|
25
|
+
EndStep.stepName = 'conditional_end';
|
|
26
|
+
EndStep.mablScriptStepNames = [EndStep.stepName];
|
|
27
|
+
EndStep.yamlMablScriptNames = ['End'];
|
|
@@ -6,56 +6,54 @@ const domUtil_1 = require("../../domUtil");
|
|
|
6
6
|
const ActionsUtils_1 = require("./ActionsUtils");
|
|
7
7
|
const MablStepWithFindAction_1 = require("../MablStepWithFindAction");
|
|
8
8
|
class EnterAuthCodeStep extends MablStepWithFindAction_1.MablStepWithFindAction {
|
|
9
|
-
constructor(
|
|
10
|
-
super(
|
|
9
|
+
constructor(name, args, actions) {
|
|
10
|
+
super(name, args, actions, EnterAuthCodeStep.stepName);
|
|
11
|
+
this.findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(this.actions);
|
|
11
12
|
}
|
|
12
13
|
getStepName() {
|
|
13
|
-
return
|
|
14
|
+
return 'EnterAuthCode';
|
|
14
15
|
}
|
|
15
16
|
toStepDescriptor() {
|
|
16
|
-
|
|
17
|
+
const find = this.findAction.toDescriptor();
|
|
18
|
+
switch (find.findType) {
|
|
19
|
+
case domUtil_1.FindType.FIND_FIRST:
|
|
20
|
+
case domUtil_1.FindType.FIND_LAST:
|
|
21
|
+
case domUtil_1.FindType.FIND_ANY:
|
|
22
|
+
case domUtil_1.FindType.FIND_ONE:
|
|
23
|
+
return {
|
|
24
|
+
find,
|
|
25
|
+
descriptorToActionMap: new Map().set(find, this.findAction),
|
|
26
|
+
actionCode: this.actionCode,
|
|
27
|
+
};
|
|
28
|
+
default:
|
|
29
|
+
throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
getFormattedStep(_fullLocatorsOn) {
|
|
33
|
+
const step = {
|
|
34
|
+
EnterAuthCode: {
|
|
35
|
+
...super.annotationsAsYml(),
|
|
36
|
+
...this.findAction.toYaml(),
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
if (this.stepId()) {
|
|
40
|
+
step.EnterAuthCode.id = this.stepId();
|
|
41
|
+
}
|
|
42
|
+
return step;
|
|
17
43
|
}
|
|
18
44
|
static fromYaml(_stepName, stepArgs) {
|
|
19
|
-
const
|
|
20
|
-
const stepDescriptor = buildStepDescriptor(findAction);
|
|
21
|
-
const step = new EnterAuthCodeStep(stepDescriptor, findAction);
|
|
45
|
+
const step = new EnterAuthCodeStep(EnterAuthCodeStep.stepName, [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
|
|
22
46
|
step.setStepId(stepArgs.id);
|
|
23
47
|
return step;
|
|
24
48
|
}
|
|
25
|
-
static fromLegacyMablscript(_args, actions) {
|
|
26
|
-
const findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(actions);
|
|
27
|
-
const stepDescriptor = buildStepDescriptor(findAction);
|
|
28
|
-
return new EnterAuthCodeStep(stepDescriptor, findAction);
|
|
29
|
-
}
|
|
30
49
|
toMablscript() {
|
|
31
50
|
return `${this.findAction.toMablscript()}.enter_auth_code()`;
|
|
32
51
|
}
|
|
33
52
|
getInputVariables() {
|
|
34
53
|
return this.findAction.getInputVariables();
|
|
35
54
|
}
|
|
36
|
-
stepDescription() {
|
|
37
|
-
const elementDescription = this.humanizeFind();
|
|
38
|
-
return `Enter authentication code into ${elementDescription}`;
|
|
39
|
-
}
|
|
40
55
|
}
|
|
41
56
|
exports.EnterAuthCodeStep = EnterAuthCodeStep;
|
|
42
|
-
EnterAuthCodeStep.stepName = '
|
|
43
|
-
EnterAuthCodeStep.
|
|
44
|
-
EnterAuthCodeStep.
|
|
45
|
-
EnterAuthCodeStep.yamlMablScriptNames = [EnterAuthCodeStep.stepName];
|
|
46
|
-
function buildStepDescriptor(findAction) {
|
|
47
|
-
const find = findAction.toDescriptor();
|
|
48
|
-
switch (find.findType) {
|
|
49
|
-
case domUtil_1.FindType.FIND_FIRST:
|
|
50
|
-
case domUtil_1.FindType.FIND_LAST:
|
|
51
|
-
case domUtil_1.FindType.FIND_ANY:
|
|
52
|
-
case domUtil_1.FindType.FIND_ONE:
|
|
53
|
-
return {
|
|
54
|
-
find,
|
|
55
|
-
descriptorToActionMap: new Map().set(find, findAction),
|
|
56
|
-
actionCode: EnterAuthCodeStep.actionCode,
|
|
57
|
-
};
|
|
58
|
-
default:
|
|
59
|
-
throw new Error(`Error generating step descriptor for EnterAuthCode: Unexpected find type ${find.findType}`);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
57
|
+
EnterAuthCodeStep.stepName = 'enter_auth_code';
|
|
58
|
+
EnterAuthCodeStep.mablScriptStepNames = [EnterAuthCodeStep.stepName];
|
|
59
|
+
EnterAuthCodeStep.yamlMablScriptNames = ['EnterAuthCode'];
|
|
@@ -3,41 +3,80 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.EnterTextStep = void 0;
|
|
4
4
|
const FindAction_1 = require("../actions/FindAction");
|
|
5
5
|
const MablAction_1 = require("../MablAction");
|
|
6
|
-
const MablSymbol_1 = require("../MablSymbol");
|
|
7
6
|
const domUtil_1 = require("../../domUtil");
|
|
8
7
|
const MablStepWithFindAction_1 = require("../MablStepWithFindAction");
|
|
9
|
-
const ActionsUtils_1 = require("./ActionsUtils");
|
|
10
8
|
class EnterTextStep extends MablStepWithFindAction_1.MablStepWithFindAction {
|
|
11
|
-
constructor(
|
|
12
|
-
super(
|
|
13
|
-
|
|
9
|
+
constructor(name, args, actions) {
|
|
10
|
+
super(name, args, actions, 'enter_text');
|
|
11
|
+
const arg = this.getActionArgs()[0];
|
|
12
|
+
this.text = (0, MablAction_1.parseArgument)(arg);
|
|
13
|
+
this.validate();
|
|
14
|
+
if ((0, domUtil_1.isFindElementType)(this.actions[0].getActionName())) {
|
|
15
|
+
this.findAction = this.actions[0];
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
throw new Error(`Unexpected find action for ${name} step: ${JSON.stringify(this.actions[0])}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
validate() {
|
|
22
|
+
if (this.actions.length !== 1 && !(this.actions[0] instanceof FindAction_1.FindAction)) {
|
|
23
|
+
throw new Error('Enter text steps should have exactly on sub action and it should be a find');
|
|
24
|
+
}
|
|
14
25
|
}
|
|
15
26
|
getStepName() {
|
|
16
|
-
return
|
|
27
|
+
return 'EnterText';
|
|
17
28
|
}
|
|
18
29
|
toStepDescriptor() {
|
|
19
|
-
|
|
30
|
+
const find = this.findAction.toDescriptor();
|
|
31
|
+
switch (find.findType) {
|
|
32
|
+
case domUtil_1.FindType.FIND_FIRST:
|
|
33
|
+
case domUtil_1.FindType.FIND_LAST:
|
|
34
|
+
case domUtil_1.FindType.FIND_ANY:
|
|
35
|
+
case domUtil_1.FindType.FIND_ONE:
|
|
36
|
+
return {
|
|
37
|
+
find,
|
|
38
|
+
descriptorToActionMap: new Map().set(find, this.findAction),
|
|
39
|
+
text: this.text,
|
|
40
|
+
actionCode: this.actionCode,
|
|
41
|
+
};
|
|
42
|
+
default:
|
|
43
|
+
throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
getFormattedStep() {
|
|
47
|
+
const step = this.toStepDescriptor();
|
|
48
|
+
const stepName = this.getStepName();
|
|
49
|
+
const formatted = {
|
|
50
|
+
[stepName]: {},
|
|
51
|
+
};
|
|
52
|
+
if (this.annotationsOnStep()) {
|
|
53
|
+
formatted[stepName].annotation = this.annotation;
|
|
54
|
+
}
|
|
55
|
+
if (this.description) {
|
|
56
|
+
formatted[stepName].description = this.description;
|
|
57
|
+
}
|
|
58
|
+
if (step.find.findType === domUtil_1.FindType.FIND_ONE) {
|
|
59
|
+
formatted[stepName].selector = step.find.findTarget.selector;
|
|
60
|
+
if (step.find.findTarget.auxiliaryDescriptors?.length) {
|
|
61
|
+
formatted[stepName].selectorAncestors =
|
|
62
|
+
step.find.findTarget.auxiliaryDescriptors.map((descriptor) => descriptor.selector);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
formatted[stepName].selector = step.find.findTarget;
|
|
67
|
+
}
|
|
68
|
+
formatted[stepName].findType = FindAction_1.findTypesToFormattedType[step.find.findType];
|
|
69
|
+
formatted[stepName].text = this.text.toString();
|
|
70
|
+
if (this.stepId()) {
|
|
71
|
+
formatted[stepName].id = this.stepId();
|
|
72
|
+
}
|
|
73
|
+
return formatted;
|
|
20
74
|
}
|
|
21
75
|
static fromYaml(_stepName, stepArgs) {
|
|
22
|
-
const
|
|
23
|
-
const textArg = stepArgs.text;
|
|
24
|
-
const text = textArg?.name
|
|
25
|
-
? new MablSymbol_1.MablSymbol(textArg.name)
|
|
26
|
-
: (0, MablAction_1.parseArgument)(textArg);
|
|
27
|
-
const stepDescriptor = buildStepDescriptor(findAction, text);
|
|
28
|
-
const step = new EnterTextStep(stepDescriptor, findAction);
|
|
76
|
+
const step = new EnterTextStep('enter_text', [stepArgs.text], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
|
|
29
77
|
step.setStepId(stepArgs.id);
|
|
30
78
|
return step;
|
|
31
79
|
}
|
|
32
|
-
static fromLegacyMablscript(args, actions) {
|
|
33
|
-
const findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(actions);
|
|
34
|
-
const textArg = args[0];
|
|
35
|
-
const text = textArg?.name
|
|
36
|
-
? new MablSymbol_1.MablSymbol(textArg.name)
|
|
37
|
-
: (0, MablAction_1.parseArgument)(textArg);
|
|
38
|
-
const stepDescriptor = buildStepDescriptor(findAction, text);
|
|
39
|
-
return new EnterTextStep(stepDescriptor, findAction);
|
|
40
|
-
}
|
|
41
80
|
toMablscript() {
|
|
42
81
|
const enterText = typeof this.text === 'string'
|
|
43
82
|
? `"${(0, domUtil_1.escapeMablscriptString)(this.text)}"`
|
|
@@ -50,33 +89,7 @@ class EnterTextStep extends MablStepWithFindAction_1.MablStepWithFindAction {
|
|
|
50
89
|
...MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.text),
|
|
51
90
|
]);
|
|
52
91
|
}
|
|
53
|
-
stepDescription() {
|
|
54
|
-
const displayText = typeof this.text === 'string'
|
|
55
|
-
? `"${this.text}"`
|
|
56
|
-
: `{{${this.text.name}}}`;
|
|
57
|
-
const elementDescription = this.humanizeFind();
|
|
58
|
-
return `Enter ${displayText} into ${elementDescription}`;
|
|
59
|
-
}
|
|
60
92
|
}
|
|
61
93
|
exports.EnterTextStep = EnterTextStep;
|
|
62
|
-
EnterTextStep.
|
|
63
|
-
EnterTextStep.
|
|
64
|
-
EnterTextStep.mablScriptStepNames = [EnterTextStep.actionCode];
|
|
65
|
-
EnterTextStep.yamlMablScriptNames = [EnterTextStep.stepName];
|
|
66
|
-
function buildStepDescriptor(findAction, text) {
|
|
67
|
-
const find = findAction.toDescriptor();
|
|
68
|
-
switch (find.findType) {
|
|
69
|
-
case domUtil_1.FindType.FIND_FIRST:
|
|
70
|
-
case domUtil_1.FindType.FIND_LAST:
|
|
71
|
-
case domUtil_1.FindType.FIND_ANY:
|
|
72
|
-
case domUtil_1.FindType.FIND_ONE:
|
|
73
|
-
return {
|
|
74
|
-
find,
|
|
75
|
-
descriptorToActionMap: new Map().set(find, findAction),
|
|
76
|
-
text,
|
|
77
|
-
actionCode: EnterTextStep.actionCode,
|
|
78
|
-
};
|
|
79
|
-
default:
|
|
80
|
-
throw new Error(`Error generating step descriptor for ${EnterTextStep.stepName}: Unexpected find type ${find.findType}`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
94
|
+
EnterTextStep.mablScriptStepNames = ['enter_text'];
|
|
95
|
+
EnterTextStep.yamlMablScriptNames = ['EnterText'];
|