@mablhq/mabl-cli 2.72.0 → 2.72.3
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/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 +1 -1
- package/mablscript/steps/StepGroupStep.js +0 -70
- package/mablscript/types/AssertStepDescriptor.js +0 -2
- package/mablscript/types/StepGroupStepDescriptor.js +0 -2
|
@@ -9,161 +9,188 @@ const FindAction_1 = require("../actions/FindAction");
|
|
|
9
9
|
const GenerateEmailAddressAction_1 = require("../actions/GenerateEmailAddressAction");
|
|
10
10
|
const GenerateRandomStringAction_1 = require("../actions/GenerateRandomStringAction");
|
|
11
11
|
const JavaScriptAction_1 = require("../actions/JavaScriptAction");
|
|
12
|
-
const
|
|
12
|
+
const MablStep_1 = require("../MablStep");
|
|
13
13
|
const CreateVariableStepDescriptor_1 = require("../types/CreateVariableStepDescriptor");
|
|
14
|
-
class CreateVariableStep extends
|
|
15
|
-
constructor(
|
|
16
|
-
super(
|
|
17
|
-
this.variableName =
|
|
18
|
-
this.generationType =
|
|
19
|
-
this.actions = this.buildActions(descriptor);
|
|
14
|
+
class CreateVariableStep extends MablStep_1.MablStep {
|
|
15
|
+
constructor(name, args, actions) {
|
|
16
|
+
super(name, args, actions, 'as');
|
|
17
|
+
this.variableName = this.getActionArgs()[0];
|
|
18
|
+
this.generationType = this.calculateGenerationType();
|
|
20
19
|
}
|
|
21
20
|
getStepName() {
|
|
22
21
|
return CreateVariableStep.stepName;
|
|
23
22
|
}
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
calculateGenerationType() {
|
|
24
|
+
if (this.actions.length === 2 && this.actions[0] instanceof FindAction_1.FindAction) {
|
|
25
|
+
if (this.actions[0].findDescriptor.findType === domUtil_1.FindType.FIND_COOKIE) {
|
|
26
|
+
return CreateVariableStepDescriptor_1.VariableGenerator.COOKIE_ATTRIBUTE;
|
|
27
|
+
}
|
|
28
|
+
if (this.actions[1] instanceof ExtractAction_1.ExtractAction) {
|
|
29
|
+
return CreateVariableStepDescriptor_1.VariableGenerator.ATTRIBUTE;
|
|
30
|
+
}
|
|
31
|
+
else if (this.actions[1] instanceof CountAction_1.CountAction) {
|
|
32
|
+
return CreateVariableStepDescriptor_1.VariableGenerator.ELEMENT_COUNT;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else if (this.actions.length === 1 &&
|
|
36
|
+
this.actions[0] instanceof GenerateEmailAddressAction_1.GenerateEmailAddressAction) {
|
|
37
|
+
return CreateVariableStepDescriptor_1.VariableGenerator.EMAIL;
|
|
38
|
+
}
|
|
39
|
+
else if (this.actions.length === 1 &&
|
|
40
|
+
this.actions[0] instanceof JavaScriptAction_1.JavaScriptAction) {
|
|
41
|
+
return CreateVariableStepDescriptor_1.VariableGenerator.JAVASCRIPT;
|
|
42
|
+
}
|
|
43
|
+
else if (this.actions.length === 1 &&
|
|
44
|
+
this.actions[0] instanceof GenerateRandomStringAction_1.GenerateRandomStringAction) {
|
|
45
|
+
return CreateVariableStepDescriptor_1.VariableGenerator.PATTERN;
|
|
46
|
+
}
|
|
47
|
+
throw new Error('Unsupported variable generation type');
|
|
26
48
|
}
|
|
27
|
-
|
|
28
|
-
|
|
49
|
+
toStepDescriptor() {
|
|
50
|
+
let step;
|
|
51
|
+
switch (this.generationType) {
|
|
52
|
+
case CreateVariableStepDescriptor_1.VariableGenerator.COOKIE_ATTRIBUTE:
|
|
53
|
+
const cookieFindAction = this.actions[0];
|
|
54
|
+
const cookieFind = cookieFindAction.toDescriptor();
|
|
55
|
+
step = {
|
|
56
|
+
name: this.variableName,
|
|
57
|
+
generator: {
|
|
58
|
+
type: CreateVariableStepDescriptor_1.VariableGenerator.COOKIE_ATTRIBUTE,
|
|
59
|
+
cookieSelector: cookieFind.findTarget,
|
|
60
|
+
attribute: this.actions[1].extractionAttribute,
|
|
61
|
+
},
|
|
62
|
+
find: cookieFind,
|
|
63
|
+
descriptorToActionMap: new Map().set(cookieFind, cookieFindAction),
|
|
64
|
+
actionCode: this.actionCode,
|
|
65
|
+
};
|
|
66
|
+
break;
|
|
29
67
|
case CreateVariableStepDescriptor_1.VariableGenerator.ATTRIBUTE:
|
|
30
|
-
const findAction = actions[0];
|
|
31
|
-
const extractAction = actions[1];
|
|
68
|
+
const findAction = this.actions[0];
|
|
32
69
|
const find = findAction.toDescriptor();
|
|
33
|
-
|
|
34
|
-
name: variableName,
|
|
70
|
+
step = {
|
|
71
|
+
name: this.variableName,
|
|
35
72
|
generator: {
|
|
36
73
|
type: CreateVariableStepDescriptor_1.VariableGenerator.ATTRIBUTE,
|
|
37
|
-
attribute:
|
|
74
|
+
attribute: this.actions[1].extractionAttribute,
|
|
38
75
|
find,
|
|
39
76
|
},
|
|
40
77
|
find,
|
|
41
|
-
descriptorToActionMap: new Map(
|
|
42
|
-
actionCode:
|
|
43
|
-
};
|
|
44
|
-
case CreateVariableStepDescriptor_1.VariableGenerator.ELEMENT_COUNT:
|
|
45
|
-
const countFindAction = actions[0];
|
|
46
|
-
const countFind = countFindAction.toDescriptor();
|
|
47
|
-
return {
|
|
48
|
-
find: countFind,
|
|
49
|
-
name: variableName,
|
|
50
|
-
generator: {
|
|
51
|
-
type: CreateVariableStepDescriptor_1.VariableGenerator.ELEMENT_COUNT,
|
|
52
|
-
find: countFind,
|
|
53
|
-
},
|
|
54
|
-
descriptorToActionMap: new Map([[countFind, countFindAction]]),
|
|
55
|
-
actionCode: CreateVariableStep.actionCode,
|
|
78
|
+
descriptorToActionMap: new Map().set(find, findAction),
|
|
79
|
+
actionCode: this.actionCode,
|
|
56
80
|
};
|
|
81
|
+
break;
|
|
57
82
|
case CreateVariableStepDescriptor_1.VariableGenerator.EMAIL:
|
|
58
|
-
|
|
59
|
-
name: variableName,
|
|
83
|
+
step = {
|
|
84
|
+
name: this.variableName,
|
|
60
85
|
generator: { type: CreateVariableStepDescriptor_1.VariableGenerator.EMAIL },
|
|
61
|
-
actionCode:
|
|
86
|
+
actionCode: this.actionCode,
|
|
62
87
|
};
|
|
88
|
+
break;
|
|
63
89
|
case CreateVariableStepDescriptor_1.VariableGenerator.JAVASCRIPT:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
name: variableName,
|
|
90
|
+
step = {
|
|
91
|
+
name: this.variableName,
|
|
67
92
|
generator: {
|
|
68
93
|
type: CreateVariableStepDescriptor_1.VariableGenerator.JAVASCRIPT,
|
|
69
|
-
javaScript:
|
|
94
|
+
javaScript: this.actions[0].javaScript,
|
|
70
95
|
},
|
|
71
|
-
actionCode:
|
|
96
|
+
actionCode: this.actionCode,
|
|
72
97
|
};
|
|
98
|
+
break;
|
|
73
99
|
case CreateVariableStepDescriptor_1.VariableGenerator.PATTERN:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
name: variableName,
|
|
100
|
+
step = {
|
|
101
|
+
name: this.variableName,
|
|
77
102
|
generator: {
|
|
78
103
|
type: CreateVariableStepDescriptor_1.VariableGenerator.PATTERN,
|
|
79
|
-
pattern:
|
|
104
|
+
pattern: this.actions[0]
|
|
105
|
+
.generateString,
|
|
80
106
|
},
|
|
81
|
-
actionCode:
|
|
107
|
+
actionCode: this.actionCode,
|
|
82
108
|
};
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
109
|
+
break;
|
|
110
|
+
case CreateVariableStepDescriptor_1.VariableGenerator.ELEMENT_COUNT:
|
|
111
|
+
const countFindAction = this.actions[0];
|
|
112
|
+
const countFind = countFindAction.toDescriptor();
|
|
113
|
+
step = {
|
|
114
|
+
find: countFind,
|
|
115
|
+
name: this.variableName,
|
|
89
116
|
generator: {
|
|
90
|
-
type: CreateVariableStepDescriptor_1.VariableGenerator.
|
|
91
|
-
|
|
92
|
-
attribute: cookieExtractAction.extractionAttribute,
|
|
117
|
+
type: CreateVariableStepDescriptor_1.VariableGenerator.ELEMENT_COUNT,
|
|
118
|
+
find: countFind,
|
|
93
119
|
},
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
actionCode: CreateVariableStep.actionCode,
|
|
120
|
+
descriptorToActionMap: new Map().set(countFind, countFindAction),
|
|
121
|
+
actionCode: this.actionCode,
|
|
97
122
|
};
|
|
98
|
-
|
|
99
|
-
throw new Error(`Unsupported variable generation type: ${generationType}`);
|
|
123
|
+
break;
|
|
100
124
|
}
|
|
125
|
+
return step;
|
|
101
126
|
}
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
127
|
+
getFormattedStep() {
|
|
128
|
+
const step = this.toStepDescriptor();
|
|
129
|
+
const stepName = this.getStepName();
|
|
130
|
+
const formatted = {
|
|
131
|
+
[stepName]: {},
|
|
132
|
+
};
|
|
133
|
+
if (this.annotationsOnStep()) {
|
|
134
|
+
formatted[stepName].annotation = this.annotation;
|
|
135
|
+
}
|
|
136
|
+
if (this.description) {
|
|
137
|
+
formatted[stepName].description = this.description;
|
|
138
|
+
}
|
|
139
|
+
switch (step.generator.type) {
|
|
112
140
|
case CreateVariableStepDescriptor_1.VariableGenerator.ELEMENT_COUNT:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
]));
|
|
120
|
-
actions.push(new CountAction_1.CountAction('count', []));
|
|
121
|
-
}
|
|
141
|
+
formatted[stepName] = {
|
|
142
|
+
...formatted[stepName],
|
|
143
|
+
generator: step.generator,
|
|
144
|
+
name: this.variableName,
|
|
145
|
+
selector: step.generator.find.findTarget,
|
|
146
|
+
};
|
|
122
147
|
break;
|
|
123
|
-
case CreateVariableStepDescriptor_1.VariableGenerator.
|
|
124
|
-
|
|
148
|
+
case CreateVariableStepDescriptor_1.VariableGenerator.ATTRIBUTE:
|
|
149
|
+
formatted[stepName] = {
|
|
150
|
+
...formatted[stepName],
|
|
151
|
+
generator: step.generator,
|
|
152
|
+
name: this.variableName,
|
|
153
|
+
selector: step.generator.find.findTarget.selector,
|
|
154
|
+
selectorAncestors: (step.generator.find.findTarget.auxiliaryDescriptors ?? []).map((descriptor) => descriptor.selector),
|
|
155
|
+
};
|
|
125
156
|
break;
|
|
126
157
|
case CreateVariableStepDescriptor_1.VariableGenerator.JAVASCRIPT:
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
patternGenerator.pattern,
|
|
136
|
-
]));
|
|
137
|
-
break;
|
|
138
|
-
case CreateVariableStepDescriptor_1.VariableGenerator.COOKIE_ATTRIBUTE:
|
|
139
|
-
if ('find' in descriptor) {
|
|
140
|
-
const cookieGenerator = descriptor.generator;
|
|
141
|
-
actions.push(new FindAction_1.FindAction('find_cookie', [cookieGenerator.cookieSelector]));
|
|
142
|
-
actions.push(new ExtractAction_1.ExtractAction('extract_attribute', [cookieGenerator.attribute]));
|
|
143
|
-
}
|
|
158
|
+
formatted[stepName] = {
|
|
159
|
+
...formatted[stepName],
|
|
160
|
+
generator: {
|
|
161
|
+
type: CreateVariableStepDescriptor_1.VariableGenerator.JAVASCRIPT,
|
|
162
|
+
javaScript: this.actions[0].toYaml(),
|
|
163
|
+
},
|
|
164
|
+
name: this.variableName,
|
|
165
|
+
};
|
|
144
166
|
break;
|
|
145
167
|
default:
|
|
146
|
-
|
|
168
|
+
formatted[stepName] = {
|
|
169
|
+
...formatted[stepName],
|
|
170
|
+
generator: step.generator,
|
|
171
|
+
name: this.variableName,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
if (this.stepId()) {
|
|
175
|
+
formatted[stepName].id = this.stepId();
|
|
147
176
|
}
|
|
148
|
-
return
|
|
177
|
+
return formatted;
|
|
149
178
|
}
|
|
150
179
|
static fromYaml(_stepName, stepArgs) {
|
|
151
180
|
const variableName = stepArgs.name;
|
|
152
|
-
const generator = stepArgs.generator
|
|
181
|
+
const generator = stepArgs.generator;
|
|
153
182
|
const generationType = generator.type;
|
|
154
183
|
const actions = [];
|
|
155
184
|
switch (generationType) {
|
|
156
185
|
case CreateVariableStepDescriptor_1.VariableGenerator.ATTRIBUTE:
|
|
157
|
-
|
|
158
|
-
actions.push(findAction);
|
|
186
|
+
actions.push(FindAction_1.FindAction.findActionFromStepArgs(stepArgs));
|
|
159
187
|
const extractArgs = generator.metadata
|
|
160
188
|
? [generator.attribute, generator.metadata]
|
|
161
189
|
: [generator.attribute];
|
|
162
190
|
actions.push(new ExtractAction_1.ExtractAction('extract_attribute', extractArgs));
|
|
163
191
|
break;
|
|
164
192
|
case CreateVariableStepDescriptor_1.VariableGenerator.ELEMENT_COUNT:
|
|
165
|
-
|
|
166
|
-
actions.push(countFindAction);
|
|
193
|
+
actions.push(FindAction_1.FindAction.findActionFromStepArgs(stepArgs, domUtil_1.FindType.FIND_ALL));
|
|
167
194
|
actions.push(new CountAction_1.CountAction('count', []));
|
|
168
195
|
break;
|
|
169
196
|
case CreateVariableStepDescriptor_1.VariableGenerator.EMAIL:
|
|
@@ -178,88 +205,29 @@ class CreateVariableStep extends MablStepV2_1.MablStepV2 {
|
|
|
178
205
|
]));
|
|
179
206
|
break;
|
|
180
207
|
case CreateVariableStepDescriptor_1.VariableGenerator.COOKIE_ATTRIBUTE:
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
actions.push(cookieFindAction);
|
|
185
|
-
actions.push(new ExtractAction_1.ExtractAction('extract_attribute', [generator.attribute]));
|
|
208
|
+
actions.push(new FindAction_1.FindAction('find_cookie', [generator.cookieSelector]));
|
|
209
|
+
const extractCookieArgs = [generator.attribute];
|
|
210
|
+
actions.push(new ExtractAction_1.ExtractAction('extract_attribute', extractCookieArgs));
|
|
186
211
|
break;
|
|
187
|
-
default:
|
|
188
|
-
throw new Error(`Unsupported variable generation type: ${generationType}`);
|
|
189
212
|
}
|
|
190
|
-
const
|
|
191
|
-
const step = new CreateVariableStep(stepDescriptor);
|
|
213
|
+
const step = new CreateVariableStep('as', [variableName], actions);
|
|
192
214
|
step.setStepId(stepArgs.id);
|
|
193
215
|
return step;
|
|
194
216
|
}
|
|
195
|
-
static fromLegacyMablscript(args, actions) {
|
|
196
|
-
const variableName = args[0];
|
|
197
|
-
const generationType = CreateVariableStep.calculateGenerationType(actions);
|
|
198
|
-
const stepDescriptor = CreateVariableStep.buildStepDescriptor(variableName, generationType, actions);
|
|
199
|
-
const step = new CreateVariableStep(stepDescriptor);
|
|
200
|
-
return step;
|
|
201
|
-
}
|
|
202
|
-
static calculateGenerationType(actions) {
|
|
203
|
-
if (actions.length === 2 && actions[0] instanceof FindAction_1.FindAction) {
|
|
204
|
-
if (actions[0].findDescriptor.findType === domUtil_1.FindType.FIND_COOKIE) {
|
|
205
|
-
return CreateVariableStepDescriptor_1.VariableGenerator.COOKIE_ATTRIBUTE;
|
|
206
|
-
}
|
|
207
|
-
if (actions[1] instanceof ExtractAction_1.ExtractAction) {
|
|
208
|
-
return CreateVariableStepDescriptor_1.VariableGenerator.ATTRIBUTE;
|
|
209
|
-
}
|
|
210
|
-
else if (actions[1] instanceof CountAction_1.CountAction) {
|
|
211
|
-
return CreateVariableStepDescriptor_1.VariableGenerator.ELEMENT_COUNT;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
else if (actions.length === 1 &&
|
|
215
|
-
actions[0] instanceof GenerateEmailAddressAction_1.GenerateEmailAddressAction) {
|
|
216
|
-
return CreateVariableStepDescriptor_1.VariableGenerator.EMAIL;
|
|
217
|
-
}
|
|
218
|
-
else if (actions.length === 1 && actions[0] instanceof JavaScriptAction_1.JavaScriptAction) {
|
|
219
|
-
return CreateVariableStepDescriptor_1.VariableGenerator.JAVASCRIPT;
|
|
220
|
-
}
|
|
221
|
-
else if (actions.length === 1 &&
|
|
222
|
-
actions[0] instanceof GenerateRandomStringAction_1.GenerateRandomStringAction) {
|
|
223
|
-
return CreateVariableStepDescriptor_1.VariableGenerator.PATTERN;
|
|
224
|
-
}
|
|
225
|
-
throw new Error('Unsupported variable generation type');
|
|
226
|
-
}
|
|
227
217
|
toMablscript() {
|
|
228
218
|
return `${this.actions.reduce((mablscript, action) => `${mablscript}${action.toMablscript()}.`, '')}as("${this.variableName}")`;
|
|
229
219
|
}
|
|
230
220
|
getInputVariables() {
|
|
231
|
-
return this.actions
|
|
221
|
+
return this.actions[0].getInputVariables();
|
|
232
222
|
}
|
|
233
223
|
getOutputVariables() {
|
|
234
224
|
return [this.variableName];
|
|
235
225
|
}
|
|
236
|
-
stepDescription() {
|
|
237
|
-
switch (this.generationType) {
|
|
238
|
-
case CreateVariableStepDescriptor_1.VariableGenerator.EMAIL:
|
|
239
|
-
return `Generate email address for variable "${this.variableName}"`;
|
|
240
|
-
case CreateVariableStepDescriptor_1.VariableGenerator.JAVASCRIPT:
|
|
241
|
-
return `Execute JavaScript to create variable "${this.variableName}"`;
|
|
242
|
-
case CreateVariableStepDescriptor_1.VariableGenerator.PATTERN:
|
|
243
|
-
return `Generate random string for variable "${this.variableName}"`;
|
|
244
|
-
case CreateVariableStepDescriptor_1.VariableGenerator.ATTRIBUTE:
|
|
245
|
-
return `Extract attribute value to variable "${this.variableName}"`;
|
|
246
|
-
case CreateVariableStepDescriptor_1.VariableGenerator.COOKIE_ATTRIBUTE:
|
|
247
|
-
return `Extract cookie attribute to variable "${this.variableName}"`;
|
|
248
|
-
case CreateVariableStepDescriptor_1.VariableGenerator.ELEMENT_COUNT:
|
|
249
|
-
return `Count elements and store in variable "${this.variableName}"`;
|
|
250
|
-
default:
|
|
251
|
-
return `Create variable "${this.variableName}"`;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
226
|
}
|
|
255
227
|
exports.CreateVariableStep = CreateVariableStep;
|
|
256
228
|
CreateVariableStep.stepName = 'CreateVariable';
|
|
257
|
-
CreateVariableStep.
|
|
258
|
-
CreateVariableStep.
|
|
259
|
-
CreateVariableStep.yamlMablScriptNames = [
|
|
260
|
-
CreateVariableStep.stepName,
|
|
261
|
-
'GenerateEmailAddress',
|
|
262
|
-
];
|
|
229
|
+
CreateVariableStep.mablScriptStepNames = ['as'];
|
|
230
|
+
CreateVariableStep.yamlMablScriptNames = ['CreateVariable', 'GenerateEmailAddress'];
|
|
263
231
|
function isCreateVariableStep(value) {
|
|
264
232
|
return (value?.getStepName &&
|
|
265
233
|
value.getStepName() === CreateVariableStep.stepName &&
|
|
@@ -4,29 +4,19 @@ exports.DatabaseQueryVariableSource = exports.DatabaseQueryStep = void 0;
|
|
|
4
4
|
exports.isDatabaseQueryStep = isDatabaseQueryStep;
|
|
5
5
|
const AbstractAssertionsAndVariablesStep_1 = require("./AbstractAssertionsAndVariablesStep");
|
|
6
6
|
class DatabaseQueryStep extends AbstractAssertionsAndVariablesStep_1.AbstractAssertionsAndVariablesStep {
|
|
7
|
-
constructor(
|
|
8
|
-
super(DatabaseQueryStep.
|
|
7
|
+
constructor(name, args, actions) {
|
|
8
|
+
super(name, args, actions, DatabaseQueryStep.mablScriptStepNames[0], DatabaseQueryStep.stepName, args[0]);
|
|
9
9
|
}
|
|
10
10
|
static fromYaml(_stepName, stepArgs) {
|
|
11
11
|
const formatted = stepArgs;
|
|
12
|
-
const step = new DatabaseQueryStep(formatted);
|
|
12
|
+
const step = new DatabaseQueryStep(DatabaseQueryStep.stepName, [formatted], []);
|
|
13
13
|
step.setStepId(stepArgs.id);
|
|
14
14
|
return step;
|
|
15
15
|
}
|
|
16
|
-
static fromLegacyMablscript(args, _actions) {
|
|
17
|
-
if (args.length !== 1) {
|
|
18
|
-
throw new Error(`DatabaseQueryStep fromLegacyMablscript expects 1 argument, got ${args.length}`);
|
|
19
|
-
}
|
|
20
|
-
return new DatabaseQueryStep(args[0]);
|
|
21
|
-
}
|
|
22
|
-
stepDescription() {
|
|
23
|
-
return `Database query execution`;
|
|
24
|
-
}
|
|
25
16
|
}
|
|
26
17
|
exports.DatabaseQueryStep = DatabaseQueryStep;
|
|
27
18
|
DatabaseQueryStep.stepName = 'DatabaseQuery';
|
|
28
|
-
DatabaseQueryStep.
|
|
29
|
-
DatabaseQueryStep.mablScriptStepNames = [DatabaseQueryStep.actionCode];
|
|
19
|
+
DatabaseQueryStep.mablScriptStepNames = ['database_query'];
|
|
30
20
|
DatabaseQueryStep.yamlMablScriptNames = [DatabaseQueryStep.stepName];
|
|
31
21
|
var DatabaseQueryVariableSource;
|
|
32
22
|
(function (DatabaseQueryVariableSource) {
|
|
@@ -3,59 +3,62 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DoubleClickStep = void 0;
|
|
4
4
|
const FindAction_1 = require("../actions/FindAction");
|
|
5
5
|
const domUtil_1 = require("../../domUtil");
|
|
6
|
-
const ActionsUtils_1 = require("./ActionsUtils");
|
|
7
6
|
const MablStepWithFindAction_1 = require("../MablStepWithFindAction");
|
|
8
7
|
class DoubleClickStep extends MablStepWithFindAction_1.MablStepWithFindAction {
|
|
9
|
-
constructor(
|
|
10
|
-
super(
|
|
8
|
+
constructor(name, args, actions) {
|
|
9
|
+
super(name, args, actions, 'double_click');
|
|
10
|
+
this.validate();
|
|
11
|
+
this.findAction = this.actions[0];
|
|
12
|
+
}
|
|
13
|
+
validate() {
|
|
14
|
+
if (this.actions.length !== 1 && !(this.actions[0] instanceof FindAction_1.FindAction)) {
|
|
15
|
+
throw new Error('Double click steps should have exactly on sub action and it should be a find');
|
|
16
|
+
}
|
|
11
17
|
}
|
|
12
18
|
getStepName() {
|
|
13
|
-
return
|
|
19
|
+
return 'DoubleClick';
|
|
14
20
|
}
|
|
15
21
|
toStepDescriptor() {
|
|
16
|
-
|
|
22
|
+
const find = this.findAction.toDescriptor();
|
|
23
|
+
switch (find.findType) {
|
|
24
|
+
case domUtil_1.FindType.FIND_FIRST:
|
|
25
|
+
case domUtil_1.FindType.FIND_LAST:
|
|
26
|
+
case domUtil_1.FindType.FIND_ANY:
|
|
27
|
+
case domUtil_1.FindType.FIND_ALL:
|
|
28
|
+
case domUtil_1.FindType.FIND_ONE:
|
|
29
|
+
return {
|
|
30
|
+
find,
|
|
31
|
+
descriptorToActionMap: new Map().set(find, this.findAction),
|
|
32
|
+
actionCode: this.actionCode,
|
|
33
|
+
};
|
|
34
|
+
default:
|
|
35
|
+
throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
getFormattedStep(_fullLocatorsOn) {
|
|
39
|
+
const step = {
|
|
40
|
+
DoubleClick: {
|
|
41
|
+
...super.annotationsAsYml(),
|
|
42
|
+
...this.findAction.toYaml(),
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
if (this.stepId()) {
|
|
46
|
+
step.DoubleClick.id = this.stepId();
|
|
47
|
+
}
|
|
48
|
+
return step;
|
|
17
49
|
}
|
|
18
50
|
static fromYaml(_stepName, stepArgs) {
|
|
19
|
-
const
|
|
20
|
-
const stepDescriptor = buildStepDescriptor(findAction);
|
|
21
|
-
const step = new DoubleClickStep(stepDescriptor, findAction);
|
|
51
|
+
const step = new DoubleClickStep('double_click', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
|
|
22
52
|
step.setStepId(stepArgs.id);
|
|
23
53
|
return step;
|
|
24
54
|
}
|
|
25
|
-
static fromLegacyMablscript(_args, actions) {
|
|
26
|
-
const findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(actions);
|
|
27
|
-
const stepDescriptor = buildStepDescriptor(findAction);
|
|
28
|
-
return new DoubleClickStep(stepDescriptor, findAction);
|
|
29
|
-
}
|
|
30
55
|
toMablscript() {
|
|
31
56
|
return `${this.findAction.toMablscript()}.double_click()`;
|
|
32
57
|
}
|
|
33
58
|
getInputVariables() {
|
|
34
59
|
return this.findAction.getInputVariables();
|
|
35
60
|
}
|
|
36
|
-
stepDescription() {
|
|
37
|
-
const elementDescription = this.humanizeFind();
|
|
38
|
-
return `Double click on ${elementDescription}`;
|
|
39
|
-
}
|
|
40
61
|
}
|
|
41
62
|
exports.DoubleClickStep = DoubleClickStep;
|
|
42
|
-
DoubleClickStep.
|
|
43
|
-
DoubleClickStep.
|
|
44
|
-
DoubleClickStep.mablScriptStepNames = [DoubleClickStep.actionCode];
|
|
45
|
-
DoubleClickStep.yamlMablScriptNames = [DoubleClickStep.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: DoubleClickStep.actionCode,
|
|
57
|
-
};
|
|
58
|
-
default:
|
|
59
|
-
throw new Error(`Error generating step descriptor for ${DoubleClickStep.stepName}: Unexpected find type ${find.findType}`);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
63
|
+
DoubleClickStep.mablScriptStepNames = ['double_click'];
|
|
64
|
+
DoubleClickStep.yamlMablScriptNames = ['DoubleClick'];
|