@mablhq/mabl-cli 2.72.4 → 2.72.12
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/browserEngines/chromiumBrowserEngine.js +17 -0
- package/browserLauncher/index.js +3 -3
- package/commands/mcp/mcp_cmds/tools/createTest.js +10 -0
- package/commands/mcp/mcp_cmds/tools/getApplications.js +69 -0
- package/commands/mcp/mcp_cmds/tools/{getPlanResults.js → getLatestPlanRuns.js} +6 -6
- package/commands/mcp/mcp_cmds/tools/{getPlanRun.js → getPlanRunResult.js} +5 -5
- package/commands/mcp/mcp_cmds/tools/index.js +6 -4
- package/core/execution/ApiTestUtils.js +3 -1
- package/execution/index.js +1 -1
- package/http/requestInterceptor.js +10 -5
- package/index.d.ts +2 -0
- package/mablscript/MablStepV2.js +40 -10
- package/mablscript/MablStepWithFindAction.js +126 -2
- package/mablscript/actions/AwaitDownloadAction.js +4 -3
- package/mablscript/actions/AwaitPDFDownloadAction.js +6 -5
- package/mablscript/actions/ConditionAction.js +2 -1
- package/mablscript/actions/ExtractAction.js +8 -13
- package/mablscript/actions/FindAction.js +20 -0
- package/mablscript/actions/GetVariableValue.js +15 -4
- package/mablscript/actions/JavaScriptAction.js +25 -39
- package/mablscript/diffing/diffingUtil.js +5 -5
- package/mablscript/importer.js +79 -59
- package/mablscript/mobile/steps/CreateVariableMobileStep.js +3 -1
- package/mablscript/steps/AbstractAssertionsAndVariablesStep.js +10 -8
- package/mablscript/steps/AccessibilityCheck.js +78 -36
- package/mablscript/steps/AssertStep.js +267 -86
- package/mablscript/steps/AssertStepOld.js +69 -139
- package/mablscript/steps/AwaitTabStep.js +32 -9
- package/mablscript/steps/AwaitUploadsStep.js +24 -8
- package/mablscript/steps/ClearCookiesStep.js +24 -8
- package/mablscript/steps/ClickAndHoldStep.js +47 -47
- package/mablscript/steps/ClickStep.js +38 -33
- package/mablscript/steps/CreateVariableStep.js +169 -137
- package/mablscript/steps/DatabaseQueryStep.js +16 -4
- package/mablscript/steps/DoubleClickStep.js +39 -40
- package/mablscript/steps/DownloadStep.js +81 -63
- package/mablscript/steps/EchoStep.js +28 -8
- package/mablscript/steps/ElseIfConditionStep.js +25 -12
- package/mablscript/steps/ElseStep.js +24 -9
- package/mablscript/steps/EndStep.js +24 -9
- package/mablscript/steps/EnterAuthCodeStep.js +38 -34
- package/mablscript/steps/EnterTextStep.js +53 -64
- package/mablscript/steps/EvaluateFlowStep.js +41 -18
- package/mablscript/steps/EvaluateJavaScriptStep.js +19 -19
- package/mablscript/steps/HoverStep.js +39 -39
- package/mablscript/steps/IfConditionStep.js +141 -99
- package/mablscript/steps/NavigateStep.js +31 -9
- package/mablscript/steps/OpenEmailStep.js +41 -21
- package/mablscript/steps/ReleaseStep.js +48 -38
- package/mablscript/steps/RemoveCookieStep.js +27 -9
- package/mablscript/steps/RightClickStep.js +38 -33
- package/mablscript/steps/SelectStep.js +71 -46
- package/mablscript/steps/SendHttpRequestStep.js +11 -4
- package/mablscript/steps/SendKeyStep.js +175 -49
- package/mablscript/steps/SetCookieStep.js +58 -23
- package/mablscript/steps/SetFilesStep.js +44 -43
- package/mablscript/steps/SetViewportStep.js +40 -12
- package/mablscript/steps/StepGroupStep.js +70 -0
- package/mablscript/steps/SwitchContextStep.js +93 -83
- package/mablscript/steps/SyntheticStep.js +1 -1
- package/mablscript/steps/VisitUrlStep.js +31 -21
- package/mablscript/steps/WaitStep.js +21 -8
- package/mablscript/steps/WaitUntilStep.js +32 -13
- package/mablscript/types/AssertStepDescriptor.js +2 -0
- package/mablscript/types/ConditionDescriptor.js +5 -5
- package/mablscript/types/GetVariableDescriptor.js +0 -8
- package/mablscript/types/StepGroupStepDescriptor.js +2 -0
- package/package.json +4 -4
- package/proxy/index.js +1 -1
- package/upload/index.js +1 -1
|
@@ -1,159 +1,89 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const importer_1 = require("../importer");
|
|
9
|
-
const GetCurrentLocationDescriptor_1 = require("../types/GetCurrentLocationDescriptor");
|
|
10
|
-
const GetVariableDescriptor_1 = require("../types/GetVariableDescriptor");
|
|
11
|
-
const GetViewportDescriptor_1 = require("../types/GetViewportDescriptor");
|
|
12
|
-
const oldToNewAssertionTypes = {
|
|
13
|
-
assert_contains: 'AssertContains',
|
|
14
|
-
assert_does_not_contain: 'AssertDoesNotContain',
|
|
15
|
-
assert_does_not_equal: 'AssertDoesNotEqual',
|
|
16
|
-
assert_download: 'AssertDownload',
|
|
3
|
+
exports.AssertStepOldConverter = exports.oldToV2StepNameMap = void 0;
|
|
4
|
+
const AssertStep_1 = require("./AssertStep");
|
|
5
|
+
const ConditionAction_1 = require("../actions/ConditionAction");
|
|
6
|
+
const ConditionDescriptor_1 = require("../types/ConditionDescriptor");
|
|
7
|
+
exports.oldToV2StepNameMap = {
|
|
17
8
|
assert_equals: 'AssertEquals',
|
|
18
|
-
assert_greater_than: 'AssertGreaterThan',
|
|
19
|
-
assert_greater_than_or_equals: 'AssertGreaterThanOrEquals',
|
|
20
|
-
assert_less_than: 'AssertLessThan',
|
|
21
|
-
assert_less_than_or_equals: 'AssertLessThanOrEquals',
|
|
22
|
-
assert_not_present: 'AssertNotPresent',
|
|
23
9
|
assert_present: 'AssertPresent',
|
|
10
|
+
assert_not_present: 'AssertNotPresent',
|
|
11
|
+
assert_does_not_equal: 'AssertDoesNotEqual',
|
|
12
|
+
assert_contains: 'AssertContains',
|
|
13
|
+
assert_does_not_contain: 'AssertDoesNotContain',
|
|
24
14
|
assert_starts_with: 'AssertStartsWith',
|
|
25
15
|
assert_starts_without: 'AssertStartsWithout',
|
|
26
16
|
assert_ends_with: 'AssertEndsWith',
|
|
27
17
|
assert_ends_without: 'AssertEndsWithout',
|
|
18
|
+
assert_greater_than: 'AssertGreaterThan',
|
|
19
|
+
assert_less_than: 'AssertLessThan',
|
|
20
|
+
assert_greater_than_or_equals: 'AssertGreaterThanOrEquals',
|
|
21
|
+
assert_less_than_or_equals: 'AssertLessThanOrEquals',
|
|
22
|
+
assert_matches_regex: 'AssertMatchesRegex',
|
|
23
|
+
assert_ai_prompt: 'AssertAIPrompt',
|
|
28
24
|
};
|
|
29
|
-
class
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
this.validate();
|
|
35
|
-
this.setAssertAttribute();
|
|
36
|
-
this.assertionType = this.name;
|
|
37
|
-
this.primaryAction = actions[0];
|
|
38
|
-
this.extractAction = actions[1];
|
|
39
|
-
if (args.length === 1) {
|
|
40
|
-
this.onFailure = args[0].onFailure;
|
|
41
|
-
this.observationScope = args[0].observationScope;
|
|
42
|
-
}
|
|
43
|
-
else if (args.length === 2) {
|
|
44
|
-
this.onFailure = args[1].onFailure;
|
|
45
|
-
this.observationScope = args[1].observationScope;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
validate() {
|
|
49
|
-
if (this.actions.length !== 2 &&
|
|
50
|
-
!(this.actions[0] instanceof FindAction_1.FindAction) &&
|
|
51
|
-
!(this.actions[1] instanceof ExtractAction_1.ExtractAction)) {
|
|
52
|
-
throw new Error('Legacy assert steps should have exactly two sub action: a find and an extract');
|
|
25
|
+
class AssertStepOldConverter {
|
|
26
|
+
static convert(name, args, actions) {
|
|
27
|
+
const v2StepName = exports.oldToV2StepNameMap[name];
|
|
28
|
+
if (!v2StepName) {
|
|
29
|
+
throw new Error(`Unknown old assertion type: ${name}`);
|
|
53
30
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
getStepName() {
|
|
59
|
-
return oldToNewAssertionTypes[this.getAssertionType()];
|
|
60
|
-
}
|
|
61
|
-
getAssertionType() {
|
|
62
|
-
return this.assertionType;
|
|
63
|
-
}
|
|
64
|
-
toStepDescriptor() {
|
|
65
|
-
const formatted = {};
|
|
66
|
-
if (this.assertionType !== 'assert_present' &&
|
|
67
|
-
this.assertionType !== 'assert_not_present') {
|
|
68
|
-
formatted.assertionValue = this.assertAttribute;
|
|
31
|
+
const newActions = [];
|
|
32
|
+
newActions.push(actions[0]);
|
|
33
|
+
if (actions[1]) {
|
|
34
|
+
newActions.push(actions[1]);
|
|
69
35
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
case domUtil_1.FindType.FIND_ONE:
|
|
97
|
-
formatted.selector = find.findTarget.selector;
|
|
98
|
-
break;
|
|
99
|
-
default:
|
|
100
|
-
throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
|
|
36
|
+
let assertionValue;
|
|
37
|
+
let assertionArguments = {};
|
|
38
|
+
if (args.length > 0) {
|
|
39
|
+
const firstArg = args[0];
|
|
40
|
+
if (typeof firstArg === 'object' && firstArg !== undefined) {
|
|
41
|
+
if ('onFailure' in firstArg || 'observationScope' in firstArg) {
|
|
42
|
+
assertionArguments = firstArg;
|
|
43
|
+
if (name === 'assert_present' || name === 'assert_not_present') {
|
|
44
|
+
assertionValue = undefined;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
assertionValue = args[1];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
assertionValue = firstArg;
|
|
52
|
+
if (args[1] && typeof args[1] === 'object') {
|
|
53
|
+
assertionArguments = args[1];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
assertionValue = firstArg;
|
|
59
|
+
if (args[1] && typeof args[1] === 'object') {
|
|
60
|
+
assertionArguments = args[1];
|
|
61
|
+
}
|
|
101
62
|
}
|
|
102
63
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
};
|
|
107
|
-
return formatted;
|
|
108
|
-
}
|
|
109
|
-
getFormattedStep(_fullLocatorsOn) {
|
|
110
|
-
const result = {};
|
|
111
|
-
result[this.getStepName()] = { ...this.annotationsAsYml() };
|
|
112
|
-
const formatted = result[this.getStepName()];
|
|
113
|
-
if (this.extractAction) {
|
|
114
|
-
formatted.attribute = this.extractAction.extractionAttribute;
|
|
115
|
-
formatted.extractType =
|
|
116
|
-
ExtractAction_1.ExtractAction.mablscriptToYamlType[this.extractAction.extractionType];
|
|
117
|
-
}
|
|
118
|
-
if (this.assertionType !== 'assert_present' &&
|
|
119
|
-
this.assertionType !== 'assert_not_present') {
|
|
120
|
-
formatted.assertionValue = this.assertAttribute;
|
|
64
|
+
let conditionAction;
|
|
65
|
+
if (name === 'assert_present') {
|
|
66
|
+
conditionAction = new ConditionAction_1.ConditionAction('evaluate_presence', ['present']);
|
|
121
67
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
68
|
+
else if (name === 'assert_not_present') {
|
|
69
|
+
conditionAction = new ConditionAction_1.ConditionAction('evaluate_presence', [
|
|
70
|
+
'not_present',
|
|
71
|
+
]);
|
|
125
72
|
}
|
|
126
73
|
else {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
return result;
|
|
137
|
-
}
|
|
138
|
-
getNewAssertionStep() {
|
|
139
|
-
const yamlified = (0, importer_1.yamlifyTheLoadedSteps)([this]);
|
|
140
|
-
const reloadedSteps = (0, importer_1.loadYamlSteps)(yamlified);
|
|
141
|
-
const result = reloadedSteps[0];
|
|
142
|
-
if (this.stepSourceIndexInFlow !== undefined) {
|
|
143
|
-
result.setStepSourceIndexInFlow(this.stepSourceIndexInFlow);
|
|
144
|
-
}
|
|
145
|
-
this.actions.forEach((_oldAction, actionIndex) => {
|
|
146
|
-
result.actions[actionIndex].setActionSourceIndexInStep(actionIndex);
|
|
147
|
-
});
|
|
148
|
-
if (this.actionSourceIndexInStep !== undefined) {
|
|
149
|
-
result.setActionSourceIndexInStep(this.actionSourceIndexInStep);
|
|
74
|
+
const conditionType = ConditionDescriptor_1.AssertionStepNameToField[v2StepName];
|
|
75
|
+
if (!conditionType) {
|
|
76
|
+
throw new Error(`Unknown assertion type: ${v2StepName}`);
|
|
77
|
+
}
|
|
78
|
+
conditionAction = new ConditionAction_1.ConditionAction('evaluate_condition', [
|
|
79
|
+
conditionType,
|
|
80
|
+
assertionValue || '',
|
|
81
|
+
]);
|
|
150
82
|
}
|
|
83
|
+
newActions.push(conditionAction);
|
|
84
|
+
const descriptor = (0, AssertStep_1.buildAssertStepDescriptor)(v2StepName, [assertionArguments], newActions);
|
|
85
|
+
const result = new AssertStep_1.AssertStep(v2StepName, [assertionArguments], newActions, descriptor);
|
|
151
86
|
return result;
|
|
152
87
|
}
|
|
153
|
-
static fromYaml(stepName, _stepArgs) {
|
|
154
|
-
return new MablStep_1.MablStep(stepName, [], [], 'assert');
|
|
155
|
-
}
|
|
156
88
|
}
|
|
157
|
-
exports.
|
|
158
|
-
AssertStepOld.mablScriptStepNames = Object.keys(oldToNewAssertionTypes);
|
|
159
|
-
AssertStepOld.yamlMablScriptNames = [];
|
|
89
|
+
exports.AssertStepOldConverter = AssertStepOldConverter;
|
|
@@ -3,14 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AwaitTabStep = void 0;
|
|
4
4
|
exports.hasCustomFindOptions = hasCustomFindOptions;
|
|
5
5
|
const domUtil_1 = require("../../domUtil");
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
const MablAction_1 = require("../MablAction");
|
|
7
|
+
const MablStepV2_1 = require("../MablStepV2");
|
|
8
|
+
const mablscriptFind_1 = require("../../mablscriptFind");
|
|
9
|
+
class AwaitTabStep extends MablStepV2_1.MablStepV2 {
|
|
10
|
+
constructor(descriptor) {
|
|
11
|
+
super(AwaitTabStep.stepName, descriptor, AwaitTabStep.actionCode);
|
|
12
|
+
this.tab = descriptor.tab;
|
|
11
13
|
}
|
|
12
14
|
getStepName() {
|
|
13
|
-
return
|
|
15
|
+
return AwaitTabStep.stepName;
|
|
14
16
|
}
|
|
15
17
|
toStepDescriptor() {
|
|
16
18
|
return {
|
|
@@ -19,13 +21,32 @@ class AwaitTabStep extends MablStep_1.MablStep {
|
|
|
19
21
|
};
|
|
20
22
|
}
|
|
21
23
|
static fromYaml(_stepName, stepArgs) {
|
|
22
|
-
const
|
|
24
|
+
const stepDescriptor = {
|
|
25
|
+
actionCode: AwaitTabStep.actionCode,
|
|
26
|
+
tab: stepArgs.tab,
|
|
27
|
+
};
|
|
28
|
+
const step = new AwaitTabStep(stepDescriptor);
|
|
23
29
|
step.setStepId(stepArgs.id);
|
|
24
30
|
return step;
|
|
25
31
|
}
|
|
32
|
+
static fromLegacyMablscript(args, actions) {
|
|
33
|
+
const stepDescriptor = {
|
|
34
|
+
actionCode: AwaitTabStep.actionCode,
|
|
35
|
+
tab: args[0],
|
|
36
|
+
};
|
|
37
|
+
const step = new AwaitTabStep(stepDescriptor);
|
|
38
|
+
step.actions = actions;
|
|
39
|
+
return step;
|
|
40
|
+
}
|
|
26
41
|
toMablscript() {
|
|
27
42
|
return `await_tab(${AwaitTabStep.getMablscriptSelectorFromTabFindAction(this.tab)})`;
|
|
28
43
|
}
|
|
44
|
+
getInputVariables() {
|
|
45
|
+
return MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.tab);
|
|
46
|
+
}
|
|
47
|
+
stepDescription() {
|
|
48
|
+
return `Wait for ${(0, mablscriptFind_1.humanizeTabSelector)(this.tab)}`;
|
|
49
|
+
}
|
|
29
50
|
static hasCustomFindOptions(tab) {
|
|
30
51
|
return Object.keys(tab.configuration?.propertyPreferences ?? {}).length > 0;
|
|
31
52
|
}
|
|
@@ -61,8 +82,10 @@ class AwaitTabStep extends MablStep_1.MablStep {
|
|
|
61
82
|
}
|
|
62
83
|
}
|
|
63
84
|
exports.AwaitTabStep = AwaitTabStep;
|
|
64
|
-
AwaitTabStep.
|
|
65
|
-
AwaitTabStep.
|
|
85
|
+
AwaitTabStep.stepName = 'AwaitTab';
|
|
86
|
+
AwaitTabStep.actionCode = 'await_tab';
|
|
87
|
+
AwaitTabStep.mablScriptStepNames = [AwaitTabStep.actionCode];
|
|
88
|
+
AwaitTabStep.yamlMablScriptNames = [AwaitTabStep.stepName];
|
|
66
89
|
function hasCustomFindOptions(tab) {
|
|
67
90
|
return AwaitTabStep.hasCustomFindOptions(tab);
|
|
68
91
|
}
|
|
@@ -1,26 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AwaitUploadsStep = void 0;
|
|
4
|
-
const
|
|
5
|
-
class AwaitUploadsStep extends
|
|
6
|
-
constructor(
|
|
7
|
-
super(
|
|
4
|
+
const MablStepV2_1 = require("../MablStepV2");
|
|
5
|
+
class AwaitUploadsStep extends MablStepV2_1.MablStepV2 {
|
|
6
|
+
constructor(descriptor) {
|
|
7
|
+
super(AwaitUploadsStep.stepName, descriptor, AwaitUploadsStep.actionCode);
|
|
8
8
|
}
|
|
9
9
|
getStepName() {
|
|
10
|
-
return
|
|
10
|
+
return AwaitUploadsStep.stepName;
|
|
11
11
|
}
|
|
12
12
|
toStepDescriptor() {
|
|
13
13
|
return { actionCode: this.actionCode };
|
|
14
14
|
}
|
|
15
15
|
static fromYaml(_stepName, stepArgs) {
|
|
16
|
-
const
|
|
16
|
+
const stepDescriptor = {
|
|
17
|
+
actionCode: AwaitUploadsStep.actionCode,
|
|
18
|
+
};
|
|
19
|
+
const step = new AwaitUploadsStep(stepDescriptor);
|
|
17
20
|
step.setStepId(stepArgs.id);
|
|
18
21
|
return step;
|
|
19
22
|
}
|
|
23
|
+
static fromLegacyMablscript(_args, _actions) {
|
|
24
|
+
const stepDescriptor = {
|
|
25
|
+
actionCode: AwaitUploadsStep.actionCode,
|
|
26
|
+
};
|
|
27
|
+
const step = new AwaitUploadsStep(stepDescriptor);
|
|
28
|
+
step.actions = _actions;
|
|
29
|
+
return step;
|
|
30
|
+
}
|
|
20
31
|
toMablscript() {
|
|
21
32
|
return `await_uploads()`;
|
|
22
33
|
}
|
|
34
|
+
stepDescription() {
|
|
35
|
+
return 'Wait for uploads to complete';
|
|
36
|
+
}
|
|
23
37
|
}
|
|
24
38
|
exports.AwaitUploadsStep = AwaitUploadsStep;
|
|
25
|
-
AwaitUploadsStep.
|
|
26
|
-
AwaitUploadsStep.
|
|
39
|
+
AwaitUploadsStep.stepName = 'AwaitUploads';
|
|
40
|
+
AwaitUploadsStep.actionCode = 'await_uploads';
|
|
41
|
+
AwaitUploadsStep.mablScriptStepNames = [AwaitUploadsStep.actionCode];
|
|
42
|
+
AwaitUploadsStep.yamlMablScriptNames = [AwaitUploadsStep.stepName];
|
|
@@ -1,26 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ClearCookiesStep = void 0;
|
|
4
|
-
const
|
|
5
|
-
class ClearCookiesStep extends
|
|
6
|
-
constructor(
|
|
7
|
-
super(
|
|
4
|
+
const MablStepV2_1 = require("../MablStepV2");
|
|
5
|
+
class ClearCookiesStep extends MablStepV2_1.MablStepV2 {
|
|
6
|
+
constructor(descriptor) {
|
|
7
|
+
super(ClearCookiesStep.stepName, descriptor, ClearCookiesStep.actionCode);
|
|
8
8
|
}
|
|
9
9
|
getStepName() {
|
|
10
|
-
return
|
|
10
|
+
return ClearCookiesStep.stepName;
|
|
11
11
|
}
|
|
12
12
|
toStepDescriptor() {
|
|
13
13
|
return { actionCode: this.actionCode };
|
|
14
14
|
}
|
|
15
15
|
static fromYaml(_stepName, stepArgs) {
|
|
16
|
-
const
|
|
16
|
+
const stepDescriptor = {
|
|
17
|
+
actionCode: ClearCookiesStep.actionCode,
|
|
18
|
+
};
|
|
19
|
+
const step = new ClearCookiesStep(stepDescriptor);
|
|
17
20
|
step.setStepId(stepArgs.id);
|
|
18
21
|
return step;
|
|
19
22
|
}
|
|
23
|
+
static fromLegacyMablscript(_args, _actions) {
|
|
24
|
+
const stepDescriptor = {
|
|
25
|
+
actionCode: ClearCookiesStep.actionCode,
|
|
26
|
+
};
|
|
27
|
+
const step = new ClearCookiesStep(stepDescriptor);
|
|
28
|
+
step.actions = _actions;
|
|
29
|
+
return step;
|
|
30
|
+
}
|
|
20
31
|
toMablscript() {
|
|
21
32
|
return `clear_cookies()`;
|
|
22
33
|
}
|
|
34
|
+
stepDescription() {
|
|
35
|
+
return 'Clear cookies from the current domain';
|
|
36
|
+
}
|
|
23
37
|
}
|
|
24
38
|
exports.ClearCookiesStep = ClearCookiesStep;
|
|
25
|
-
ClearCookiesStep.
|
|
26
|
-
ClearCookiesStep.
|
|
39
|
+
ClearCookiesStep.stepName = 'ClearCookies';
|
|
40
|
+
ClearCookiesStep.actionCode = 'clear_cookies';
|
|
41
|
+
ClearCookiesStep.mablScriptStepNames = [ClearCookiesStep.actionCode];
|
|
42
|
+
ClearCookiesStep.yamlMablScriptNames = [ClearCookiesStep.stepName];
|
|
@@ -6,70 +6,70 @@ const domUtil_1 = require("../../domUtil");
|
|
|
6
6
|
const ActionsUtils_1 = require("./ActionsUtils");
|
|
7
7
|
const MablStepWithFindAction_1 = require("../MablStepWithFindAction");
|
|
8
8
|
class ClickAndHoldStep extends MablStepWithFindAction_1.MablStepWithFindAction {
|
|
9
|
-
constructor(
|
|
10
|
-
super(
|
|
11
|
-
this.
|
|
12
|
-
this.clickArgs = this.parseArgs(args) ?? { isHtml5: false };
|
|
9
|
+
constructor(descriptor, findAction) {
|
|
10
|
+
super(ClickAndHoldStep.stepName, descriptor, ClickAndHoldStep.actionCode, findAction);
|
|
11
|
+
this.clickArgs = { isHtml5: descriptor.isHtml5 };
|
|
13
12
|
}
|
|
14
|
-
parseArgs(args) {
|
|
13
|
+
static parseArgs(args) {
|
|
15
14
|
if (args.length === 0) {
|
|
16
15
|
return undefined;
|
|
17
16
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
if (!isClickAndHoldArgs(args[0])) {
|
|
22
|
-
throw new Error(`Invalid argument passed to ${this.getStepName()} step.`);
|
|
23
|
-
}
|
|
24
|
-
return args[0];
|
|
17
|
+
return {
|
|
18
|
+
isHtml5: args[0].isHtml5,
|
|
19
|
+
};
|
|
25
20
|
}
|
|
26
21
|
getStepName() {
|
|
27
|
-
return
|
|
22
|
+
return ClickAndHoldStep.stepName;
|
|
28
23
|
}
|
|
29
24
|
toStepDescriptor() {
|
|
30
|
-
|
|
31
|
-
switch (find.findType) {
|
|
32
|
-
case domUtil_1.FindType.FIND_FIRST:
|
|
33
|
-
case domUtil_1.FindType.FIND_LAST:
|
|
34
|
-
case domUtil_1.FindType.FIND_ANY:
|
|
35
|
-
case domUtil_1.FindType.FIND_ONE:
|
|
36
|
-
return {
|
|
37
|
-
find,
|
|
38
|
-
isHtml5: this.clickArgs.isHtml5,
|
|
39
|
-
descriptorToActionMap: new Map().set(find, this.findAction),
|
|
40
|
-
actionCode: this.actionCode,
|
|
41
|
-
};
|
|
42
|
-
default:
|
|
43
|
-
throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
|
|
44
|
-
}
|
|
25
|
+
return buildStepDescriptor(this.findAction, this.clickArgs);
|
|
45
26
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
};
|
|
53
|
-
if (this.stepId()) {
|
|
54
|
-
step.ClickAndHold.id = this.stepId();
|
|
55
|
-
}
|
|
56
|
-
return step;
|
|
27
|
+
getInputVariables() {
|
|
28
|
+
return this.findAction.getInputVariables();
|
|
29
|
+
}
|
|
30
|
+
stepDescription() {
|
|
31
|
+
const elementDescription = this.humanizeFind();
|
|
32
|
+
return `Click and hold ${elementDescription}`;
|
|
57
33
|
}
|
|
58
34
|
static fromYaml(_stepName, stepArgs) {
|
|
59
|
-
const
|
|
35
|
+
const findAction = FindAction_1.FindAction.findActionFromStepArgs(stepArgs);
|
|
36
|
+
const clickArgs = { isHtml5: false };
|
|
37
|
+
const stepDescriptor = buildStepDescriptor(findAction, clickArgs);
|
|
38
|
+
const step = new ClickAndHoldStep(stepDescriptor, findAction);
|
|
60
39
|
step.setStepId(stepArgs.id);
|
|
61
40
|
return step;
|
|
62
41
|
}
|
|
42
|
+
static fromLegacyMablscript(args, actions) {
|
|
43
|
+
const findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(actions);
|
|
44
|
+
const clickArgs = ClickAndHoldStep.parseArgs(args) ?? { isHtml5: false };
|
|
45
|
+
const stepDescriptor = buildStepDescriptor(findAction, clickArgs);
|
|
46
|
+
const step = new ClickAndHoldStep(stepDescriptor, findAction);
|
|
47
|
+
step.actions = actions;
|
|
48
|
+
return step;
|
|
49
|
+
}
|
|
63
50
|
toMablscript() {
|
|
64
51
|
return `${this.findAction.toMablscript()}.click_and_hold({isHtml5:${this.clickArgs.isHtml5}})`;
|
|
65
52
|
}
|
|
66
|
-
getInputVariables() {
|
|
67
|
-
return this.findAction.getInputVariables();
|
|
68
|
-
}
|
|
69
53
|
}
|
|
70
54
|
exports.ClickAndHoldStep = ClickAndHoldStep;
|
|
71
|
-
ClickAndHoldStep.
|
|
72
|
-
ClickAndHoldStep.
|
|
73
|
-
|
|
74
|
-
|
|
55
|
+
ClickAndHoldStep.stepName = 'Click and Hold';
|
|
56
|
+
ClickAndHoldStep.actionCode = 'click_and_hold';
|
|
57
|
+
ClickAndHoldStep.mablScriptStepNames = [ClickAndHoldStep.actionCode];
|
|
58
|
+
ClickAndHoldStep.yamlMablScriptNames = [ClickAndHoldStep.stepName];
|
|
59
|
+
function buildStepDescriptor(findAction, clickArgs) {
|
|
60
|
+
const find = findAction.toDescriptor();
|
|
61
|
+
switch (find.findType) {
|
|
62
|
+
case domUtil_1.FindType.FIND_FIRST:
|
|
63
|
+
case domUtil_1.FindType.FIND_LAST:
|
|
64
|
+
case domUtil_1.FindType.FIND_ANY:
|
|
65
|
+
case domUtil_1.FindType.FIND_ONE:
|
|
66
|
+
return {
|
|
67
|
+
find,
|
|
68
|
+
descriptorToActionMap: new Map().set(find, findAction),
|
|
69
|
+
actionCode: ClickAndHoldStep.actionCode,
|
|
70
|
+
isHtml5: clickArgs.isHtml5,
|
|
71
|
+
};
|
|
72
|
+
default:
|
|
73
|
+
throw new Error(`Error generating step descriptor for ${ClickAndHoldStep.stepName}: Unexpected find type ${find.findType}`);
|
|
74
|
+
}
|
|
75
75
|
}
|
|
@@ -6,53 +6,58 @@ const domUtil_1 = require("../../domUtil");
|
|
|
6
6
|
const ActionsUtils_1 = require("./ActionsUtils");
|
|
7
7
|
const MablStepWithFindAction_1 = require("../MablStepWithFindAction");
|
|
8
8
|
class ClickStep extends MablStepWithFindAction_1.MablStepWithFindAction {
|
|
9
|
-
constructor(
|
|
10
|
-
super(
|
|
11
|
-
this.findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(this.actions);
|
|
9
|
+
constructor(descriptor, findAction) {
|
|
10
|
+
super(ClickStep.stepName, descriptor, ClickStep.actionCode, findAction);
|
|
12
11
|
}
|
|
13
12
|
getStepName() {
|
|
14
|
-
return
|
|
13
|
+
return ClickStep.stepName;
|
|
15
14
|
}
|
|
16
15
|
toStepDescriptor() {
|
|
17
|
-
|
|
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
|
-
Click: {
|
|
35
|
-
...super.annotationsAsYml(),
|
|
36
|
-
...this.findAction.toYaml(),
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
if (this.stepId()) {
|
|
40
|
-
step.Click.id = this.stepId();
|
|
41
|
-
}
|
|
42
|
-
return step;
|
|
16
|
+
return buildStepDescriptor(this.findAction);
|
|
43
17
|
}
|
|
44
18
|
static fromYaml(_stepName, stepArgs) {
|
|
45
|
-
const
|
|
19
|
+
const findAction = FindAction_1.FindAction.findActionFromStepArgs(stepArgs);
|
|
20
|
+
const stepDescriptor = buildStepDescriptor(findAction);
|
|
21
|
+
const step = new ClickStep(stepDescriptor, findAction);
|
|
46
22
|
step.setStepId(stepArgs.id);
|
|
47
23
|
return step;
|
|
48
24
|
}
|
|
25
|
+
static fromLegacyMablscript(_args, actions) {
|
|
26
|
+
const findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(actions);
|
|
27
|
+
const stepDescriptor = buildStepDescriptor(findAction);
|
|
28
|
+
const step = new ClickStep(stepDescriptor, findAction);
|
|
29
|
+
step.actions = actions;
|
|
30
|
+
return step;
|
|
31
|
+
}
|
|
49
32
|
toMablscript() {
|
|
50
33
|
return `${this.findAction.toMablscript()}.click()`;
|
|
51
34
|
}
|
|
52
35
|
getInputVariables() {
|
|
53
36
|
return this.findAction.getInputVariables();
|
|
54
37
|
}
|
|
38
|
+
stepDescription() {
|
|
39
|
+
const elementDescription = this.humanizeFind();
|
|
40
|
+
return `Click on ${elementDescription}`;
|
|
41
|
+
}
|
|
55
42
|
}
|
|
56
43
|
exports.ClickStep = ClickStep;
|
|
57
|
-
ClickStep.
|
|
58
|
-
ClickStep.
|
|
44
|
+
ClickStep.stepName = 'Click';
|
|
45
|
+
ClickStep.actionCode = 'click';
|
|
46
|
+
ClickStep.mablScriptStepNames = [ClickStep.actionCode];
|
|
47
|
+
ClickStep.yamlMablScriptNames = [ClickStep.stepName];
|
|
48
|
+
function buildStepDescriptor(findAction) {
|
|
49
|
+
const find = findAction.toDescriptor();
|
|
50
|
+
switch (find.findType) {
|
|
51
|
+
case domUtil_1.FindType.FIND_FIRST:
|
|
52
|
+
case domUtil_1.FindType.FIND_LAST:
|
|
53
|
+
case domUtil_1.FindType.FIND_ANY:
|
|
54
|
+
case domUtil_1.FindType.FIND_ONE:
|
|
55
|
+
return {
|
|
56
|
+
find,
|
|
57
|
+
descriptorToActionMap: new Map().set(find, findAction),
|
|
58
|
+
actionCode: ClickStep.actionCode,
|
|
59
|
+
};
|
|
60
|
+
default:
|
|
61
|
+
throw new Error(`Error generating step descriptor for ${ClickStep.stepName}: Unexpected find type ${find.findType}`);
|
|
62
|
+
}
|
|
63
|
+
}
|