@mablhq/mabl-cli 1.57.9 → 1.58.7
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/entities/Email.js +3 -3
- package/api/mablApiClient.js +45 -6
- package/core/execution/MailboxConstants.js +4 -0
- package/domUtil/index.js +1 -1
- package/execution/index.js +1 -1
- package/mablApi/index.js +1 -1
- package/mablscript/actions/AwaitPDFDownloadAction.js +4 -1
- package/mablscript/actions/FindAction.js +34 -4
- package/mablscript/actions/JavaScriptAction.js +13 -7
- package/mablscript/steps/AssertStep.js +2 -2
- package/mablscript/steps/DownloadStep.js +4 -1
- package/mablscript/steps/EvaluateFlowStep.js +5 -2
- package/mablscript/steps/OpenEmailStep.js +2 -1
- package/mablscript/steps/SendHttpRequestStep.js +4 -1
- package/mablscript/steps/SendKeyStep.js +1 -1
- package/mablscriptFind/index.js +1 -1
- package/package.json +2 -2
- package/proxy/index.js +1 -1
- package/resources/mablFind.js +1 -1
|
@@ -9,7 +9,10 @@ class AwaitPDFDownloadAction extends AwaitDownloadAction_1.AwaitDownloadAction {
|
|
|
9
9
|
this.pdfUUID = this.getActionArgs()[0].uuid;
|
|
10
10
|
}
|
|
11
11
|
toMablscript() {
|
|
12
|
-
return `await_pdf(${(0, domUtil_1.buildStepArgumentString)({
|
|
12
|
+
return `await_pdf(${(0, domUtil_1.buildStepArgumentString)({
|
|
13
|
+
params: { uuid: this.pdfUUID },
|
|
14
|
+
legacy: true,
|
|
15
|
+
})})`;
|
|
13
16
|
}
|
|
14
17
|
}
|
|
15
18
|
exports.AwaitPDFDownloadAction = AwaitPDFDownloadAction;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalize = exports.isElementSelector = exports.FindAction = exports.findTypesToFormattedType = void 0;
|
|
3
|
+
exports.normalizeEmail = exports.isEmailSelectorOrDescriptor = exports.normalize = exports.isElementSelector = exports.FindAction = exports.findTypesToFormattedType = void 0;
|
|
4
4
|
const domUtil_1 = require("../../domUtil");
|
|
5
5
|
const mablscriptFind_1 = require("../../mablscriptFind");
|
|
6
6
|
const MablAction_1 = require("../MablAction");
|
|
@@ -78,12 +78,16 @@ class FindAction extends MablAction_1.MablAction {
|
|
|
78
78
|
}
|
|
79
79
|
case domUtil_1.FindType.FIND_EMAIL:
|
|
80
80
|
const [selectors] = this.getActionArgs();
|
|
81
|
-
if (!(
|
|
81
|
+
if (!isEmailSelectorOrDescriptor(selectors)) {
|
|
82
82
|
this.isValid = false;
|
|
83
83
|
}
|
|
84
|
+
const [target] = Array.isArray(selectors)
|
|
85
|
+
? [...selectors]
|
|
86
|
+
: [selectors];
|
|
87
|
+
const findTarget = normalizeEmail(target);
|
|
84
88
|
this.findDescriptor = {
|
|
85
89
|
findType,
|
|
86
|
-
findTarget
|
|
90
|
+
findTarget,
|
|
87
91
|
};
|
|
88
92
|
break;
|
|
89
93
|
case domUtil_1.FindType.FIND_TAB: {
|
|
@@ -206,7 +210,7 @@ class FindAction extends MablAction_1.MablAction {
|
|
|
206
210
|
args = (0, mablscriptFind_1.buildCookieSelectorString)(this.findDescriptor.findTarget);
|
|
207
211
|
break;
|
|
208
212
|
case domUtil_1.FindType.FIND_EMAIL: {
|
|
209
|
-
args = (0,
|
|
213
|
+
args = (0, domUtil_1.buildFindEmailDescriptorString)(this.findDescriptor.findTarget);
|
|
210
214
|
break;
|
|
211
215
|
}
|
|
212
216
|
case domUtil_1.FindType.FIND_TAB:
|
|
@@ -269,3 +273,29 @@ function normalize(maybeFindDescriptor) {
|
|
|
269
273
|
return { selector: maybeFindDescriptor };
|
|
270
274
|
}
|
|
271
275
|
exports.normalize = normalize;
|
|
276
|
+
function isEmailSelectorOrDescriptor(selectorOrDescriptor) {
|
|
277
|
+
const [target] = Array.isArray(selectorOrDescriptor)
|
|
278
|
+
? [...selectorOrDescriptor]
|
|
279
|
+
: [selectorOrDescriptor];
|
|
280
|
+
return (0, domUtil_1.isEmailSelector)(target) || (0, domUtil_1.isNormalizedFindEmailDescriptor)(target);
|
|
281
|
+
}
|
|
282
|
+
exports.isEmailSelectorOrDescriptor = isEmailSelectorOrDescriptor;
|
|
283
|
+
function normalizeEmail(selectorOrDescriptor) {
|
|
284
|
+
if ((0, domUtil_1.isNormalizedFindEmailDescriptor)(selectorOrDescriptor)) {
|
|
285
|
+
return { ...selectorOrDescriptor };
|
|
286
|
+
}
|
|
287
|
+
if ((0, domUtil_1.isEmailSelector)(selectorOrDescriptor)) {
|
|
288
|
+
if (selectorOrDescriptor.subject_exact) {
|
|
289
|
+
const { subject_exact: subjectExact, ...restOfObject } = selectorOrDescriptor;
|
|
290
|
+
return {
|
|
291
|
+
selector: {
|
|
292
|
+
subject: subjectExact,
|
|
293
|
+
...restOfObject,
|
|
294
|
+
},
|
|
295
|
+
type: 'email',
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return { selector: selectorOrDescriptor, type: 'email' };
|
|
300
|
+
}
|
|
301
|
+
exports.normalizeEmail = normalizeEmail;
|
|
@@ -162,19 +162,25 @@ class JavaScriptAction extends MablAction_1.MablAction {
|
|
|
162
162
|
toMablscript() {
|
|
163
163
|
if ((0, JavaScriptDescriptor_1.isReusableSnippetDescriptor)(this.javaScript)) {
|
|
164
164
|
const snippetReference = (0, domUtil_1.buildStepArgumentString)({
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
params: {
|
|
166
|
+
id: this.javaScript.snippetId,
|
|
167
|
+
invariant_id: this.javaScript.snippetInvariantId,
|
|
168
|
+
snippet_type: 'javascript',
|
|
169
|
+
},
|
|
170
|
+
legacy: true,
|
|
168
171
|
});
|
|
169
|
-
const snippetOptions = `, {parameter_overrides: ${(0, domUtil_1.buildStepArgumentString)(this.javaScript.parameterOverrides)}}`;
|
|
172
|
+
const snippetOptions = `, {parameter_overrides: ${(0, domUtil_1.buildStepArgumentString)({ params: this.javaScript.parameterOverrides, legacy: true })}}`;
|
|
170
173
|
return `evaluate_js(${snippetReference}${snippetOptions})`;
|
|
171
174
|
}
|
|
172
175
|
if ((0, JavaScriptDescriptor_1.isInlineSnippetDescriptor)(this.javaScript)) {
|
|
173
176
|
const snippetReference = (0, domUtil_1.buildStepArgumentString)({
|
|
174
|
-
...this.javaScript.inlineSnippet,
|
|
175
|
-
|
|
177
|
+
params: { ...this.javaScript.inlineSnippet, snippet_type: 'javascript' },
|
|
178
|
+
legacy: true,
|
|
176
179
|
});
|
|
177
|
-
const snippetOptions = `, {parameter_overrides: ${(0, domUtil_1.buildStepArgumentString)(
|
|
180
|
+
const snippetOptions = `, {parameter_overrides: ${(0, domUtil_1.buildStepArgumentString)({
|
|
181
|
+
params: this.javaScript.parameterOverrides,
|
|
182
|
+
legacy: true,
|
|
183
|
+
})}}`;
|
|
178
184
|
return `evaluate_js(${snippetReference}${snippetOptions})`;
|
|
179
185
|
}
|
|
180
186
|
if ((0, JavaScriptDescriptor_1.isLegacyReusableSnippetDescriptor)(this.javaScript)) {
|
|
@@ -149,11 +149,11 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
149
149
|
}
|
|
150
150
|
else {
|
|
151
151
|
switch (find.findType) {
|
|
152
|
-
case domUtil_1.FindType.FIND_COOKIE:
|
|
153
152
|
case domUtil_1.FindType.FIND_EMAIL:
|
|
154
153
|
formatted.findType = FindAction_1.findTypesToFormattedType[find.findType];
|
|
155
|
-
formatted.selector = find.findTarget;
|
|
154
|
+
formatted.selector = find.findTarget.selector;
|
|
156
155
|
break;
|
|
156
|
+
case domUtil_1.FindType.FIND_COOKIE:
|
|
157
157
|
case domUtil_1.FindType.FIND_FIRST:
|
|
158
158
|
case domUtil_1.FindType.FIND_LAST:
|
|
159
159
|
case domUtil_1.FindType.FIND_ANY:
|
|
@@ -79,7 +79,10 @@ class DownloadStep extends MablStep_1.MablStep {
|
|
|
79
79
|
return new DownloadStep('assert_download', [fileAttributes], [awaitDownloadAction]);
|
|
80
80
|
}
|
|
81
81
|
toMablscript() {
|
|
82
|
-
const mablArgs = (0, domUtil_1.buildStepArgumentString)(
|
|
82
|
+
const mablArgs = (0, domUtil_1.buildStepArgumentString)({
|
|
83
|
+
params: { ...this.fileAttributes },
|
|
84
|
+
legacy: true,
|
|
85
|
+
});
|
|
83
86
|
return `${this.awaitDownloadAction.toMablscript()}.assert_download(${mablArgs ? mablArgs : ''})`;
|
|
84
87
|
}
|
|
85
88
|
getInputVariables() {
|
|
@@ -29,9 +29,12 @@ class EvaluateFlowStep extends MablStep_1.MablStep {
|
|
|
29
29
|
return new EvaluateFlowStep(EvaluateFlowStep.mablScriptStepNames[0], [descriptor, config], []);
|
|
30
30
|
}
|
|
31
31
|
toMablscript() {
|
|
32
|
-
const flowReference = (0, domUtil_1.buildStepArgumentString)(
|
|
32
|
+
const flowReference = (0, domUtil_1.buildStepArgumentString)({
|
|
33
|
+
params: { ...this.flowDescriptor },
|
|
34
|
+
legacy: true,
|
|
35
|
+
});
|
|
33
36
|
const flowConfig = this.config
|
|
34
|
-
? ', ' + (0, domUtil_1.buildStepArgumentString)(this.config)
|
|
37
|
+
? ', ' + (0, domUtil_1.buildStepArgumentString)({ params: { ...this.config }, legacy: true })
|
|
35
38
|
: '';
|
|
36
39
|
return `${EvaluateFlowStep.mablScriptStepNames[0]}(${flowReference}${flowConfig})`;
|
|
37
40
|
}
|
|
@@ -22,8 +22,9 @@ class OpenEmailStep extends MablStep_1.MablStep {
|
|
|
22
22
|
const find = this.findAction.toDescriptor();
|
|
23
23
|
return {
|
|
24
24
|
tab: this.tabUuid,
|
|
25
|
-
selector: find.findTarget,
|
|
25
|
+
selector: find.findTarget.selector,
|
|
26
26
|
findType: 'FindEmail',
|
|
27
|
+
configuration: find.findTarget.configuration,
|
|
27
28
|
};
|
|
28
29
|
}
|
|
29
30
|
static fromYaml(_stepName, stepArgs) {
|
|
@@ -38,7 +38,10 @@ class SendHttpRequestStep extends MablStep_1.MablStep {
|
|
|
38
38
|
return new SendHttpRequestStep('send_http_request', [formatted], []);
|
|
39
39
|
}
|
|
40
40
|
toMablscript() {
|
|
41
|
-
return `send_http_request(${(0, domUtil_1.buildStepArgumentString)(
|
|
41
|
+
return `send_http_request(${(0, domUtil_1.buildStepArgumentString)({
|
|
42
|
+
params: { ...this.sendRequest },
|
|
43
|
+
legacy: true,
|
|
44
|
+
})})`;
|
|
42
45
|
}
|
|
43
46
|
getInputVariables() {
|
|
44
47
|
return MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.sendRequest);
|
|
@@ -64,7 +64,7 @@ class SendKeyStep extends MablStep_1.MablStep {
|
|
|
64
64
|
}
|
|
65
65
|
toMablscript() {
|
|
66
66
|
const keysToSend = this.keys
|
|
67
|
-
.map((key) => (0, domUtil_1.buildStepArgumentString)(key))
|
|
67
|
+
.map((key) => (0, domUtil_1.buildStepArgumentString)({ params: { ...key }, legacy: true }))
|
|
68
68
|
.join();
|
|
69
69
|
return `${this.findAction.toMablscript()}.send_keys(${keysToSend})`;
|
|
70
70
|
}
|