@mablhq/mabl-cli 1.17.6 → 1.18.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/api/featureSet.js +1 -4
- package/api/mablApiClient.js +2 -2
- package/browserLauncher/browserLauncherFactory.js +2 -3
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +3 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +1 -11
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +18 -0
- package/browserLauncher/runnerType.js +0 -1
- package/execution/index.js +1 -1
- package/execution/index.js.LICENSE.txt +2 -0
- package/index.d.ts +0 -1
- package/mablscript/MablAction.js +1 -1
- package/mablscript/MablStep.js +21 -3
- package/mablscript/actions/AwaitPDFDownloadAction.js +2 -1
- package/mablscript/actions/ConditionAction.js +11 -3
- package/mablscript/actions/ExtractAction.js +16 -7
- package/mablscript/actions/FindAction.js +71 -40
- package/mablscript/actions/GenerateRandomStringAction.js +2 -1
- package/mablscript/actions/GetUrlAction.js +1 -1
- package/mablscript/actions/GetVariableValue.js +2 -2
- package/mablscript/diffing/diffingUtil.js +146 -0
- package/mablscript/importer.js +20 -2
- package/mablscript/steps/AssertStep.js +33 -19
- package/mablscript/steps/AssertStepOld.js +38 -20
- package/mablscript/steps/AwaitTabStep.js +7 -6
- package/mablscript/steps/ClickAndHoldStep.js +1 -1
- package/mablscript/steps/DownloadStep.js +3 -2
- package/mablscript/steps/EchoStep.js +3 -1
- package/mablscript/steps/ElseIfConditionStep.js +5 -2
- package/mablscript/steps/EnterTextStep.js +4 -1
- package/mablscript/steps/EvaluateFlowStep.js +40 -0
- package/mablscript/steps/ReleaseStep.js +2 -1
- package/mablscript/steps/RemoveCookieStep.js +2 -3
- package/mablscript/steps/SendHttpRequestStep.js +3 -3
- package/mablscript/steps/SendKeyStep.js +2 -2
- package/mablscript/steps/SetCookieStep.js +2 -4
- package/mablscript/steps/SetViewportStep.js +1 -1
- package/mablscript/steps/VisitUrlStep.js +2 -1
- package/mablscript/steps/WaitStep.js +1 -4
- package/{browserLauncher/puppeteerBrowserLauncher/internals.js → mablscript/types/EvaluateFlowStepDescriptor.js} +0 -0
- package/mablscript/types/GetCurrentLocationDescriptor.js +4 -3
- package/mablscriptFind/index.js +1 -1
- package/package.json +3 -3
- package/resources/mablFind.js +1 -1
- package/resources/pdf-viewer/index.js +1 -1
- package/resources/pdf-viewer/libEmbeddedPdfHandler.js +11 -2
- package/util/actionabilityUtil.js +1 -24
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerBrowser.js +0 -135
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerBrowserLauncher.js +0 -45
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerElementHandle.js +0 -139
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerFrame.js +0 -115
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerHttpRequest.js +0 -38
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerHttpResponse.js +0 -27
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerJsHandle.js +0 -36
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerPage.js +0 -335
- package/browserLauncher/puppeteerBrowserLauncher/wrappers.js +0 -25
|
@@ -37,6 +37,7 @@ exports.fieldToAssertionStep = {};
|
|
|
37
37
|
Object.entries(exports.assertionStepToField).forEach(([stepType, field]) => (exports.fieldToAssertionStep[field] = stepType));
|
|
38
38
|
class AssertStep extends MablStep_1.MablStep {
|
|
39
39
|
constructor(name, args, actions) {
|
|
40
|
+
var _a, _b;
|
|
40
41
|
super(name, args, actions);
|
|
41
42
|
const firstAction = actions[0];
|
|
42
43
|
if (firstAction instanceof FindAction_1.FindAction ||
|
|
@@ -62,11 +63,12 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
62
63
|
this.assertionType = this.conditionAction.conditionAttribute;
|
|
63
64
|
this.assertionValue = this.conditionAction.conditionValueAttribute;
|
|
64
65
|
this.isWaitUntilStep = this.determineIfWaitUntilStep();
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
this.
|
|
66
|
+
this.assertArguments =
|
|
67
|
+
args[0] && typeof args[0] === 'object'
|
|
68
|
+
? args[0]
|
|
69
|
+
: undefined;
|
|
70
|
+
this.continueOnFailure = ((_a = this.assertArguments) === null || _a === void 0 ? void 0 : _a.onFailure) === 'continue';
|
|
71
|
+
this.observationScope = (_b = this.assertArguments) === null || _b === void 0 ? void 0 : _b.observationScope;
|
|
70
72
|
}
|
|
71
73
|
validate() {
|
|
72
74
|
if (!(this.actions.length === 2 || this.actions.length === 3) &&
|
|
@@ -161,8 +163,14 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
161
163
|
const actions = [];
|
|
162
164
|
const assertionType = exports.assertionStepToField[stepName];
|
|
163
165
|
const assertionValue = stepArgs.assertionValue;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
+
let primaryAction;
|
|
167
|
+
if (stepArgs.kind === GetCurrentLocationDescriptor_1.GET_CURRENT_LOCATION_KIND) {
|
|
168
|
+
primaryAction = new GetUrlAction_1.GetUrlAction(GetUrlAction_1.GetUrlAction.mablScriptStepNames[0], []);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
primaryAction = FindAction_1.FindAction.findActionFromStepArgs(stepArgs);
|
|
172
|
+
}
|
|
173
|
+
actions.push(primaryAction);
|
|
166
174
|
if (assertionType === 'present' || assertionType === 'not_present') {
|
|
167
175
|
actions.push(new ConditionAction_1.ConditionAction('evaluate_presence', [assertionType]));
|
|
168
176
|
}
|
|
@@ -181,7 +189,12 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
181
189
|
assertionValue,
|
|
182
190
|
]));
|
|
183
191
|
}
|
|
184
|
-
return new AssertStep('assert', [
|
|
192
|
+
return new AssertStep('assert', [
|
|
193
|
+
{
|
|
194
|
+
onFailure: stepArgs.continueOnFailure ? 'continue' : undefined,
|
|
195
|
+
observationScope: stepArgs.observationScope,
|
|
196
|
+
},
|
|
197
|
+
], actions);
|
|
185
198
|
}
|
|
186
199
|
produceSelIdeFormattedSteps(stepIndex) {
|
|
187
200
|
const find = this.primaryAction.toDescriptor();
|
|
@@ -229,21 +242,22 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
229
242
|
return seleniumStep;
|
|
230
243
|
}
|
|
231
244
|
toMablscript() {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
this.
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
: this.assertionType;
|
|
238
|
-
return `${this.primaryAction.generateMablscriptFindOne()}.evaluate_presence("${finalAssertionType}").assert()`;
|
|
239
|
-
}
|
|
245
|
+
var _a, _b;
|
|
246
|
+
const assertAction = `.assert(${!!(((_a = this.assertArguments) === null || _a === void 0 ? void 0 : _a.onFailure) ||
|
|
247
|
+
((_b = this.assertArguments) === null || _b === void 0 ? void 0 : _b.observationScope))
|
|
248
|
+
? this.convertObjectToMablscriptArgs(this.assertArguments)
|
|
249
|
+
: ''})`;
|
|
240
250
|
if (this.countAction) {
|
|
241
|
-
return `${this.primaryAction.toMablscript()}.${this.countAction.toMablscript()}.${this.conditionAction.toMablscript()}
|
|
251
|
+
return `${this.primaryAction.toMablscript()}.${this.countAction.toMablscript()}.${this.conditionAction.toMablscript()}${assertAction}`;
|
|
242
252
|
}
|
|
243
253
|
if (this.extractAction) {
|
|
244
|
-
return `${this.primaryAction.toMablscript()}.${this.extractAction.toMablscript()}.${this.conditionAction.toMablscript()}
|
|
254
|
+
return `${this.primaryAction.toMablscript()}.${this.extractAction.toMablscript()}.${this.conditionAction.toMablscript()}${assertAction}`;
|
|
255
|
+
}
|
|
256
|
+
if (this.assertionType === 'present' ||
|
|
257
|
+
this.assertionType === 'not_present') {
|
|
258
|
+
return `${this.primaryAction.generateFindMablscript()}.evaluate_presence("${this.assertionType}")${assertAction}`;
|
|
245
259
|
}
|
|
246
|
-
return `${this.primaryAction.toMablscript()}.${this.conditionAction.toMablscript()}
|
|
260
|
+
return `${this.primaryAction.toMablscript()}.${this.conditionAction.toMablscript()}${assertAction}`;
|
|
247
261
|
}
|
|
248
262
|
}
|
|
249
263
|
exports.AssertStep = AssertStep;
|
|
@@ -6,6 +6,8 @@ const MablStep_1 = require("../MablStep");
|
|
|
6
6
|
const FindAction_1 = require("../actions/FindAction");
|
|
7
7
|
const domUtil_1 = require("../../domUtil");
|
|
8
8
|
const importer_1 = require("../importer");
|
|
9
|
+
const GetCurrentLocationDescriptor_1 = require("../types/GetCurrentLocationDescriptor");
|
|
10
|
+
const GetVariableDescriptor_1 = require("../types/GetVariableDescriptor");
|
|
9
11
|
const oldToNewAssertionTypes = {
|
|
10
12
|
assert_contains: 'AssertContains',
|
|
11
13
|
assert_does_not_contain: 'AssertDoesNotContain',
|
|
@@ -31,8 +33,16 @@ class AssertStepOld extends MablStep_1.MablStep {
|
|
|
31
33
|
this.validate();
|
|
32
34
|
this.setAssertAttribute();
|
|
33
35
|
this.assertionType = this.name;
|
|
34
|
-
this.
|
|
36
|
+
this.primaryAction = actions[0];
|
|
35
37
|
this.extractAction = actions[1];
|
|
38
|
+
if (args.length === 1) {
|
|
39
|
+
this.continueOnFailure = args[0].onFailure === 'continue';
|
|
40
|
+
this.observationScope = args[0].observationScope;
|
|
41
|
+
}
|
|
42
|
+
else if (args.length === 2) {
|
|
43
|
+
this.continueOnFailure = args[1].onFailure === 'continue';
|
|
44
|
+
this.observationScope = args[1].observationScope;
|
|
45
|
+
}
|
|
36
46
|
}
|
|
37
47
|
validate() {
|
|
38
48
|
if (this.actions.length !== 2 &&
|
|
@@ -61,26 +71,34 @@ class AssertStepOld extends MablStep_1.MablStep {
|
|
|
61
71
|
ExtractAction_1.ExtractAction.mablscriptToYamlType[this.extractAction.extractionType];
|
|
62
72
|
formatted.attribute = this.extractAction.extractionAttribute;
|
|
63
73
|
}
|
|
64
|
-
const find = this.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
74
|
+
const find = this.primaryAction.toDescriptor();
|
|
75
|
+
formatted.findOptions = find.selectorFindOption;
|
|
76
|
+
if ((0, GetCurrentLocationDescriptor_1.isGetCurrentLocationDescriptor)(find) || (0, GetVariableDescriptor_1.isGetVariableDescriptor)(find)) {
|
|
77
|
+
formatted.kind = find.kind;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
switch (find.findType) {
|
|
81
|
+
case domUtil_1.FindType.FIND_COOKIE:
|
|
82
|
+
case domUtil_1.FindType.FIND_EMAIL:
|
|
83
|
+
formatted.findType = FindAction_1.findTypesToFormattedType[find.findType];
|
|
84
|
+
formatted.selector = find.findTarget;
|
|
85
|
+
break;
|
|
86
|
+
case domUtil_1.FindType.FIND_FIRST:
|
|
87
|
+
case domUtil_1.FindType.FIND_LAST:
|
|
88
|
+
case domUtil_1.FindType.FIND_ANY:
|
|
89
|
+
case domUtil_1.FindType.FIND_ALL:
|
|
90
|
+
formatted.findType = FindAction_1.findTypesToFormattedType[find.findType];
|
|
91
|
+
formatted.selector = find.findTarget;
|
|
92
|
+
break;
|
|
93
|
+
case domUtil_1.FindType.FIND_ONE:
|
|
94
|
+
formatted.selector = find.findTarget.selector;
|
|
95
|
+
break;
|
|
96
|
+
default:
|
|
97
|
+
throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
|
|
98
|
+
}
|
|
83
99
|
}
|
|
100
|
+
formatted.continueOnFailure = this.continueOnFailure;
|
|
101
|
+
formatted.observationScope = this.observationScope;
|
|
84
102
|
return formatted;
|
|
85
103
|
}
|
|
86
104
|
getNewAssertionStep() {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AwaitTabStep = void 0;
|
|
4
|
+
const domUtil_1 = require("../../domUtil");
|
|
4
5
|
const MablStep_1 = require("../MablStep");
|
|
5
6
|
class AwaitTabStep extends MablStep_1.MablStep {
|
|
6
7
|
constructor(name, args, actions) {
|
|
@@ -20,14 +21,14 @@ class AwaitTabStep extends MablStep_1.MablStep {
|
|
|
20
21
|
}
|
|
21
22
|
toMablscript() {
|
|
22
23
|
const mablscriptSelectorChunks = ['selector_type: "tab"'];
|
|
23
|
-
if (this.tab.title) {
|
|
24
|
-
mablscriptSelectorChunks.push(`title: "${this.tab.title}"`);
|
|
24
|
+
if (this.tab.title !== undefined) {
|
|
25
|
+
mablscriptSelectorChunks.push(`title: "${(0, domUtil_1.escapeMablscriptString)(this.tab.title)}"`);
|
|
25
26
|
}
|
|
26
|
-
if (this.tab.url) {
|
|
27
|
-
mablscriptSelectorChunks.push(`url: "${this.tab.url}"`);
|
|
27
|
+
if (this.tab.url !== undefined) {
|
|
28
|
+
mablscriptSelectorChunks.push(`url: "${(0, domUtil_1.escapeMablscriptString)(this.tab.url)}"`);
|
|
28
29
|
}
|
|
29
|
-
if (this.tab.uuid) {
|
|
30
|
-
mablscriptSelectorChunks.push(`uuid: "${this.tab.uuid}"`);
|
|
30
|
+
if (this.tab.uuid !== undefined) {
|
|
31
|
+
mablscriptSelectorChunks.push(`uuid: "${(0, domUtil_1.escapeMablscriptString)(this.tab.uuid)}"`);
|
|
31
32
|
}
|
|
32
33
|
return `await_tab({${mablscriptSelectorChunks.join(', ')}})`;
|
|
33
34
|
}
|
|
@@ -55,7 +55,7 @@ class ClickAndHoldStep extends MablStep_1.MablStep {
|
|
|
55
55
|
return new ClickAndHoldStep('click_and_hold', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
|
|
56
56
|
}
|
|
57
57
|
toMablscript() {
|
|
58
|
-
return `${this.findAction.toMablscript()}.click_and_hold()`;
|
|
58
|
+
return `${this.findAction.toMablscript()}.click_and_hold({isHtml5:${this.clickArgs.isHtml5}})`;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
exports.ClickAndHoldStep = ClickAndHoldStep;
|
|
@@ -4,6 +4,7 @@ exports.DownloadStep = void 0;
|
|
|
4
4
|
const MablStep_1 = require("../MablStep");
|
|
5
5
|
const AwaitDownloadAction_1 = require("../actions/AwaitDownloadAction");
|
|
6
6
|
const AwaitPDFDownloadAction_1 = require("../actions/AwaitPDFDownloadAction");
|
|
7
|
+
const domUtil_1 = require("../../domUtil");
|
|
7
8
|
class DownloadStep extends MablStep_1.MablStep {
|
|
8
9
|
constructor(name, args, actions) {
|
|
9
10
|
var _a;
|
|
@@ -77,8 +78,8 @@ class DownloadStep extends MablStep_1.MablStep {
|
|
|
77
78
|
return new DownloadStep('assert_download', [fileAttributes], [awaitDownloadAction]);
|
|
78
79
|
}
|
|
79
80
|
toMablscript() {
|
|
80
|
-
const mablArgs =
|
|
81
|
-
return `${this.awaitDownloadAction.toMablscript()}.assert_download(${mablArgs})`;
|
|
81
|
+
const mablArgs = (0, domUtil_1.buildStepArgumentString)(this.fileAttributes);
|
|
82
|
+
return `${this.awaitDownloadAction.toMablscript()}.assert_download(${mablArgs ? mablArgs : ''})`;
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
exports.DownloadStep = DownloadStep;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EchoStep = void 0;
|
|
4
4
|
const MablStep_1 = require("../MablStep");
|
|
5
|
+
const domUtil_1 = require("../../domUtil");
|
|
5
6
|
const SeleniumIdeStep_1 = require("./SeleniumIdeStep");
|
|
6
7
|
const MablAction_1 = require("../MablAction");
|
|
7
8
|
class EchoStep extends MablStep_1.MablStep {
|
|
@@ -24,7 +25,8 @@ class EchoStep extends MablStep_1.MablStep {
|
|
|
24
25
|
return new EchoStep('echo', [stepArgs.value], []);
|
|
25
26
|
}
|
|
26
27
|
toMablscript() {
|
|
27
|
-
|
|
28
|
+
const stringEchoValue = `${this.echoValue}`;
|
|
29
|
+
return `echo("${(0, domUtil_1.escapeMablscriptString)(stringEchoValue)}")`;
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
32
|
exports.EchoStep = EchoStep;
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ElseIfConditionStep = void 0;
|
|
4
|
+
const MablAction_1 = require("../MablAction");
|
|
4
5
|
const IfConditionStep_1 = require("./IfConditionStep");
|
|
5
6
|
class ElseIfConditionStep extends IfConditionStep_1.IfConditionStep {
|
|
6
7
|
getStepName() {
|
|
7
8
|
return 'ElseIf';
|
|
8
9
|
}
|
|
9
10
|
static fromYaml(_stepName, stepArgs) {
|
|
10
|
-
const actions =
|
|
11
|
+
const actions = [new MablAction_1.MablAction('conditional_else', [])];
|
|
12
|
+
actions.push(...IfConditionStep_1.IfConditionStep.getActionsFromYamlForCondition(stepArgs));
|
|
11
13
|
return new ElseIfConditionStep('conditional_else_if', [], actions);
|
|
12
14
|
}
|
|
13
15
|
toMablscript() {
|
|
14
|
-
|
|
16
|
+
const actions = this.actions.reduce((mablscript, action) => `${mablscript}${action.toMablscript()}.`, '');
|
|
17
|
+
return `conditional_else()${actions}conditional_else_if()`;
|
|
15
18
|
}
|
|
16
19
|
}
|
|
17
20
|
exports.ElseIfConditionStep = ElseIfConditionStep;
|
|
@@ -80,7 +80,10 @@ class EnterTextStep extends MablStep_1.MablStep {
|
|
|
80
80
|
return new EnterTextStep('enter_text', [stepArgs.text], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
|
|
81
81
|
}
|
|
82
82
|
toMablscript() {
|
|
83
|
-
|
|
83
|
+
const enterText = typeof this.text === 'string'
|
|
84
|
+
? `"${(0, domUtil_1.escapeMablscriptString)(this.text)}"`
|
|
85
|
+
: this.substituteMablscriptVariable(this.text);
|
|
86
|
+
return `${this.findAction.toMablscript()}.enter_text(${enterText})`;
|
|
84
87
|
}
|
|
85
88
|
}
|
|
86
89
|
exports.EnterTextStep = EnterTextStep;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EvaluateFlowStep = void 0;
|
|
4
|
+
const MablStep_1 = require("../MablStep");
|
|
5
|
+
const domUtil_1 = require("../../domUtil");
|
|
6
|
+
class EvaluateFlowStep extends MablStep_1.MablStep {
|
|
7
|
+
constructor(name, args, actions) {
|
|
8
|
+
super(name, args, actions);
|
|
9
|
+
if (args.length < 1 || args.length > 2) {
|
|
10
|
+
throw new Error('EvaluateFlowStep expects 1 or 2 arguments');
|
|
11
|
+
}
|
|
12
|
+
this.flowDescriptor = this.getActionArgs()[0];
|
|
13
|
+
if (args.length === 2) {
|
|
14
|
+
this.config = this.getActionArgs()[1];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
getStepName() {
|
|
18
|
+
return EvaluateFlowStep.yamlMablScriptNames[0];
|
|
19
|
+
}
|
|
20
|
+
toStepDescriptor() {
|
|
21
|
+
return {
|
|
22
|
+
descriptor: this.flowDescriptor,
|
|
23
|
+
config: this.config,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
static fromYaml(_stepName, stepArgs) {
|
|
27
|
+
const { descriptor, config } = stepArgs;
|
|
28
|
+
return new EvaluateFlowStep(EvaluateFlowStep.mablScriptStepNames[0], [descriptor, config], []);
|
|
29
|
+
}
|
|
30
|
+
toMablscript() {
|
|
31
|
+
const flowReference = (0, domUtil_1.buildStepArgumentString)(this.flowDescriptor);
|
|
32
|
+
const flowConfig = this.config
|
|
33
|
+
? ', ' + (0, domUtil_1.buildStepArgumentString)(this.config)
|
|
34
|
+
: '';
|
|
35
|
+
return `${EvaluateFlowStep.mablScriptStepNames[0]}(${flowReference}${flowConfig})`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.EvaluateFlowStep = EvaluateFlowStep;
|
|
39
|
+
EvaluateFlowStep.mablScriptStepNames = ['evaluate_flow'];
|
|
40
|
+
EvaluateFlowStep.yamlMablScriptNames = ['EvaluateFlow'];
|
|
@@ -55,7 +55,8 @@ class ReleaseStep extends MablStep_1.MablStep {
|
|
|
55
55
|
return new ReleaseStep('release', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
|
|
56
56
|
}
|
|
57
57
|
toMablscript() {
|
|
58
|
-
|
|
58
|
+
const args = this.convertObjectToMablscriptArgs(this.releaseArgs);
|
|
59
|
+
return `${this.findAction.toMablscript()}.release(${args})`;
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
exports.ReleaseStep = ReleaseStep;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RemoveCookieStep = void 0;
|
|
4
4
|
const MablStep_1 = require("../MablStep");
|
|
5
5
|
const CookieUtils_1 = require("./CookieUtils");
|
|
6
|
+
const domUtil_1 = require("../../domUtil");
|
|
6
7
|
class RemoveCookieStep extends MablStep_1.MablStep {
|
|
7
8
|
constructor(name, args, actions) {
|
|
8
9
|
super(name, args, actions);
|
|
@@ -20,9 +21,7 @@ class RemoveCookieStep extends MablStep_1.MablStep {
|
|
|
20
21
|
return new RemoveCookieStep('remove_cookie', [stepArgs], []);
|
|
21
22
|
}
|
|
22
23
|
toMablscript() {
|
|
23
|
-
return `remove_cookie(${this.
|
|
24
|
-
name: this.cookieName,
|
|
25
|
-
})})`;
|
|
24
|
+
return `remove_cookie({ name : "${(0, domUtil_1.escapeMablscriptString)(this.cookieName)}" })`;
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
27
|
exports.RemoveCookieStep = RemoveCookieStep;
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VariableSource = exports.HttpResponseAssertion = exports.SendHttpRequestStep = void 0;
|
|
4
4
|
const MablStep_1 = require("../MablStep");
|
|
5
|
-
const AssertStep_1 = require("./AssertStep");
|
|
6
5
|
const ConditionDescriptor_1 = require("../types/ConditionDescriptor");
|
|
6
|
+
const AssertStep_1 = require("./AssertStep");
|
|
7
|
+
const domUtil_1 = require("../../domUtil");
|
|
7
8
|
const evalAssertionType = {};
|
|
8
9
|
Object.entries(AssertStep_1.assertionStepToField).forEach(([stepType, field]) => (evalAssertionType[field] = `${stepType.split('Assert')[1]}`));
|
|
9
10
|
class SendHttpRequestStep extends MablStep_1.MablStep {
|
|
@@ -36,8 +37,7 @@ class SendHttpRequestStep extends MablStep_1.MablStep {
|
|
|
36
37
|
return new SendHttpRequestStep('send_http_request', [formatted], []);
|
|
37
38
|
}
|
|
38
39
|
toMablscript() {
|
|
39
|
-
|
|
40
|
-
return `send_http_request(${stepAsSource})`;
|
|
40
|
+
return `send_http_request(${(0, domUtil_1.buildStepArgumentString)(this.sendRequest)})`;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
exports.SendHttpRequestStep = SendHttpRequestStep;
|
|
@@ -100,8 +100,8 @@ class SendKeyStep extends MablStep_1.MablStep {
|
|
|
100
100
|
}
|
|
101
101
|
toMablscript() {
|
|
102
102
|
const keysToSend = this.keys
|
|
103
|
-
.map((key) =>
|
|
104
|
-
.join(
|
|
103
|
+
.map((key) => (0, domUtil_1.buildStepArgumentString)(key))
|
|
104
|
+
.join();
|
|
105
105
|
return `${this.findAction.toMablscript()}.send_keys(${keysToSend})`;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SetCookieStep = void 0;
|
|
4
4
|
const MablStep_1 = require("../MablStep");
|
|
5
5
|
const CookieUtils_1 = require("./CookieUtils");
|
|
6
|
+
const domUtil_1 = require("../../domUtil");
|
|
6
7
|
const validValueCharacters = /^(!|[\x23-\x2B]|[\x2D-\x3A]|[\x3C-\x5B]|[\x5D-\x7E])*$/;
|
|
7
8
|
class SetCookieStep extends MablStep_1.MablStep {
|
|
8
9
|
constructor(name, args, actions) {
|
|
@@ -20,10 +21,7 @@ class SetCookieStep extends MablStep_1.MablStep {
|
|
|
20
21
|
return new SetCookieStep('set_cookie', [stepArgs], []);
|
|
21
22
|
}
|
|
22
23
|
toMablscript() {
|
|
23
|
-
return `set_cookie(${this.
|
|
24
|
-
name: this.cookieName,
|
|
25
|
-
value: this.cookieValue,
|
|
26
|
-
})})`;
|
|
24
|
+
return `set_cookie({ name : "${(0, domUtil_1.escapeMablscriptString)(this.cookieName)}", value : "${(0, domUtil_1.escapeMablscriptString)(this.cookieValue)}" })`;
|
|
27
25
|
}
|
|
28
26
|
static normalizeValue(value) {
|
|
29
27
|
const trimmed = value.trim();
|
|
@@ -28,7 +28,7 @@ class SetViewportStep extends MablStep_1.MablStep {
|
|
|
28
28
|
toMablscript() {
|
|
29
29
|
let sizeArg;
|
|
30
30
|
if (this.size.height && this.size.width) {
|
|
31
|
-
sizeArg = `{ size : { width : ${this.size.width}, height: ${this.size.height} } }`;
|
|
31
|
+
sizeArg = `{ size : { width : ${this.size.width}, height : ${this.size.height} } }`;
|
|
32
32
|
}
|
|
33
33
|
else if (this.size.width) {
|
|
34
34
|
sizeArg = `{ size : { width : ${this.size.width} } }`;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.VisitUrlStep = void 0;
|
|
4
4
|
const MablStep_1 = require("../MablStep");
|
|
5
5
|
const SeleniumIdeStep_1 = require("./SeleniumIdeStep");
|
|
6
|
+
const domUtil_1 = require("../../domUtil");
|
|
6
7
|
class VisitUrlStep extends MablStep_1.MablStep {
|
|
7
8
|
constructor(name, args, actions) {
|
|
8
9
|
super(name, args, actions);
|
|
@@ -28,7 +29,7 @@ class VisitUrlStep extends MablStep_1.MablStep {
|
|
|
28
29
|
return new VisitUrlStep('visit_url', [stepArgs.url], []);
|
|
29
30
|
}
|
|
30
31
|
toMablscript() {
|
|
31
|
-
const resolvedUrl = this.substituteMablscriptVariable(this.url.toString());
|
|
32
|
+
const resolvedUrl = this.substituteMablscriptVariable((0, domUtil_1.escapeMablscriptString)(this.url.toString()));
|
|
32
33
|
if (VisitUrlStep.isInProduction() && VisitUrlStep.isFileUrl(resolvedUrl)) {
|
|
33
34
|
throw new Error('Access to local files is not permitted');
|
|
34
35
|
}
|
|
@@ -25,15 +25,12 @@ class WaitStep extends MablStep_1.MablStep {
|
|
|
25
25
|
return new WaitStep('wait', [stepArgs.milliseconds], []);
|
|
26
26
|
}
|
|
27
27
|
toMablscript() {
|
|
28
|
-
return `wait(
|
|
28
|
+
return `wait(${this.milliseconds})`;
|
|
29
29
|
}
|
|
30
30
|
static validateWait(wait) {
|
|
31
31
|
if (typeof wait !== 'number') {
|
|
32
32
|
throw new Error(`Invalid wait argument [${wait}]`);
|
|
33
33
|
}
|
|
34
|
-
if (wait < 1000 || wait > 900000) {
|
|
35
|
-
throw new Error('Wait must be between 1 and 900 seconds');
|
|
36
|
-
}
|
|
37
34
|
return wait;
|
|
38
35
|
}
|
|
39
36
|
}
|
|
File without changes
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.newGetCurrentLocationDescriptor = exports.isGetCurrentLocationDescriptor = void 0;
|
|
3
|
+
exports.newGetCurrentLocationDescriptor = exports.isGetCurrentLocationDescriptor = exports.GET_CURRENT_LOCATION_KIND = void 0;
|
|
4
|
+
exports.GET_CURRENT_LOCATION_KIND = 'Location';
|
|
4
5
|
function isGetCurrentLocationDescriptor(value) {
|
|
5
|
-
return value.kind ===
|
|
6
|
+
return (value.kind === exports.GET_CURRENT_LOCATION_KIND);
|
|
6
7
|
}
|
|
7
8
|
exports.isGetCurrentLocationDescriptor = isGetCurrentLocationDescriptor;
|
|
8
9
|
function newGetCurrentLocationDescriptor() {
|
|
9
|
-
return { kind:
|
|
10
|
+
return { kind: exports.GET_CURRENT_LOCATION_KIND };
|
|
10
11
|
}
|
|
11
12
|
exports.newGetCurrentLocationDescriptor = newGetCurrentLocationDescriptor;
|