@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
|
@@ -4,61 +4,43 @@ exports.OpenEmailStep = void 0;
|
|
|
4
4
|
const FindAction_1 = require("../actions/FindAction");
|
|
5
5
|
const MablStepWithFindAction_1 = require("../MablStepWithFindAction");
|
|
6
6
|
class OpenEmailStep extends MablStepWithFindAction_1.MablStepWithFindAction {
|
|
7
|
-
constructor(
|
|
8
|
-
super(
|
|
9
|
-
this.tabUuid =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
constructor(name, args, actions) {
|
|
8
|
+
super(name, args, actions, OpenEmailStep.stepName);
|
|
9
|
+
this.tabUuid = this.getActionArgs()[0] || {};
|
|
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)) {
|
|
13
15
|
throw new Error('Open email steps should have exactly one sub action and it should be a find');
|
|
14
16
|
}
|
|
15
|
-
return actions[0];
|
|
16
17
|
}
|
|
17
18
|
getStepName() {
|
|
18
|
-
return
|
|
19
|
+
return 'OpenEmail';
|
|
19
20
|
}
|
|
20
21
|
toStepDescriptor() {
|
|
21
|
-
|
|
22
|
+
const find = this.findAction.toDescriptor();
|
|
23
|
+
return {
|
|
24
|
+
tab: this.tabUuid,
|
|
25
|
+
selector: find.findTarget.selector,
|
|
26
|
+
findType: 'FindEmail',
|
|
27
|
+
configuration: find.findTarget.configuration,
|
|
28
|
+
actionCode: this.actionCode,
|
|
29
|
+
};
|
|
22
30
|
}
|
|
23
31
|
static fromYaml(_stepName, stepArgs) {
|
|
24
|
-
const
|
|
25
|
-
const stepDescriptor = buildStepDescriptor(findAction, stepArgs.tab);
|
|
26
|
-
const step = new OpenEmailStep(stepDescriptor, findAction);
|
|
32
|
+
const step = new OpenEmailStep(OpenEmailStep.stepName, [stepArgs.tab], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
|
|
27
33
|
step.setStepId(stepArgs.id);
|
|
28
34
|
return step;
|
|
29
35
|
}
|
|
30
|
-
static fromLegacyMablscript(args, actions) {
|
|
31
|
-
const tabUuid = args[0] ?? '';
|
|
32
|
-
if (actions.length !== 1 || !(actions[0] instanceof FindAction_1.FindAction)) {
|
|
33
|
-
throw new Error('Open email steps should have exactly one sub action and it should be a find');
|
|
34
|
-
}
|
|
35
|
-
const findAction = actions[0];
|
|
36
|
-
const stepDescriptor = buildStepDescriptor(findAction, tabUuid);
|
|
37
|
-
return new OpenEmailStep(stepDescriptor, findAction);
|
|
38
|
-
}
|
|
39
36
|
toMablscript() {
|
|
40
37
|
return `${this.findAction.toMablscript()}.open_email("${this.tabUuid}")`;
|
|
41
38
|
}
|
|
42
39
|
getInputVariables() {
|
|
43
40
|
return this.findAction.getInputVariables();
|
|
44
41
|
}
|
|
45
|
-
stepDescription() {
|
|
46
|
-
const emailDescription = this.humanizeFind();
|
|
47
|
-
return `Open ${emailDescription}`;
|
|
48
|
-
}
|
|
49
42
|
}
|
|
50
43
|
exports.OpenEmailStep = OpenEmailStep;
|
|
51
|
-
OpenEmailStep.stepName = '
|
|
52
|
-
OpenEmailStep.
|
|
53
|
-
OpenEmailStep.
|
|
54
|
-
OpenEmailStep.yamlMablScriptNames = [OpenEmailStep.stepName];
|
|
55
|
-
function buildStepDescriptor(findAction, tabUuid) {
|
|
56
|
-
const find = findAction.toDescriptor();
|
|
57
|
-
return {
|
|
58
|
-
tab: tabUuid,
|
|
59
|
-
selector: find.findTarget.selector,
|
|
60
|
-
findType: 'FindEmail',
|
|
61
|
-
configuration: find.findTarget.configuration,
|
|
62
|
-
actionCode: OpenEmailStep.actionCode,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
44
|
+
OpenEmailStep.stepName = 'open_email';
|
|
45
|
+
OpenEmailStep.mablScriptStepNames = [OpenEmailStep.stepName];
|
|
46
|
+
OpenEmailStep.yamlMablScriptNames = ['OpenEmail'];
|
|
@@ -8,42 +8,60 @@ const ActionsUtils_1 = require("./ActionsUtils");
|
|
|
8
8
|
const ReleaseStepDescriptor_1 = require("../types/ReleaseStepDescriptor");
|
|
9
9
|
const MablStepWithFindAction_1 = require("../MablStepWithFindAction");
|
|
10
10
|
class ReleaseStep extends MablStepWithFindAction_1.MablStepWithFindAction {
|
|
11
|
-
constructor(
|
|
12
|
-
super(
|
|
13
|
-
this.
|
|
11
|
+
constructor(name, args, actions) {
|
|
12
|
+
super(name, args, actions, 'release');
|
|
13
|
+
this.findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(this.actions);
|
|
14
|
+
this.releaseArgs = this.parseArgs(args) ?? { isHtml5: false };
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
+
parseArgs(args) {
|
|
16
17
|
if (args.length === 0) {
|
|
17
18
|
return undefined;
|
|
18
19
|
}
|
|
19
20
|
if (args.length !== 1) {
|
|
20
|
-
throw new Error(`Unexpected number of arguments to
|
|
21
|
+
throw new Error(`Unexpected number of arguments to ${this.getStepName()} step.`);
|
|
21
22
|
}
|
|
22
23
|
if (!(0, ReleaseStepDescriptor_1.isReleaseArgs)(args[0])) {
|
|
23
|
-
throw new Error(`Invalid argument passed to
|
|
24
|
+
throw new Error(`Invalid argument passed to ${this.getStepName()} step.`);
|
|
24
25
|
}
|
|
25
26
|
return args[0];
|
|
26
27
|
}
|
|
27
28
|
getStepName() {
|
|
28
|
-
return
|
|
29
|
+
return 'Release';
|
|
29
30
|
}
|
|
30
31
|
toStepDescriptor() {
|
|
31
|
-
|
|
32
|
+
const find = this.findAction.toDescriptor();
|
|
33
|
+
switch (find.findType) {
|
|
34
|
+
case domUtil_1.FindType.FIND_FIRST:
|
|
35
|
+
case domUtil_1.FindType.FIND_LAST:
|
|
36
|
+
case domUtil_1.FindType.FIND_ANY:
|
|
37
|
+
case domUtil_1.FindType.FIND_ONE:
|
|
38
|
+
return {
|
|
39
|
+
find,
|
|
40
|
+
descriptorToActionMap: new Map().set(find, this.findAction),
|
|
41
|
+
actionCode: this.actionCode,
|
|
42
|
+
releaseArgs: this.releaseArgs,
|
|
43
|
+
};
|
|
44
|
+
default:
|
|
45
|
+
throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
getFormattedStep(_fullLocatorsOn) {
|
|
49
|
+
const step = {
|
|
50
|
+
Release: {
|
|
51
|
+
...super.annotationsAsYml(),
|
|
52
|
+
...this.findAction.toYaml(),
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
if (this.stepId()) {
|
|
56
|
+
step.Release.id = this.stepId();
|
|
57
|
+
}
|
|
58
|
+
return step;
|
|
32
59
|
}
|
|
33
60
|
static fromYaml(_stepName, stepArgs) {
|
|
34
|
-
const
|
|
35
|
-
const releaseArgs = { isHtml5: false };
|
|
36
|
-
const stepDescriptor = buildStepDescriptor(findAction, releaseArgs);
|
|
37
|
-
const step = new ReleaseStep(stepDescriptor, findAction);
|
|
61
|
+
const step = new ReleaseStep('release', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
|
|
38
62
|
step.setStepId(stepArgs.id);
|
|
39
63
|
return step;
|
|
40
64
|
}
|
|
41
|
-
static fromLegacyMablscript(args, actions) {
|
|
42
|
-
const findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(actions);
|
|
43
|
-
const releaseArgs = ReleaseStep.parseArgs(args) ?? { isHtml5: false };
|
|
44
|
-
const stepDescriptor = buildStepDescriptor(findAction, releaseArgs);
|
|
45
|
-
return new ReleaseStep(stepDescriptor, findAction);
|
|
46
|
-
}
|
|
47
65
|
toMablscript() {
|
|
48
66
|
const args = (0, MablAction_1.convertObjectToMablscriptArgs)(this.releaseArgs);
|
|
49
67
|
return `${this.findAction.toMablscript()}.release(${args})`;
|
|
@@ -51,33 +69,7 @@ class ReleaseStep extends MablStepWithFindAction_1.MablStepWithFindAction {
|
|
|
51
69
|
getInputVariables() {
|
|
52
70
|
return this.findAction.getInputVariables();
|
|
53
71
|
}
|
|
54
|
-
stepDescription() {
|
|
55
|
-
const actionPrefix = this.releaseArgs.isHtml5
|
|
56
|
-
? 'Simulate release'
|
|
57
|
-
: 'Release';
|
|
58
|
-
const elementDescription = this.humanizeFind();
|
|
59
|
-
return `${actionPrefix} on ${elementDescription}`;
|
|
60
|
-
}
|
|
61
72
|
}
|
|
62
73
|
exports.ReleaseStep = ReleaseStep;
|
|
63
|
-
ReleaseStep.
|
|
64
|
-
ReleaseStep.
|
|
65
|
-
ReleaseStep.mablScriptStepNames = [ReleaseStep.actionCode];
|
|
66
|
-
ReleaseStep.yamlMablScriptNames = [ReleaseStep.stepName];
|
|
67
|
-
function buildStepDescriptor(findAction, releaseArgs) {
|
|
68
|
-
const find = findAction.toDescriptor();
|
|
69
|
-
switch (find.findType) {
|
|
70
|
-
case domUtil_1.FindType.FIND_FIRST:
|
|
71
|
-
case domUtil_1.FindType.FIND_LAST:
|
|
72
|
-
case domUtil_1.FindType.FIND_ANY:
|
|
73
|
-
case domUtil_1.FindType.FIND_ONE:
|
|
74
|
-
return {
|
|
75
|
-
find,
|
|
76
|
-
descriptorToActionMap: new Map().set(find, findAction),
|
|
77
|
-
actionCode: 'release',
|
|
78
|
-
releaseArgs,
|
|
79
|
-
};
|
|
80
|
-
default:
|
|
81
|
-
throw new Error(`Error generating step descriptor for Release: Unexpected find type ${find.findType}`);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
74
|
+
ReleaseStep.mablScriptStepNames = ['release'];
|
|
75
|
+
ReleaseStep.yamlMablScriptNames = ['Release'];
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RemoveCookieStep = void 0;
|
|
4
|
-
const
|
|
4
|
+
const MablStep_1 = require("../MablStep");
|
|
5
5
|
const MablAction_1 = require("../MablAction");
|
|
6
6
|
const CookieUtils_1 = require("./CookieUtils");
|
|
7
7
|
const domUtil_1 = require("../../domUtil");
|
|
8
|
-
class RemoveCookieStep extends
|
|
9
|
-
constructor(
|
|
10
|
-
super(
|
|
11
|
-
this.cookieName =
|
|
8
|
+
class RemoveCookieStep extends MablStep_1.MablStep {
|
|
9
|
+
constructor(name, args, actions) {
|
|
10
|
+
super(name, args, actions, 'remove_cookie');
|
|
11
|
+
this.cookieName = CookieUtils_1.CookieUtils.normalizeName(this.getActionArgs()[0].name);
|
|
12
12
|
}
|
|
13
13
|
getStepName() {
|
|
14
|
-
return
|
|
14
|
+
return 'RemoveCookie';
|
|
15
15
|
}
|
|
16
16
|
toStepDescriptor() {
|
|
17
17
|
return {
|
|
@@ -20,33 +20,17 @@ class RemoveCookieStep extends MablStepV2_1.MablStepV2 {
|
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
static fromYaml(_stepName, stepArgs) {
|
|
23
|
-
const
|
|
24
|
-
actionCode: RemoveCookieStep.actionCode,
|
|
25
|
-
name: CookieUtils_1.CookieUtils.normalizeName(stepArgs.name),
|
|
26
|
-
};
|
|
27
|
-
const step = new RemoveCookieStep(stepDescriptor);
|
|
23
|
+
const step = new RemoveCookieStep('remove_cookie', [stepArgs], []);
|
|
28
24
|
step.setStepId(stepArgs.id);
|
|
29
25
|
return step;
|
|
30
26
|
}
|
|
31
|
-
static fromLegacyMablscript(args, _actions) {
|
|
32
|
-
const stepDescriptor = {
|
|
33
|
-
actionCode: RemoveCookieStep.actionCode,
|
|
34
|
-
name: CookieUtils_1.CookieUtils.normalizeName(args[0].name),
|
|
35
|
-
};
|
|
36
|
-
return new RemoveCookieStep(stepDescriptor);
|
|
37
|
-
}
|
|
38
27
|
toMablscript() {
|
|
39
28
|
return `remove_cookie({ name : "${(0, domUtil_1.escapeMablscriptString)(this.cookieName)}" })`;
|
|
40
29
|
}
|
|
41
30
|
getInputVariables() {
|
|
42
31
|
return MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.cookieName);
|
|
43
32
|
}
|
|
44
|
-
stepDescription() {
|
|
45
|
-
return `Remove cookie: "${this.cookieName}"`;
|
|
46
|
-
}
|
|
47
33
|
}
|
|
48
34
|
exports.RemoveCookieStep = RemoveCookieStep;
|
|
49
|
-
RemoveCookieStep.
|
|
50
|
-
RemoveCookieStep.
|
|
51
|
-
RemoveCookieStep.mablScriptStepNames = [RemoveCookieStep.actionCode];
|
|
52
|
-
RemoveCookieStep.yamlMablScriptNames = [RemoveCookieStep.stepName];
|
|
35
|
+
RemoveCookieStep.mablScriptStepNames = ['remove_cookie'];
|
|
36
|
+
RemoveCookieStep.yamlMablScriptNames = ['RemoveCookie'];
|
|
@@ -6,56 +6,53 @@ const domUtil_1 = require("../../domUtil");
|
|
|
6
6
|
const ActionsUtils_1 = require("./ActionsUtils");
|
|
7
7
|
const MablStepWithFindAction_1 = require("../MablStepWithFindAction");
|
|
8
8
|
class RightClickStep extends MablStepWithFindAction_1.MablStepWithFindAction {
|
|
9
|
-
constructor(
|
|
10
|
-
super(
|
|
9
|
+
constructor(name, args, actions) {
|
|
10
|
+
super(name, args, actions, 'right_click');
|
|
11
|
+
this.findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(this.actions);
|
|
11
12
|
}
|
|
12
13
|
getStepName() {
|
|
13
|
-
return
|
|
14
|
+
return 'RightClick';
|
|
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
|
+
RightClick: {
|
|
35
|
+
...super.annotationsAsYml(),
|
|
36
|
+
...this.findAction.toYaml(),
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
if (this.stepId()) {
|
|
40
|
+
step.RightClick.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 RightClickStep(stepDescriptor, findAction);
|
|
45
|
+
const step = new RightClickStep('right_click', [], [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 RightClickStep(stepDescriptor, findAction);
|
|
29
|
-
}
|
|
30
49
|
toMablscript() {
|
|
31
50
|
return `${this.findAction.toMablscript()}.right_click()`;
|
|
32
51
|
}
|
|
33
52
|
getInputVariables() {
|
|
34
53
|
return this.findAction.getInputVariables();
|
|
35
54
|
}
|
|
36
|
-
stepDescription() {
|
|
37
|
-
const elementDescription = this.humanizeFind();
|
|
38
|
-
return `Right click on ${elementDescription}`;
|
|
39
|
-
}
|
|
40
55
|
}
|
|
41
56
|
exports.RightClickStep = RightClickStep;
|
|
42
|
-
RightClickStep.
|
|
43
|
-
RightClickStep.
|
|
44
|
-
RightClickStep.mablScriptStepNames = [RightClickStep.actionCode];
|
|
45
|
-
RightClickStep.yamlMablScriptNames = [RightClickStep.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: RightClickStep.actionCode,
|
|
57
|
-
};
|
|
58
|
-
default:
|
|
59
|
-
throw new Error(`Error generating step descriptor for ${RightClickStep.stepName}: Unexpected find type ${find.findType}`);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
57
|
+
RightClickStep.mablScriptStepNames = ['right_click'];
|
|
58
|
+
RightClickStep.yamlMablScriptNames = ['RightClick'];
|
|
@@ -6,20 +6,37 @@ const MablAction_1 = require("../MablAction");
|
|
|
6
6
|
const domUtil_1 = require("../../domUtil");
|
|
7
7
|
const MablStepWithFindAction_1 = require("../MablStepWithFindAction");
|
|
8
8
|
class SelectStep extends MablStepWithFindAction_1.MablStepWithFindAction {
|
|
9
|
-
constructor(
|
|
10
|
-
super(
|
|
9
|
+
constructor(name, args, actions) {
|
|
10
|
+
super(name, args, actions, 'select');
|
|
11
|
+
this.selectOptions = this.getActionArgs()[0];
|
|
12
|
+
this.selectOptionType = this.getActionArgs()[1];
|
|
13
|
+
this.validate();
|
|
14
|
+
this.findAction = this.actions[0];
|
|
11
15
|
}
|
|
12
|
-
|
|
13
|
-
if (actions.length !== 1
|
|
14
|
-
throw new Error('Select steps should have exactly
|
|
16
|
+
validate() {
|
|
17
|
+
if (this.actions.length !== 1 && !(this.actions[0] instanceof FindAction_1.FindAction)) {
|
|
18
|
+
throw new Error('Select steps should have exactly on sub action and it should be a find');
|
|
15
19
|
}
|
|
16
|
-
return actions[0];
|
|
17
20
|
}
|
|
18
21
|
getStepName() {
|
|
19
|
-
return
|
|
22
|
+
return 'Select';
|
|
20
23
|
}
|
|
21
24
|
toStepDescriptor() {
|
|
22
|
-
|
|
25
|
+
const selectOptionsCopy = this.selectOptions;
|
|
26
|
+
selectOptionsCopy.selectOptionType = this.selectOptionType;
|
|
27
|
+
const formatted = { ...selectOptionsCopy };
|
|
28
|
+
const find = this.findAction.toDescriptor();
|
|
29
|
+
switch (find.findType) {
|
|
30
|
+
case domUtil_1.FindType.FIND_FIRST:
|
|
31
|
+
case domUtil_1.FindType.FIND_LAST:
|
|
32
|
+
case domUtil_1.FindType.FIND_ANY:
|
|
33
|
+
case domUtil_1.FindType.FIND_ONE:
|
|
34
|
+
formatted.find = find;
|
|
35
|
+
formatted.descriptorToActionMap = new Map().set(find, this.findAction);
|
|
36
|
+
return formatted;
|
|
37
|
+
default:
|
|
38
|
+
throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
|
|
39
|
+
}
|
|
23
40
|
}
|
|
24
41
|
static fromYaml(_stepName, stepArgs) {
|
|
25
42
|
const findAction = FindAction_1.FindAction.findActionFromStepArgs(stepArgs);
|
|
@@ -28,78 +45,38 @@ class SelectStep extends MablStepWithFindAction_1.MablStepWithFindAction {
|
|
|
28
45
|
delete stepArgs.selectorAncestors;
|
|
29
46
|
delete stepArgs.selectOptionType;
|
|
30
47
|
const selectOptions = stepArgs;
|
|
31
|
-
const
|
|
32
|
-
const step = new SelectStep(stepDescriptor, findAction);
|
|
48
|
+
const step = new SelectStep('select', [selectOptions, selectOptionType], [findAction]);
|
|
33
49
|
step.setStepId(stepArgs.id);
|
|
34
50
|
return step;
|
|
35
51
|
}
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
52
|
+
getFormattedStep(_fullLocatorsOn) {
|
|
53
|
+
const step = this.selectOptions;
|
|
54
|
+
const { find, ...ymlStep } = step;
|
|
55
|
+
const finalStep = {
|
|
56
|
+
Select: {
|
|
57
|
+
...ymlStep,
|
|
58
|
+
...super.annotationsAsYml(),
|
|
59
|
+
...this.findAction.toYaml(),
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
if (this.stepId()) {
|
|
63
|
+
finalStep.Select.id = this.stepId();
|
|
64
|
+
}
|
|
65
|
+
return finalStep;
|
|
42
66
|
}
|
|
43
67
|
toMablscript() {
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
const selectOptions = {
|
|
47
|
-
index: descriptor.index,
|
|
48
|
-
position: descriptor.position,
|
|
49
|
-
selector_type: descriptor.selector_type,
|
|
50
|
-
text: descriptor.text,
|
|
51
|
-
uuid: descriptor.uuid,
|
|
52
|
-
value: descriptor.value,
|
|
53
|
-
};
|
|
54
|
-
const mablscriptSelectOptions = (0, MablAction_1.convertObjectToMablscriptArgs)(selectOptions);
|
|
55
|
-
const mablscriptSelectType = selectOptionType
|
|
56
|
-
? `, "${selectOptionType}"`
|
|
68
|
+
const selectOptionType = this.selectOptionType
|
|
69
|
+
? `, "${this.selectOptionType}"`
|
|
57
70
|
: '';
|
|
58
|
-
|
|
59
|
-
return `${this.findAction.toMablscript()}.select(${mablscriptSelectArgs})`;
|
|
71
|
+
return `${this.findAction.toMablscript()}.select(${(0, MablAction_1.convertObjectToMablscriptArgs)(this.selectOptions)}${selectOptionType})`;
|
|
60
72
|
}
|
|
61
73
|
getInputVariables() {
|
|
62
74
|
return (0, MablAction_1.distinctStrings)([
|
|
63
75
|
...this.findAction.getInputVariables(),
|
|
64
|
-
...MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.
|
|
76
|
+
...MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.selectOptions),
|
|
65
77
|
]);
|
|
66
78
|
}
|
|
67
|
-
stepDescription() {
|
|
68
|
-
let selectionDescription = 'option';
|
|
69
|
-
const descriptor = this.descriptor;
|
|
70
|
-
if (descriptor.value) {
|
|
71
|
-
selectionDescription = `"${descriptor.value}"`;
|
|
72
|
-
}
|
|
73
|
-
else if (descriptor.text) {
|
|
74
|
-
selectionDescription = `"${descriptor.text}"`;
|
|
75
|
-
}
|
|
76
|
-
else if (descriptor.index !== undefined) {
|
|
77
|
-
selectionDescription = `option ${descriptor.index}`;
|
|
78
|
-
}
|
|
79
|
-
const elementDescription = this.humanizeFind();
|
|
80
|
-
return `Select ${selectionDescription} from ${elementDescription}`;
|
|
81
|
-
}
|
|
82
79
|
}
|
|
83
80
|
exports.SelectStep = SelectStep;
|
|
84
|
-
SelectStep.
|
|
85
|
-
SelectStep.
|
|
86
|
-
SelectStep.mablScriptStepNames = [SelectStep.actionCode];
|
|
87
|
-
SelectStep.yamlMablScriptNames = [SelectStep.stepName];
|
|
88
|
-
function buildStepDescriptor(findAction, selectOptions, selectOptionType) {
|
|
89
|
-
const find = findAction.toDescriptor();
|
|
90
|
-
switch (find.findType) {
|
|
91
|
-
case domUtil_1.FindType.FIND_FIRST:
|
|
92
|
-
case domUtil_1.FindType.FIND_LAST:
|
|
93
|
-
case domUtil_1.FindType.FIND_ANY:
|
|
94
|
-
case domUtil_1.FindType.FIND_ONE:
|
|
95
|
-
const descriptorToActionMap = new Map().set(find, findAction);
|
|
96
|
-
return {
|
|
97
|
-
find,
|
|
98
|
-
descriptorToActionMap,
|
|
99
|
-
selectOptionType,
|
|
100
|
-
...selectOptions,
|
|
101
|
-
};
|
|
102
|
-
default:
|
|
103
|
-
throw new Error(`Error generating step descriptor for ${SelectStep.stepName}: Unexpected find type ${find.findType}`);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
81
|
+
SelectStep.mablScriptStepNames = ['select'];
|
|
82
|
+
SelectStep.yamlMablScriptNames = ['Select'];
|
|
@@ -4,8 +4,8 @@ exports.SendHttpRequestVariableSource = exports.SendHttpRequestStep = void 0;
|
|
|
4
4
|
const ConditionDescriptor_1 = require("../types/ConditionDescriptor");
|
|
5
5
|
const AbstractAssertionsAndVariablesStep_1 = require("./AbstractAssertionsAndVariablesStep");
|
|
6
6
|
class SendHttpRequestStep extends AbstractAssertionsAndVariablesStep_1.AbstractAssertionsAndVariablesStep {
|
|
7
|
-
constructor(
|
|
8
|
-
super(
|
|
7
|
+
constructor(name, args, actions) {
|
|
8
|
+
super(name, args, actions, 'send_http_request', SendHttpRequestStep.stepName, args[0]);
|
|
9
9
|
}
|
|
10
10
|
static fromYaml(_stepName, stepArgs) {
|
|
11
11
|
const formatted = stepArgs;
|
|
@@ -28,23 +28,14 @@ class SendHttpRequestStep extends AbstractAssertionsAndVariablesStep_1.AbstractA
|
|
|
28
28
|
assertion.assertion = comparisonTypeConverter[assertion.assertion];
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
const step = new SendHttpRequestStep(formatted);
|
|
31
|
+
const step = new SendHttpRequestStep(SendHttpRequestStep.stepName, [formatted], []);
|
|
32
32
|
step.setStepId(stepArgs.id);
|
|
33
33
|
return step;
|
|
34
34
|
}
|
|
35
|
-
static fromLegacyMablscript(args, _actions) {
|
|
36
|
-
if (args.length !== 1) {
|
|
37
|
-
throw new Error(`SendHttpRequestStep fromLegacyMablscript expects 1 argument, got ${args.length}`);
|
|
38
|
-
}
|
|
39
|
-
const step = new SendHttpRequestStep(args[0]);
|
|
40
|
-
step.setStepId(args[0].id);
|
|
41
|
-
return step;
|
|
42
|
-
}
|
|
43
35
|
}
|
|
44
36
|
exports.SendHttpRequestStep = SendHttpRequestStep;
|
|
45
37
|
SendHttpRequestStep.stepName = 'SendHttpRequest';
|
|
46
|
-
SendHttpRequestStep.
|
|
47
|
-
SendHttpRequestStep.mablScriptStepNames = [SendHttpRequestStep.actionCode];
|
|
38
|
+
SendHttpRequestStep.mablScriptStepNames = ['send_http_request'];
|
|
48
39
|
SendHttpRequestStep.yamlMablScriptNames = [SendHttpRequestStep.stepName];
|
|
49
40
|
var SendHttpRequestVariableSource;
|
|
50
41
|
(function (SendHttpRequestVariableSource) {
|