@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
|
@@ -2,26 +2,53 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SwitchContextStep = void 0;
|
|
4
4
|
const FindAction_1 = require("../actions/FindAction");
|
|
5
|
-
const
|
|
5
|
+
const MablStep_1 = require("../MablStep");
|
|
6
6
|
const SwitchContextStepDescriptor_1 = require("../types/SwitchContextStepDescriptor");
|
|
7
7
|
const domUtil_1 = require("../../domUtil");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (
|
|
13
|
-
|
|
8
|
+
class SwitchContextStep extends MablStep_1.MablStep {
|
|
9
|
+
constructor(name, args, actions) {
|
|
10
|
+
super(name, args, actions, 'switch_context_to');
|
|
11
|
+
const maybeRoot = this.getActionArgs()[0];
|
|
12
|
+
if (maybeRoot !== undefined && maybeRoot !== 'root') {
|
|
13
|
+
throw new Error(`Unexpected argument for ${name} step: ${JSON.stringify(maybeRoot)}`);
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
this.
|
|
15
|
+
if (maybeRoot === 'root') {
|
|
16
|
+
this.switch = {
|
|
17
|
+
frame: 'root',
|
|
18
|
+
actionCode: this.actionCode,
|
|
19
|
+
};
|
|
20
|
+
Object.freeze(this.switch);
|
|
21
|
+
return;
|
|
17
22
|
}
|
|
18
|
-
|
|
19
|
-
throw new Error(`
|
|
23
|
+
if (actions.length !== 1) {
|
|
24
|
+
throw new Error(`No find action for ${name} step`);
|
|
25
|
+
}
|
|
26
|
+
this.findAction = new FindAction_1.FindAction(this.actions[0].name, this.actions[0].args);
|
|
27
|
+
if (this.actions[0].actionSourceIndexInStep !== undefined) {
|
|
28
|
+
this.findAction.setActionSourceIndexInStep(this.actions[0].actionSourceIndexInStep);
|
|
29
|
+
}
|
|
30
|
+
const findDescriptor = this.findAction.toDescriptor();
|
|
31
|
+
if (findDescriptor.findType === domUtil_1.FindType.FIND_TAB) {
|
|
32
|
+
this.switch = {
|
|
33
|
+
tab: findDescriptor,
|
|
34
|
+
find: findDescriptor,
|
|
35
|
+
descriptorToActionMap: new Map().set(findDescriptor, this.findAction),
|
|
36
|
+
actionCode: this.actionCode,
|
|
37
|
+
};
|
|
38
|
+
Object.freeze(this.switch);
|
|
39
|
+
return;
|
|
20
40
|
}
|
|
21
|
-
if (
|
|
22
|
-
this.
|
|
23
|
-
|
|
41
|
+
if (findDescriptor.findType === domUtil_1.FindType.FIND_ONE) {
|
|
42
|
+
this.switch = {
|
|
43
|
+
frame: findDescriptor,
|
|
44
|
+
find: findDescriptor,
|
|
45
|
+
descriptorToActionMap: new Map().set(findDescriptor, this.findAction),
|
|
46
|
+
actionCode: this.actionCode,
|
|
47
|
+
};
|
|
48
|
+
Object.freeze(this.switch);
|
|
49
|
+
return;
|
|
24
50
|
}
|
|
51
|
+
throw new Error(`Unexpected find type for ${name} step: ${findDescriptor.findType}`);
|
|
25
52
|
}
|
|
26
53
|
validate() {
|
|
27
54
|
if (this.actions.length === 0 ||
|
|
@@ -30,22 +57,55 @@ class SwitchContextStep extends MablStepV2_1.MablStepV2 {
|
|
|
30
57
|
}
|
|
31
58
|
}
|
|
32
59
|
getStepName() {
|
|
33
|
-
return
|
|
60
|
+
return 'SwitchContext';
|
|
34
61
|
}
|
|
35
62
|
toStepDescriptor() {
|
|
36
|
-
return
|
|
63
|
+
return this.switch;
|
|
64
|
+
}
|
|
65
|
+
getFormattedStep() {
|
|
66
|
+
const step = this.toStepDescriptor();
|
|
67
|
+
const stepName = this.getStepName();
|
|
68
|
+
const formatted = {
|
|
69
|
+
[stepName]: {},
|
|
70
|
+
};
|
|
71
|
+
if (this.annotationsOnStep()) {
|
|
72
|
+
formatted[stepName].annotation = this.annotation;
|
|
73
|
+
}
|
|
74
|
+
if (this.description) {
|
|
75
|
+
formatted[stepName].description = this.description;
|
|
76
|
+
}
|
|
77
|
+
if ((0, SwitchContextStepDescriptor_1.isSwitchTab)(step)) {
|
|
78
|
+
formatted[stepName].findType = 'FindTab';
|
|
79
|
+
formatted[stepName].selector = step.tab.findTarget;
|
|
80
|
+
}
|
|
81
|
+
if ((0, SwitchContextStepDescriptor_1.isSwitchFrame)(step)) {
|
|
82
|
+
formatted[stepName].selector = step.frame.findTarget.selector;
|
|
83
|
+
if (step.frame.findTarget.auxiliaryDescriptors?.length) {
|
|
84
|
+
formatted[stepName].selectorAncestors =
|
|
85
|
+
step.frame.findTarget.auxiliaryDescriptors.map((descriptor) => descriptor.selector);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if ((0, SwitchContextStepDescriptor_1.isSwitchRoot)(step) && step.frame === 'root') {
|
|
89
|
+
formatted[stepName].switch = 'root';
|
|
90
|
+
}
|
|
91
|
+
if (this.stepId()) {
|
|
92
|
+
formatted[stepName].id = this.stepId();
|
|
93
|
+
}
|
|
94
|
+
return formatted;
|
|
37
95
|
}
|
|
38
96
|
static fromYaml(_stepName, stepArgs) {
|
|
97
|
+
let step;
|
|
39
98
|
if (stepArgs.switch) {
|
|
40
|
-
|
|
99
|
+
step = new SwitchContextStep('switch_context_to', [stepArgs.switch], []);
|
|
41
100
|
}
|
|
42
|
-
else
|
|
43
|
-
|
|
101
|
+
else {
|
|
102
|
+
step = new SwitchContextStep('switch_context_to', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
|
|
44
103
|
}
|
|
45
|
-
|
|
104
|
+
step.setStepId(stepArgs.id);
|
|
105
|
+
return step;
|
|
46
106
|
}
|
|
47
107
|
toMablscript() {
|
|
48
|
-
if ((0, SwitchContextStepDescriptor_1.isSwitchRoot)(this.
|
|
108
|
+
if ((0, SwitchContextStepDescriptor_1.isSwitchRoot)(this.switch) && this.switch.frame === 'root') {
|
|
49
109
|
return 'switch_context_to("root")';
|
|
50
110
|
}
|
|
51
111
|
return `${this.findAction?.toMablscript()}.switch_context_to()`;
|
|
@@ -53,73 +113,7 @@ class SwitchContextStep extends MablStepV2_1.MablStepV2 {
|
|
|
53
113
|
getInputVariables() {
|
|
54
114
|
return this.findAction?.getInputVariables() ?? [];
|
|
55
115
|
}
|
|
56
|
-
stepDescription() {
|
|
57
|
-
if ((0, SwitchContextStepDescriptor_1.isSwitchRoot)(this.descriptor) && this.descriptor.frame === 'root') {
|
|
58
|
-
return 'Switch context to the root frame';
|
|
59
|
-
}
|
|
60
|
-
if (this.findAction) {
|
|
61
|
-
const findDescriptor = this.findAction.toDescriptor();
|
|
62
|
-
if (findDescriptor.findType === domUtil_1.FindType.FIND_TAB) {
|
|
63
|
-
if (typeof findDescriptor.findTarget === 'string') {
|
|
64
|
-
return `Switch context to ${findDescriptor.findTarget} tab`;
|
|
65
|
-
}
|
|
66
|
-
return `Switch context to ${(0, mablscriptFind_1.humanizeTabSelector)(findDescriptor.findTarget)}`;
|
|
67
|
-
}
|
|
68
|
-
else if (findDescriptor.findType === domUtil_1.FindType.FIND_ONE) {
|
|
69
|
-
return `Switch context to ${(0, mablscriptFind_1.humanizeFindOneDescriptor)(findDescriptor.findTarget)}`;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return 'Switch context';
|
|
73
|
-
}
|
|
74
|
-
static fromLegacyMablscript(args, actions) {
|
|
75
|
-
const maybeRoot = args[0];
|
|
76
|
-
if (maybeRoot !== undefined && maybeRoot !== 'root') {
|
|
77
|
-
throw new Error(`Unexpected argument for ${name} step: ${JSON.stringify(maybeRoot)}`);
|
|
78
|
-
}
|
|
79
|
-
if (maybeRoot === 'root') {
|
|
80
|
-
return new SwitchContextStep({
|
|
81
|
-
frame: 'root',
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
if (actions.length !== 1) {
|
|
85
|
-
throw new Error(`No find action for ${name} step`);
|
|
86
|
-
}
|
|
87
|
-
const findAction = new FindAction_1.FindAction(actions[0].name, actions[0].args);
|
|
88
|
-
if (actions[0].actionSourceIndexInStep !== undefined) {
|
|
89
|
-
findAction.setActionSourceIndexInStep(actions[0].actionSourceIndexInStep);
|
|
90
|
-
}
|
|
91
|
-
const stepDescriptor = buildStepDescriptor(findAction);
|
|
92
|
-
return new SwitchContextStep(stepDescriptor);
|
|
93
|
-
}
|
|
94
116
|
}
|
|
95
117
|
exports.SwitchContextStep = SwitchContextStep;
|
|
96
|
-
SwitchContextStep.
|
|
97
|
-
SwitchContextStep.
|
|
98
|
-
SwitchContextStep.mablScriptStepNames = [SwitchContextStep.actionCode];
|
|
99
|
-
SwitchContextStep.yamlMablScriptNames = [SwitchContextStep.stepName];
|
|
100
|
-
function buildStepDescriptor(findAction) {
|
|
101
|
-
if (!findAction) {
|
|
102
|
-
return {
|
|
103
|
-
frame: 'root',
|
|
104
|
-
actionCode: SwitchContextStep.actionCode,
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
const findDescriptor = findAction.toDescriptor();
|
|
108
|
-
if (findDescriptor.findType === domUtil_1.FindType.FIND_TAB) {
|
|
109
|
-
return {
|
|
110
|
-
tab: findDescriptor,
|
|
111
|
-
find: findDescriptor,
|
|
112
|
-
descriptorToActionMap: new Map().set(findDescriptor, findAction),
|
|
113
|
-
actionCode: SwitchContextStep.actionCode,
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
if (findDescriptor.findType === domUtil_1.FindType.FIND_ONE) {
|
|
117
|
-
return {
|
|
118
|
-
frame: findDescriptor,
|
|
119
|
-
find: findDescriptor,
|
|
120
|
-
descriptorToActionMap: new Map().set(findDescriptor, findAction),
|
|
121
|
-
actionCode: SwitchContextStep.actionCode,
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
throw new Error(`Unexpected find type for SwitchContext step: ${findDescriptor.findType}`);
|
|
125
|
-
}
|
|
118
|
+
SwitchContextStep.mablScriptStepNames = ['switch_context_to'];
|
|
119
|
+
SwitchContextStep.yamlMablScriptNames = ['SwitchContext'];
|
|
@@ -4,7 +4,7 @@ exports.SyntheticStep = exports.DEFAULT_STEP_SOURCE_INDEX_IN_FLOW = void 0;
|
|
|
4
4
|
const MablStep_1 = require("../MablStep");
|
|
5
5
|
exports.DEFAULT_STEP_SOURCE_INDEX_IN_FLOW = -1;
|
|
6
6
|
class SyntheticStep extends MablStep_1.MablStep {
|
|
7
|
-
constructor(name, args, actions, stepSourceIndexInFlow = exports.DEFAULT_STEP_SOURCE_INDEX_IN_FLOW) {
|
|
7
|
+
constructor(name, args = [], actions = [], stepSourceIndexInFlow = exports.DEFAULT_STEP_SOURCE_INDEX_IN_FLOW) {
|
|
8
8
|
super(name, args, actions, name);
|
|
9
9
|
this.stepSourceIndexInFlow = stepSourceIndexInFlow;
|
|
10
10
|
this.actionSourceIndexInStep = 0;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VisitUrlStep = void 0;
|
|
4
|
+
const MablStep_1 = require("../MablStep");
|
|
4
5
|
const MablAction_1 = require("../MablAction");
|
|
5
6
|
const domUtil_1 = require("../../domUtil");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.url = descriptor.url;
|
|
7
|
+
class VisitUrlStep extends MablStep_1.MablStep {
|
|
8
|
+
constructor(name, args, actions) {
|
|
9
|
+
super(name, args, actions, 'visit_url');
|
|
10
|
+
const arg = this.getActionArgs()[0];
|
|
11
|
+
this.url = VisitUrlStep.normalizeUrl(arg);
|
|
12
12
|
}
|
|
13
13
|
getStepName() {
|
|
14
|
-
return
|
|
14
|
+
return 'VisitUrl';
|
|
15
15
|
}
|
|
16
16
|
toStepDescriptor() {
|
|
17
17
|
return {
|
|
@@ -19,14 +19,10 @@ class VisitUrlStep extends MablStepV2_1.MablStepV2 {
|
|
|
19
19
|
actionCode: this.actionCode,
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
static fromYaml(_stepName,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const stepDescriptor = {
|
|
27
|
-
url: VisitUrlStep.sanitizeUrl(args[0]),
|
|
28
|
-
};
|
|
29
|
-
return new VisitUrlStep(stepDescriptor);
|
|
22
|
+
static fromYaml(_stepName, stepArgs) {
|
|
23
|
+
const step = new VisitUrlStep('visit_url', [stepArgs.url], []);
|
|
24
|
+
step.setStepId(stepArgs.id);
|
|
25
|
+
return step;
|
|
30
26
|
}
|
|
31
27
|
toMablscript() {
|
|
32
28
|
const resolvedUrl = this.substituteMablscriptVariable((0, domUtil_1.escapeMablscriptString)(this.url.toString()));
|
|
@@ -38,29 +34,27 @@ class VisitUrlStep extends MablStepV2_1.MablStepV2 {
|
|
|
38
34
|
getInputVariables() {
|
|
39
35
|
return MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.url);
|
|
40
36
|
}
|
|
41
|
-
|
|
42
|
-
const inputVariables = this.getInputVariables();
|
|
43
|
-
if (inputVariables.length > 0) {
|
|
44
|
-
const variableName = inputVariables[0];
|
|
45
|
-
return `Visit URL assigned to variable "${variableName}"`;
|
|
46
|
-
}
|
|
47
|
-
return `Visit URL "${this.url}"`;
|
|
48
|
-
}
|
|
49
|
-
static sanitizeUrl(param) {
|
|
37
|
+
static normalizeUrl(param) {
|
|
50
38
|
const trimmed = param.trim();
|
|
51
|
-
if (
|
|
39
|
+
if (param === '') {
|
|
52
40
|
throw new Error('Missing URL');
|
|
53
41
|
}
|
|
42
|
+
if (trimmed.indexOf('{{@') >= 0) {
|
|
43
|
+
return trimmed;
|
|
44
|
+
}
|
|
54
45
|
if (trimmed.indexOf('[not yet evaluated]') >= 0) {
|
|
55
46
|
throw new Error('Unresolved variable found in URL');
|
|
56
47
|
}
|
|
48
|
+
if (/^http[s]?:\/\//.test(trimmed)) {
|
|
49
|
+
return trimmed;
|
|
50
|
+
}
|
|
57
51
|
if (VisitUrlStep.isFileUrl(trimmed)) {
|
|
58
52
|
if (VisitUrlStep.isTestOverride()) {
|
|
59
53
|
return trimmed;
|
|
60
54
|
}
|
|
61
55
|
throw new Error('Access to local files is not permitted');
|
|
62
56
|
}
|
|
63
|
-
return trimmed
|
|
57
|
+
return `http://${trimmed}`;
|
|
64
58
|
}
|
|
65
59
|
static isTestOverride() {
|
|
66
60
|
return process.env.MABL_SIMULATION === 'mabl-local-testing';
|
|
@@ -70,7 +64,5 @@ class VisitUrlStep extends MablStepV2_1.MablStepV2 {
|
|
|
70
64
|
}
|
|
71
65
|
}
|
|
72
66
|
exports.VisitUrlStep = VisitUrlStep;
|
|
73
|
-
VisitUrlStep.
|
|
74
|
-
VisitUrlStep.
|
|
75
|
-
VisitUrlStep.mablScriptStepNames = [VisitUrlStep.actionCode];
|
|
76
|
-
VisitUrlStep.yamlMablScriptNames = [VisitUrlStep.stepName];
|
|
67
|
+
VisitUrlStep.mablScriptStepNames = ['visit_url'];
|
|
68
|
+
VisitUrlStep.yamlMablScriptNames = ['VisitUrl'];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WaitStep = void 0;
|
|
4
|
-
const
|
|
5
|
-
class WaitStep extends
|
|
6
|
-
constructor(
|
|
7
|
-
super(
|
|
8
|
-
this.milliseconds =
|
|
4
|
+
const MablStep_1 = require("../MablStep");
|
|
5
|
+
class WaitStep extends MablStep_1.MablStep {
|
|
6
|
+
constructor(name, args, actions) {
|
|
7
|
+
super(name, args, actions, 'wait');
|
|
8
|
+
this.milliseconds = WaitStep.validateWait(this.getActionArgs()[0]);
|
|
9
9
|
}
|
|
10
10
|
getStepName() {
|
|
11
11
|
return WaitStep.stepName;
|
|
@@ -17,23 +17,13 @@ class WaitStep extends MablStepV2_1.MablStepV2 {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
static fromYaml(_stepName, stepArgs) {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return new WaitStep(stepDescriptor);
|
|
24
|
-
}
|
|
25
|
-
static fromLegacyMablscript(args, _actions) {
|
|
26
|
-
const stepDescriptor = {
|
|
27
|
-
milliseconds: WaitStep.validateWait(args[0]),
|
|
28
|
-
};
|
|
29
|
-
return new WaitStep(stepDescriptor);
|
|
20
|
+
const step = new WaitStep(WaitStep.stepName, [stepArgs.milliseconds], []);
|
|
21
|
+
step.setStepId(stepArgs.id);
|
|
22
|
+
return step;
|
|
30
23
|
}
|
|
31
24
|
toMablscript() {
|
|
32
25
|
return `wait(${this.milliseconds})`;
|
|
33
26
|
}
|
|
34
|
-
stepDescription() {
|
|
35
|
-
return `Wait for ${this.milliseconds / 1000} seconds`;
|
|
36
|
-
}
|
|
37
27
|
static validateWait(wait) {
|
|
38
28
|
if (typeof wait !== 'number') {
|
|
39
29
|
throw new Error(`Invalid wait argument [${wait}]`);
|
|
@@ -43,6 +33,5 @@ class WaitStep extends MablStepV2_1.MablStepV2 {
|
|
|
43
33
|
}
|
|
44
34
|
exports.WaitStep = WaitStep;
|
|
45
35
|
WaitStep.stepName = 'Wait';
|
|
46
|
-
WaitStep.
|
|
47
|
-
WaitStep.mablScriptStepNames = [WaitStep.actionCode];
|
|
36
|
+
WaitStep.mablScriptStepNames = ['wait'];
|
|
48
37
|
WaitStep.yamlMablScriptNames = [WaitStep.stepName];
|
|
@@ -3,13 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.WaitUntilStep = void 0;
|
|
4
4
|
const domUtil_1 = require("../../domUtil");
|
|
5
5
|
const MablStepWithFindAction_1 = require("../MablStepWithFindAction");
|
|
6
|
-
const ActionsUtils_1 = require("./ActionsUtils");
|
|
7
6
|
class WaitUntilStep extends MablStepWithFindAction_1.MablStepWithFindAction {
|
|
8
|
-
constructor(
|
|
9
|
-
super(
|
|
7
|
+
constructor(name, args, actions) {
|
|
8
|
+
super(name, args, actions, 'wait_until');
|
|
9
|
+
if ((0, domUtil_1.isFindElementType)(this.actions[0].getActionName())) {
|
|
10
|
+
this.findAction = this.actions[0];
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
throw new Error(`Unexpected find action for ${name} step: ${JSON.stringify(this.actions[0])}`);
|
|
14
|
+
}
|
|
10
15
|
}
|
|
11
16
|
getStepName() {
|
|
12
|
-
return
|
|
17
|
+
return 'WaitUntil';
|
|
13
18
|
}
|
|
14
19
|
toStepDescriptor() {
|
|
15
20
|
const find = this.findAction.toDescriptor();
|
|
@@ -24,13 +29,10 @@ class WaitUntilStep extends MablStepWithFindAction_1.MablStepWithFindAction {
|
|
|
24
29
|
throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType} is not supported`);
|
|
25
30
|
}
|
|
26
31
|
}
|
|
27
|
-
static fromYaml(_stepName,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(actions);
|
|
32
|
-
const stepDescriptor = buildStepDescriptor(findAction);
|
|
33
|
-
return new WaitUntilStep(stepDescriptor, findAction);
|
|
32
|
+
static fromYaml(_stepName, stepArgs) {
|
|
33
|
+
const step = new WaitUntilStep('wait', [], []);
|
|
34
|
+
step.setStepId(stepArgs.id);
|
|
35
|
+
return step;
|
|
34
36
|
}
|
|
35
37
|
toMablscript() {
|
|
36
38
|
return `${this.findAction.toMablscript()}.evaluate_presence("present").assert()`;
|
|
@@ -38,26 +40,7 @@ class WaitUntilStep extends MablStepWithFindAction_1.MablStepWithFindAction {
|
|
|
38
40
|
getInputVariables() {
|
|
39
41
|
return this.findAction.getInputVariables();
|
|
40
42
|
}
|
|
41
|
-
stepDescription() {
|
|
42
|
-
const elementDescription = this.humanizeFind();
|
|
43
|
-
return `Wait until ${elementDescription} is present`;
|
|
44
|
-
}
|
|
45
43
|
}
|
|
46
44
|
exports.WaitUntilStep = WaitUntilStep;
|
|
47
|
-
WaitUntilStep.stepName = 'WaitUntil';
|
|
48
|
-
WaitUntilStep.actionCode = 'wait_until';
|
|
49
45
|
WaitUntilStep.mablScriptStepNames = [];
|
|
50
|
-
WaitUntilStep.yamlMablScriptNames = [
|
|
51
|
-
function buildStepDescriptor(findAction) {
|
|
52
|
-
const find = findAction.toDescriptor();
|
|
53
|
-
switch (find.findType) {
|
|
54
|
-
case domUtil_1.FindType.FIND_ONE:
|
|
55
|
-
return {
|
|
56
|
-
find,
|
|
57
|
-
descriptorToActionMap: new Map().set(find, findAction),
|
|
58
|
-
actionCode: WaitUntilStep.actionCode,
|
|
59
|
-
};
|
|
60
|
-
default:
|
|
61
|
-
throw new Error(`Error generating step descriptor for ${WaitUntilStep.stepName}: Unexpected find type ${find.findType} is not supported`);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
46
|
+
WaitUntilStep.yamlMablScriptNames = ['WaitUntil'];
|
|
@@ -9,7 +9,6 @@ exports.isPresenceCondition = isPresenceCondition;
|
|
|
9
9
|
exports.isAIPromptCondition = isAIPromptCondition;
|
|
10
10
|
exports.isAbsenceExpected = isAbsenceExpected;
|
|
11
11
|
exports.getAssertionConditionFieldFromDescriptor = getAssertionConditionFieldFromDescriptor;
|
|
12
|
-
const MablSymbol_1 = require("../MablSymbol");
|
|
13
12
|
var ConditionType;
|
|
14
13
|
(function (ConditionType) {
|
|
15
14
|
ConditionType["AIPrompt"] = "ai_prompt";
|
|
@@ -53,12 +52,13 @@ function getOptionalComparisonType(descriptor) {
|
|
|
53
52
|
return undefined;
|
|
54
53
|
}
|
|
55
54
|
function getOptionalComparatorValue(descriptor) {
|
|
56
|
-
if (descriptor
|
|
55
|
+
if (descriptor === undefined) {
|
|
57
56
|
return undefined;
|
|
58
57
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
if (descriptor.conditionType === ConditionType.Comparison) {
|
|
59
|
+
return descriptor.comparatorValue.toString();
|
|
60
|
+
}
|
|
61
|
+
return undefined;
|
|
62
62
|
}
|
|
63
63
|
function getOptionalConditionOptions(descriptor) {
|
|
64
64
|
if (descriptor === undefined ||
|
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GET_VARIABLE_VALUE = void 0;
|
|
4
4
|
exports.isGetVariableDescriptor = isGetVariableDescriptor;
|
|
5
|
+
exports.newGetVariableDescriptor = newGetVariableDescriptor;
|
|
6
|
+
exports.convertGetVariableDescriptorToYaml = convertGetVariableDescriptorToYaml;
|
|
5
7
|
exports.GET_VARIABLE_VALUE = 'GetVariable';
|
|
6
8
|
function isGetVariableDescriptor(value) {
|
|
7
9
|
return value.kind === exports.GET_VARIABLE_VALUE;
|
|
8
10
|
}
|
|
11
|
+
function newGetVariableDescriptor(variable) {
|
|
12
|
+
return { kind: exports.GET_VARIABLE_VALUE, variable };
|
|
13
|
+
}
|
|
14
|
+
function convertGetVariableDescriptorToYaml(descriptor) {
|
|
15
|
+
return { ...descriptor, variable: descriptor.variable.toString() };
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mablhq/mabl-cli",
|
|
3
|
-
"version": "2.72.
|
|
3
|
+
"version": "2.72.4",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "The official mabl command line interface tool",
|
|
6
6
|
"main": "index.js",
|
|
@@ -77,8 +77,8 @@
|
|
|
77
77
|
"open": "6.4.0",
|
|
78
78
|
"ora": "4.0.4",
|
|
79
79
|
"pixelmatch": "5.3.0",
|
|
80
|
-
"playwright": "1.
|
|
81
|
-
"playwright-core": "1.
|
|
80
|
+
"playwright": "1.54.2",
|
|
81
|
+
"playwright-core": "1.54.2",
|
|
82
82
|
"pluralize": "8.0.0",
|
|
83
83
|
"pngjs": "6.0.0",
|
|
84
84
|
"portfinder": "1.0.28",
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StepGroupStep = void 0;
|
|
4
|
-
const MablAction_1 = require("../MablAction");
|
|
5
|
-
const MablStepV2_1 = require("../MablStepV2");
|
|
6
|
-
const importer_1 = require("../importer");
|
|
7
|
-
class StepGroupStep extends MablStepV2_1.MablStepV2 {
|
|
8
|
-
constructor(descriptor) {
|
|
9
|
-
super(StepGroupStep.stepName, descriptor, StepGroupStep.actionCode);
|
|
10
|
-
this.intent = descriptor.intent;
|
|
11
|
-
this.steps = this.createStepsFromDescriptors(descriptor.steps);
|
|
12
|
-
}
|
|
13
|
-
createStepsFromDescriptors(stepDescriptors) {
|
|
14
|
-
return (0, importer_1.interpretStepsFromObjects)(stepDescriptors);
|
|
15
|
-
}
|
|
16
|
-
getStepName() {
|
|
17
|
-
return StepGroupStep.stepName;
|
|
18
|
-
}
|
|
19
|
-
toStepDescriptor() {
|
|
20
|
-
const steps = this.steps.map((step) => ({
|
|
21
|
-
[step.getStepName()]: step.toStepDescriptor(true),
|
|
22
|
-
}));
|
|
23
|
-
return {
|
|
24
|
-
steps,
|
|
25
|
-
intent: this.intent,
|
|
26
|
-
actionCode: this.actionCode,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
static fromYaml(_stepName, stepArgs) {
|
|
30
|
-
const stepDescriptor = {
|
|
31
|
-
steps: stepArgs.steps || [],
|
|
32
|
-
intent: stepArgs.intent || { description: '' },
|
|
33
|
-
actionCode: StepGroupStep.actionCode,
|
|
34
|
-
};
|
|
35
|
-
const step = new StepGroupStep(stepDescriptor);
|
|
36
|
-
step.setStepId(stepArgs.id);
|
|
37
|
-
return step;
|
|
38
|
-
}
|
|
39
|
-
static fromLegacyMablscript(_args, _actions) {
|
|
40
|
-
throw new Error('Legacy mablscript conversion not supported for StepGroupStep');
|
|
41
|
-
}
|
|
42
|
-
toMablscript() {
|
|
43
|
-
throw new Error('Legacy mablscript generation not supported for StepGroupStep');
|
|
44
|
-
}
|
|
45
|
-
stepDescription() {
|
|
46
|
-
return `Step Group: "${this.intent.description}" (${this.steps.length} steps)`;
|
|
47
|
-
}
|
|
48
|
-
getInputVariables() {
|
|
49
|
-
const inputVariables = this.steps.flatMap((step) => {
|
|
50
|
-
if (typeof step.getInputVariables === 'function') {
|
|
51
|
-
return step.getInputVariables();
|
|
52
|
-
}
|
|
53
|
-
return [];
|
|
54
|
-
});
|
|
55
|
-
return (0, MablAction_1.distinctStrings)(inputVariables);
|
|
56
|
-
}
|
|
57
|
-
getOutputVariables() {
|
|
58
|
-
return this.steps.flatMap((step) => {
|
|
59
|
-
if (typeof step.getOutputVariables === 'function') {
|
|
60
|
-
return step.getOutputVariables();
|
|
61
|
-
}
|
|
62
|
-
return [];
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
exports.StepGroupStep = StepGroupStep;
|
|
67
|
-
StepGroupStep.stepName = 'StepGroup';
|
|
68
|
-
StepGroupStep.actionCode = 'step_group';
|
|
69
|
-
StepGroupStep.mablScriptStepNames = [StepGroupStep.actionCode];
|
|
70
|
-
StepGroupStep.yamlMablScriptNames = [StepGroupStep.stepName];
|