@mablhq/mabl-cli 1.58.20 → 1.58.25
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/basicApiClient.js +21 -15
- package/api/mablApiClient.js +40 -48
- package/api/mablApiClientFactory.js +1 -1
- package/auth/OktaClient.js +1 -2
- package/browserEngines/chromiumBrowserEngine.js +1 -2
- package/browserEngines/firefoxBrowserEngine.js +2 -2
- package/browserEngines/webkitBrowerEngine.js +2 -2
- package/browserLauncher/browserLauncherFactory.js +2 -3
- package/browserLauncher/elementHandle.js +1 -2
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumElementHandleDelegate.js +12 -20
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumFrameDelegate.js +1 -1
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumPageDelegate.js +7 -10
- package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxFrameDelegate.js +3 -4
- package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractElementHandleDelegate.js +4 -5
- package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractPageDelegate.js +4 -7
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +1 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +6 -5
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +31 -37
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +8 -9
- package/browserLauncher/playwrightBrowserLauncher/playwrightHttpRequest.js +4 -8
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +4 -6
- package/browserLauncher/playwrightBrowserLauncher/webkit/webkitElementHandleDelegate.js +1 -2
- package/browserLauncher/playwrightBrowserLauncher/webkit/webkitFrameDelegate.js +1 -1
- package/browserTestMonitoring/metricsRecorder.js +6 -6
- package/commands/commandUtil/branches.js +2 -3
- package/commands/commandUtil/codeInsights.js +13 -16
- package/commands/commandUtil/fileUtil.js +1 -1
- package/commands/commandUtil/util.js +3 -4
- package/commands/commandUtil/versionUtil.js +4 -5
- package/commands/config/config_cmds/list.js +2 -2
- package/commands/constants.js +3 -1
- package/commands/datatables/datatables_cmds/create.js +2 -3
- package/commands/datatables/datatables_cmds/export.js +3 -5
- package/commands/datatables/datatables_cmds/list.js +1 -2
- package/commands/datatables/datatables_cmds/scenarios.js +1 -2
- package/commands/datatables/datatables_cmds/update.js +11 -11
- package/commands/datatables/utils.js +9 -9
- package/commands/deploy/deploy_cmds/awaitDeploymentCompletion.js +6 -8
- package/commands/deploy/deploy_cmds/create.js +11 -13
- package/commands/deploy/deploy_cmds/executionResultPresenter.js +8 -11
- package/commands/deploy/deploy_cmds/list.js +3 -4
- package/commands/deploy/deploy_cmds/watch.js +1 -2
- package/commands/environments/environments_cmds/create.js +1 -2
- package/commands/environments/environments_cmds/delete.js +1 -2
- package/commands/environments/environments_cmds/update.js +1 -2
- package/commands/environments/environments_cmds/urls_cmds/list.js +1 -2
- package/commands/flows/flows_cmds/export.js +1 -2
- package/commands/plans/plans_cmds/describe.js +1 -2
- package/commands/tests/mobileEmulationUtil.js +5 -7
- package/commands/tests/testsUtil.js +40 -42
- package/commands/tests/tests_cmds/export.js +1 -2
- package/commands/tests/tests_cmds/import.js +4 -5
- package/commands/tests/tests_cmds/run-cloud.js +12 -13
- package/commands/tests/tests_cmds/run.js +30 -11
- package/commands/users/users_cmds/list.js +2 -2
- package/commands/workspaces/workspace_cmds/copy.js +1 -2
- package/core/execution/ApiTestUtils.js +82 -94
- package/core/execution/LocalizationOptionsLists.js +1253 -0
- package/core/messaging/logLineMessaging.js +2 -3
- package/core/messaging/messaging.js +6 -7
- package/core/trainer/trainingSessions.js +15 -15
- package/coreWebVitals/index.js +14 -18
- package/domUtil/index.js +1 -1
- package/execution/index.js +1 -1
- package/functions/apiTest/utils.js +4 -5
- package/http/MablHttpAgent.js +4 -6
- package/http/RequestSecurityError.js +1 -1
- package/http/axiosProxyConfig.js +3 -5
- package/http/httpUtil.js +2 -3
- package/http/requestInterceptor.js +11 -15
- package/mablApi/index.js +1 -1
- package/mablscript/MablAction.js +2 -3
- package/mablscript/MablStep.js +2 -4
- package/mablscript/MablSymbol.js +1 -1
- package/mablscript/actions/ConditionAction.js +2 -4
- package/mablscript/actions/FindAction.js +2 -4
- package/mablscript/diffing/diffingUtil.js +8 -7
- package/mablscript/importer.js +1 -2
- package/mablscript/steps/AccessibilityCheck.js +7 -9
- package/mablscript/steps/AssertStep.js +11 -16
- package/mablscript/steps/ClickAndHoldStep.js +1 -2
- package/mablscript/steps/CookieUtils.js +40 -7
- package/mablscript/steps/CreateVariableStep.js +1 -2
- package/mablscript/steps/DownloadStep.js +1 -2
- package/mablscript/steps/EnterTextStep.js +1 -2
- package/mablscript/steps/EvaluateFlowStep.js +1 -1
- package/mablscript/steps/IfConditionStep.js +4 -6
- package/mablscript/steps/ReleaseStep.js +1 -2
- package/mablscript/steps/SendHttpRequestStep.js +2 -4
- package/mablscript/steps/SendKeyStep.js +1 -1
- package/mablscript/steps/SetCookieStep.js +35 -20
- package/mablscript/steps/SetViewportStep.js +1 -1
- package/mablscript/steps/SwitchContextStep.js +3 -6
- package/mablscript/steps/SyntheticStep.js +1 -2
- package/mablscriptFind/index.js +1 -1
- package/middleware.js +1 -2
- package/package.json +2 -2
- package/popupDismissal/index.js +4 -5
- package/providers/authenticationProvider.js +5 -6
- package/providers/cliConfigProvider.js +10 -12
- package/providers/exportRequestProvider.js +3 -5
- package/providers/logging/loggingProvider.js +1 -1
- package/reporters/mochAwesome/mochAwesomeReporter.js +12 -14
- package/resources/mablFind.js +1 -1
- package/util/actionabilityUtil.js +1 -1
- package/util/analytics.js +6 -9
- package/util/browserTestUtils.js +1 -2
- package/util/markdownUtil.js +9 -11
package/mablscript/MablAction.js
CHANGED
|
@@ -64,9 +64,8 @@ function argumentIsMablVariable(argument) {
|
|
|
64
64
|
}
|
|
65
65
|
exports.argumentIsMablVariable = argumentIsMablVariable;
|
|
66
66
|
function parseArgument(arg) {
|
|
67
|
-
var _a;
|
|
68
67
|
if (typeof arg === 'string') {
|
|
69
|
-
const name =
|
|
68
|
+
const name = MablSymbol_1.SINGLE_VARIABLE_PATTERN_REGEX.exec(arg)?.[1];
|
|
70
69
|
if (name) {
|
|
71
70
|
return new MablSymbol_1.MablSymbol(name);
|
|
72
71
|
}
|
|
@@ -81,7 +80,7 @@ exports.distinctStrings = distinctStrings;
|
|
|
81
80
|
function convertObjectToMablscriptArgs(objectArgs) {
|
|
82
81
|
const mablArgs = Object.keys(objectArgs)
|
|
83
82
|
.sort()
|
|
84
|
-
.filter((key) =>
|
|
83
|
+
.filter((key) => objectArgs?.[key] !== undefined)
|
|
85
84
|
.map((key) => {
|
|
86
85
|
switch (typeof objectArgs[key]) {
|
|
87
86
|
case 'object':
|
package/mablscript/MablStep.js
CHANGED
|
@@ -47,8 +47,7 @@ class MablStep extends MablAction_1.MablAction {
|
|
|
47
47
|
return this.stepSourceIndexInFlow;
|
|
48
48
|
}
|
|
49
49
|
getDescriptionForLogging() {
|
|
50
|
-
|
|
51
|
-
return (((_a = this.annotation) === null || _a === void 0 ? void 0 : _a.description) || this.description || this.getStepName());
|
|
50
|
+
return (this.annotation?.description || this.description || this.getStepName());
|
|
52
51
|
}
|
|
53
52
|
substituteMablscriptVariable(argument) {
|
|
54
53
|
if (argument instanceof MablSymbol_1.MablSymbol) {
|
|
@@ -70,8 +69,7 @@ class MablStep extends MablAction_1.MablAction {
|
|
|
70
69
|
return formatted;
|
|
71
70
|
}
|
|
72
71
|
annotationsOnStep() {
|
|
73
|
-
|
|
74
|
-
return !!((_a = this.annotation) === null || _a === void 0 ? void 0 : _a.note) || !!((_b = this.annotation) === null || _b === void 0 ? void 0 : _b.description);
|
|
72
|
+
return !!this.annotation?.note || !!this.annotation?.description;
|
|
75
73
|
}
|
|
76
74
|
annotationsAsYml() {
|
|
77
75
|
const result = {};
|
package/mablscript/MablSymbol.js
CHANGED
|
@@ -11,7 +11,7 @@ class MablSymbol {
|
|
|
11
11
|
static fromString(formatted) {
|
|
12
12
|
const regEx = '{{@(?<name>.*)}}';
|
|
13
13
|
const found = formatted.match(regEx);
|
|
14
|
-
if (!found
|
|
14
|
+
if (!found?.groups) {
|
|
15
15
|
throw new Error(`Invalid MablSymbol format: ${formatted}`);
|
|
16
16
|
}
|
|
17
17
|
const name = found.groups.name;
|
|
@@ -30,7 +30,6 @@ class ConditionAction extends MablAction_1.MablAction {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
getEvaluateCondition() {
|
|
33
|
-
var _a;
|
|
34
33
|
if (this.conditionValueAttribute === undefined) {
|
|
35
34
|
throw new Error('Invalid equality condition. Missing value to compare.');
|
|
36
35
|
}
|
|
@@ -38,7 +37,7 @@ class ConditionAction extends MablAction_1.MablAction {
|
|
|
38
37
|
conditionType: ConditionDescriptor_1.ConditionType.Comparison,
|
|
39
38
|
comparisonType: ConditionDescriptor_1.ComparisonType.fromString(this.conditionAttribute),
|
|
40
39
|
comparatorValue: (0, MablAction_1.parseArgument)(this.conditionValueAttribute),
|
|
41
|
-
caseInsensitive:
|
|
40
|
+
caseInsensitive: this.options?.caseInsensitive,
|
|
42
41
|
};
|
|
43
42
|
}
|
|
44
43
|
getEvaluatePresence() {
|
|
@@ -69,8 +68,7 @@ class ConditionAction extends MablAction_1.MablAction {
|
|
|
69
68
|
return `${this.generateEvaluateConditionMablscript()}`;
|
|
70
69
|
}
|
|
71
70
|
getInputVariables() {
|
|
72
|
-
|
|
73
|
-
return MablAction_1.MablAction.findUniqueVariableReferencesInValue((_a = this.conditionValueAttribute) !== null && _a !== void 0 ? _a : '');
|
|
71
|
+
return MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.conditionValueAttribute ?? '');
|
|
74
72
|
}
|
|
75
73
|
}
|
|
76
74
|
exports.ConditionAction = ConditionAction;
|
|
@@ -132,7 +132,6 @@ class FindAction extends MablAction_1.MablAction {
|
|
|
132
132
|
throw new Error('No selector found in yaml');
|
|
133
133
|
}
|
|
134
134
|
toYaml() {
|
|
135
|
-
var _a;
|
|
136
135
|
const result = {};
|
|
137
136
|
const find = this.toDescriptor();
|
|
138
137
|
switch (find.findType) {
|
|
@@ -145,7 +144,7 @@ class FindAction extends MablAction_1.MablAction {
|
|
|
145
144
|
break;
|
|
146
145
|
case domUtil_1.FindType.FIND_ONE:
|
|
147
146
|
result.selector = find.findTarget.selector;
|
|
148
|
-
if (
|
|
147
|
+
if (find.findTarget.auxiliaryDescriptors?.length) {
|
|
149
148
|
result.selectorAncestors = find.findTarget.auxiliaryDescriptors.map((descriptor) => descriptor.selector);
|
|
150
149
|
}
|
|
151
150
|
break;
|
|
@@ -158,13 +157,12 @@ class FindAction extends MablAction_1.MablAction {
|
|
|
158
157
|
return this.generateFindMablscript();
|
|
159
158
|
}
|
|
160
159
|
generateFindMablscript() {
|
|
161
|
-
var _a;
|
|
162
160
|
let action = this.findDescriptor.findType;
|
|
163
161
|
let args = '';
|
|
164
162
|
switch (this.findDescriptor.findType) {
|
|
165
163
|
case domUtil_1.FindType.FIND_ONE:
|
|
166
164
|
const find = this.findDescriptor;
|
|
167
|
-
const selectors =
|
|
165
|
+
const selectors = find.findTarget.auxiliaryDescriptors?.length
|
|
168
166
|
? '[' +
|
|
169
167
|
[find.findTarget, ...find.findTarget.auxiliaryDescriptors]
|
|
170
168
|
.map(mablscriptFind_1.buildFindDescriptorString)
|
|
@@ -46,7 +46,7 @@ function convertFlowToStepList(flow, flowConfig) {
|
|
|
46
46
|
if (!flow.reusable && flow.flow_type === mablApi_1.Flow.FlowTypeEnum.Mablscript) {
|
|
47
47
|
return (0, importer_1.parseMablScriptIntoSteps)(flow);
|
|
48
48
|
}
|
|
49
|
-
const evaluateFlowStep = new EvaluateFlowStep_1.EvaluateFlowStep(EvaluateFlowStep_1.EvaluateFlowStep.mablScriptStepNames[0], [{ invariant_id: flow
|
|
49
|
+
const evaluateFlowStep = new EvaluateFlowStep_1.EvaluateFlowStep(EvaluateFlowStep_1.EvaluateFlowStep.mablScriptStepNames[0], [{ invariant_id: flow?.invariant_id }, flowConfig], []);
|
|
50
50
|
if (flow.description) {
|
|
51
51
|
evaluateFlowStep.setDescription(flow.description);
|
|
52
52
|
}
|
|
@@ -78,7 +78,7 @@ function convertStepListToFlow(steps) {
|
|
|
78
78
|
const flow = {
|
|
79
79
|
script: addTrailingNewline((0, importer_1.mablscriptTheLoadedSteps)(steps)),
|
|
80
80
|
script_description: steps
|
|
81
|
-
.map((step) =>
|
|
81
|
+
.map((step) => step.getDescription() ?? '')
|
|
82
82
|
.join('\n'),
|
|
83
83
|
step_annotations: stepAnnotations,
|
|
84
84
|
};
|
|
@@ -86,7 +86,7 @@ function convertStepListToFlow(steps) {
|
|
|
86
86
|
}
|
|
87
87
|
exports.convertStepListToFlow = convertStepListToFlow;
|
|
88
88
|
function flattenTestFlowsIntoSteps(flows, flowConfigs) {
|
|
89
|
-
return flows.flatMap((flow, index) => convertFlowToStepList(flow, flowConfigs
|
|
89
|
+
return flows.flatMap((flow, index) => convertFlowToStepList(flow, flowConfigs?.[index]));
|
|
90
90
|
}
|
|
91
91
|
exports.flattenTestFlowsIntoSteps = flattenTestFlowsIntoSteps;
|
|
92
92
|
function constructTestFlowsFromSteps(steps) {
|
|
@@ -173,7 +173,6 @@ function diffTests(test1Flows, test1FlowConfig, test2Flows, test2FlowConfig) {
|
|
|
173
173
|
}
|
|
174
174
|
exports.diffTests = diffTests;
|
|
175
175
|
function diffFlows(flow1, flow2) {
|
|
176
|
-
var _a, _b;
|
|
177
176
|
const flow1Steps = (0, importer_1.parseMablScriptIntoSteps)(flow1);
|
|
178
177
|
const formattedFlow1Steps = addTrailingNewline(flow1Steps.map((step) => step.toLineDiffFormat()).join('\n'));
|
|
179
178
|
const flow2Steps = (0, importer_1.parseMablScriptIntoSteps)(flow2);
|
|
@@ -181,7 +180,7 @@ function diffFlows(flow1, flow2) {
|
|
|
181
180
|
const flattenedDiffs = lineModeDiff(formattedFlow1Steps, formattedFlow2Steps);
|
|
182
181
|
const stepDiffs = convertDiffingFormatIntoDiffingSteps(flattenedDiffs, flow1Steps, flow2Steps);
|
|
183
182
|
const parametersDiff = diffFlowVariables(flow1.parameters, flow2.parameters);
|
|
184
|
-
const inputVariablesDiff = diffFlowVariables(
|
|
183
|
+
const inputVariablesDiff = diffFlowVariables(flow1.variables?.inputs, flow2.variables?.inputs);
|
|
185
184
|
return { stepDiff: stepDiffs, parametersDiff, inputVariablesDiff };
|
|
186
185
|
}
|
|
187
186
|
exports.diffFlows = diffFlows;
|
|
@@ -200,8 +199,10 @@ function diffFlowVariables(flow1Variables, flow2Variables) {
|
|
|
200
199
|
return flowVariablesDiff;
|
|
201
200
|
}
|
|
202
201
|
function flattenFlowVariables(flowVariables) {
|
|
203
|
-
|
|
204
|
-
|
|
202
|
+
return (flowVariables
|
|
203
|
+
?.sort((a, b) => a.name.localeCompare(b.name))
|
|
204
|
+
.map((parameter) => (0, fast_json_stable_stringify_1.default)(parameter))
|
|
205
|
+
.join('\n') ?? '');
|
|
205
206
|
}
|
|
206
207
|
function addTrailingNewline(text) {
|
|
207
208
|
if (!text) {
|
package/mablscript/importer.js
CHANGED
|
@@ -371,9 +371,8 @@ function parseMablScriptIntoSteps(flow) {
|
|
|
371
371
|
const parsed = parseMablScript(updatedScript);
|
|
372
372
|
const loadedSteps = loadMablScriptIntoSteps(parsed);
|
|
373
373
|
loadedSteps.forEach((step, index) => {
|
|
374
|
-
var _a;
|
|
375
374
|
step.setDescription(flowDescriptions[index]);
|
|
376
|
-
if (
|
|
375
|
+
if (flow?.step_annotations?.[index]) {
|
|
377
376
|
step.setAnnotation(flow.step_annotations[index]);
|
|
378
377
|
}
|
|
379
378
|
step.setDisabled(disabledIndices.includes(index));
|
|
@@ -28,7 +28,6 @@ class AccessibilityCheckStep extends MablStep_1.MablStep {
|
|
|
28
28
|
return AccessibilityCheckStep.yamlMablScriptNames[0];
|
|
29
29
|
}
|
|
30
30
|
toStepDescriptor() {
|
|
31
|
-
var _a, _b, _c, _d;
|
|
32
31
|
if (this.findAction) {
|
|
33
32
|
const find = this.findAction.toDescriptor();
|
|
34
33
|
switch (find.findType) {
|
|
@@ -46,10 +45,10 @@ class AccessibilityCheckStep extends MablStep_1.MablStep {
|
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
return {
|
|
49
|
-
tags:
|
|
50
|
-
rules:
|
|
51
|
-
disabledRules:
|
|
52
|
-
failOn:
|
|
48
|
+
tags: this.checkConfig?.tags,
|
|
49
|
+
rules: this.checkConfig?.rules,
|
|
50
|
+
disabledRules: this.checkConfig?.disabledRules,
|
|
51
|
+
failOn: this.checkConfig?.failOn,
|
|
53
52
|
};
|
|
54
53
|
}
|
|
55
54
|
getFormattedStep(_fullLocatorsOn) {
|
|
@@ -83,11 +82,10 @@ class AccessibilityCheckStep extends MablStep_1.MablStep {
|
|
|
83
82
|
return new AccessibilityCheckStep(AccessibilityCheckStep.mablScriptStepNames[0], [checkConfig], actions);
|
|
84
83
|
}
|
|
85
84
|
toMablscript() {
|
|
86
|
-
var _a, _b, _c;
|
|
87
85
|
let argString = '';
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
if (this.checkConfig?.tags ||
|
|
87
|
+
this.checkConfig?.disabledRules ||
|
|
88
|
+
this.checkConfig?.rules) {
|
|
91
89
|
argString = `{${(0, MablStep_1.buildObjectString)(this.checkConfig)}}`;
|
|
92
90
|
}
|
|
93
91
|
let findAction = '';
|
|
@@ -43,7 +43,6 @@ exports.fieldToAssertionStep = {};
|
|
|
43
43
|
Object.entries(exports.assertionStepToField).forEach(([stepType, field]) => (exports.fieldToAssertionStep[field] = stepType));
|
|
44
44
|
class AssertStep extends MablStep_1.MablStep {
|
|
45
45
|
constructor(name, args, actions) {
|
|
46
|
-
var _a, _b;
|
|
47
46
|
super(name, args, actions);
|
|
48
47
|
const firstAction = actions[0];
|
|
49
48
|
if (firstAction instanceof FindAction_1.FindAction ||
|
|
@@ -74,9 +73,9 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
74
73
|
? args[0]
|
|
75
74
|
: undefined;
|
|
76
75
|
this.onFailure =
|
|
77
|
-
|
|
76
|
+
this.assertArguments?.onFailure ||
|
|
78
77
|
OnFailure.FailImmediately;
|
|
79
|
-
this.observationScope =
|
|
78
|
+
this.observationScope = this.assertArguments?.observationScope;
|
|
80
79
|
}
|
|
81
80
|
canContinueOnFailure() {
|
|
82
81
|
return this.onFailure !== OnFailure.FailImmediately;
|
|
@@ -92,10 +91,9 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
92
91
|
}
|
|
93
92
|
}
|
|
94
93
|
determineIfWaitUntilStep() {
|
|
95
|
-
var _a, _b;
|
|
96
94
|
const find = this.primaryAction.toDescriptor();
|
|
97
95
|
if ((0, domUtil_1.isFindElementDescriptor)(find)) {
|
|
98
|
-
if (
|
|
96
|
+
if (find.findOptions?.waitUntil?.timeoutSeconds) {
|
|
99
97
|
return true;
|
|
100
98
|
}
|
|
101
99
|
}
|
|
@@ -108,7 +106,6 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
108
106
|
return exports.fieldToAssertionStep[this.assertionType];
|
|
109
107
|
}
|
|
110
108
|
toStepDescriptor() {
|
|
111
|
-
var _a, _b;
|
|
112
109
|
const find = this.primaryAction.toDescriptor();
|
|
113
110
|
const descriptorToActionMap = new Map()
|
|
114
111
|
.set(find, this.primaryAction)
|
|
@@ -121,9 +118,9 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
121
118
|
}
|
|
122
119
|
return {
|
|
123
120
|
find,
|
|
124
|
-
extractDescriptor:
|
|
121
|
+
extractDescriptor: this.extractAction?.extractDescriptor,
|
|
125
122
|
conditionDescriptor: this.conditionAction.conditionDescriptor,
|
|
126
|
-
countDescriptor:
|
|
123
|
+
countDescriptor: this.countAction?.countDescriptor,
|
|
127
124
|
onFailure: this.onFailure,
|
|
128
125
|
observationScope: this.observationScope,
|
|
129
126
|
descriptorToActionMap,
|
|
@@ -219,14 +216,13 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
219
216
|
], actions);
|
|
220
217
|
}
|
|
221
218
|
toMablscript() {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
((_b = this.assertArguments) === null || _b === void 0 ? void 0 : _b.observationScope))
|
|
219
|
+
const assertAction = `.assert(${!!(this.assertArguments?.onFailure ||
|
|
220
|
+
this.assertArguments?.observationScope)
|
|
225
221
|
? (0, MablAction_1.convertObjectToMablscriptArgs)({
|
|
226
222
|
...this.assertArguments,
|
|
227
|
-
onFailure:
|
|
223
|
+
onFailure: this.assertArguments?.onFailure === OnFailure.FailImmediately
|
|
228
224
|
? undefined
|
|
229
|
-
:
|
|
225
|
+
: this.assertArguments?.onFailure,
|
|
230
226
|
})
|
|
231
227
|
: ''})`;
|
|
232
228
|
if (this.countAction) {
|
|
@@ -242,12 +238,11 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
242
238
|
return `${this.primaryAction.toMablscript()}.${this.conditionAction.toMablscript()}${assertAction}`;
|
|
243
239
|
}
|
|
244
240
|
getInputVariables() {
|
|
245
|
-
var _a, _b, _c, _d;
|
|
246
241
|
return (0, MablAction_1.distinctStrings)([
|
|
247
242
|
...this.primaryAction.getInputVariables(),
|
|
248
|
-
...(
|
|
243
|
+
...(this.countAction?.getInputVariables() ?? []),
|
|
249
244
|
...this.conditionAction.getInputVariables(),
|
|
250
|
-
...(
|
|
245
|
+
...(this.extractAction?.getInputVariables() ?? []),
|
|
251
246
|
]);
|
|
252
247
|
}
|
|
253
248
|
}
|
|
@@ -7,10 +7,9 @@ const domUtil_1 = require("../../domUtil");
|
|
|
7
7
|
const ActionsUtils_1 = require("./ActionsUtils");
|
|
8
8
|
class ClickAndHoldStep extends MablStep_1.MablStep {
|
|
9
9
|
constructor(name, args, actions) {
|
|
10
|
-
var _a;
|
|
11
10
|
super(name, args, actions);
|
|
12
11
|
this.findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(this.actions);
|
|
13
|
-
this.clickArgs =
|
|
12
|
+
this.clickArgs = this.parseArgs(args) ?? { isHtml5: false };
|
|
14
13
|
}
|
|
15
14
|
parseArgs(args) {
|
|
16
15
|
if (args.length === 0) {
|
|
@@ -3,19 +3,52 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CookieUtils = void 0;
|
|
4
4
|
var CookieUtils;
|
|
5
5
|
(function (CookieUtils) {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
CookieUtils.validCookieNameCharacterRange = /^[\x21-\x7E]*$/;
|
|
7
|
+
CookieUtils.invalidCookieNameCharaters = /[()<>@,;:\\"\\/\[\]?={}]/;
|
|
8
|
+
CookieUtils.validCookieValueCharacters = /^(!|[\x23-\x2B]|[\x2D-\x3A]|[\x3C-\x5B]|[\x5D-\x7E])*$/;
|
|
9
|
+
function validateCookieName(name) {
|
|
10
|
+
const trimmed = name.trim();
|
|
11
|
+
if ('' === trimmed) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
if (!CookieUtils.validCookieNameCharacterRange.test(trimmed) ||
|
|
15
|
+
CookieUtils.invalidCookieNameCharaters.test(trimmed)) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
CookieUtils.validateCookieName = validateCookieName;
|
|
8
21
|
function normalizeName(name) {
|
|
9
22
|
const trimmed = name.trim();
|
|
10
23
|
if ('' === trimmed) {
|
|
11
24
|
throw new Error('Cookie name cannot be empty or include only whitespace characters');
|
|
12
25
|
}
|
|
13
|
-
if (!validCharacterRange.test(trimmed) || invalidCharaters.test(trimmed)) {
|
|
14
|
-
throw new Error(`Invalid characters found in cookie name [${trimmed}]. Valid characters
|
|
15
|
-
include any US-ASCII character except control characters and separators.
|
|
16
|
-
`);
|
|
17
|
-
}
|
|
18
26
|
return trimmed;
|
|
19
27
|
}
|
|
20
28
|
CookieUtils.normalizeName = normalizeName;
|
|
29
|
+
function validateCookieValue(value) {
|
|
30
|
+
const trimmed = value.trim();
|
|
31
|
+
if ('' === trimmed) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
if (!CookieUtils.validCookieValueCharacters.test(trimmed)) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
CookieUtils.validateCookieValue = validateCookieValue;
|
|
40
|
+
function normalizeValue(value) {
|
|
41
|
+
if (!value) {
|
|
42
|
+
throw new Error('Cookie value cannot be empty');
|
|
43
|
+
}
|
|
44
|
+
const trimmed = value.trim();
|
|
45
|
+
const bareValue = trimmed.startsWith('"') && trimmed.endsWith('"')
|
|
46
|
+
? trimmed.substring(1, trimmed.length - 1)
|
|
47
|
+
: trimmed;
|
|
48
|
+
if ('' === bareValue) {
|
|
49
|
+
throw new Error('Cookie value cannot be empty or include only whitespace characters');
|
|
50
|
+
}
|
|
51
|
+
return trimmed;
|
|
52
|
+
}
|
|
53
|
+
CookieUtils.normalizeValue = normalizeValue;
|
|
21
54
|
})(CookieUtils = exports.CookieUtils || (exports.CookieUtils = {}));
|
|
@@ -101,7 +101,6 @@ class CreateVariableStep extends MablStep_1.MablStep {
|
|
|
101
101
|
return step;
|
|
102
102
|
}
|
|
103
103
|
getFormattedStep() {
|
|
104
|
-
var _a;
|
|
105
104
|
const step = this.toStepDescriptor();
|
|
106
105
|
const stepName = this.getStepName();
|
|
107
106
|
const formatted = {
|
|
@@ -128,7 +127,7 @@ class CreateVariableStep extends MablStep_1.MablStep {
|
|
|
128
127
|
generator: step.generator,
|
|
129
128
|
name: this.variableName,
|
|
130
129
|
selector: step.generator.find.findTarget.selector,
|
|
131
|
-
selectorAncestors: (
|
|
130
|
+
selectorAncestors: (step.generator.find.findTarget.auxiliaryDescriptors ?? []).map((descriptor) => descriptor.selector),
|
|
132
131
|
};
|
|
133
132
|
break;
|
|
134
133
|
case CreateVariableStepDescriptor_1.VariableGenerator.JAVASCRIPT:
|
|
@@ -8,10 +8,9 @@ const AwaitPDFDownloadAction_1 = require("../actions/AwaitPDFDownloadAction");
|
|
|
8
8
|
const domUtil_1 = require("../../domUtil");
|
|
9
9
|
class DownloadStep extends MablStep_1.MablStep {
|
|
10
10
|
constructor(name, args, actions) {
|
|
11
|
-
var _a;
|
|
12
11
|
super(name, args, actions);
|
|
13
12
|
this.validate();
|
|
14
|
-
this.fileAttributes = (
|
|
13
|
+
this.fileAttributes = (this.getActionArgs()[0] ?? {});
|
|
15
14
|
this.awaitDownloadAction = this.actions[0];
|
|
16
15
|
}
|
|
17
16
|
validate() {
|
|
@@ -43,7 +43,6 @@ class EnterTextStep extends MablStep_1.MablStep {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
getFormattedStep() {
|
|
46
|
-
var _a;
|
|
47
46
|
const step = this.toStepDescriptor();
|
|
48
47
|
const stepName = this.getStepName();
|
|
49
48
|
const formatted = {
|
|
@@ -57,7 +56,7 @@ class EnterTextStep extends MablStep_1.MablStep {
|
|
|
57
56
|
}
|
|
58
57
|
if (step.find.findType === domUtil_1.FindType.FIND_ONE) {
|
|
59
58
|
formatted[stepName].selector = step.find.findTarget.selector;
|
|
60
|
-
if (
|
|
59
|
+
if (step.find.findTarget.auxiliaryDescriptors?.length) {
|
|
61
60
|
formatted[stepName].selectorAncestors =
|
|
62
61
|
step.find.findTarget.auxiliaryDescriptors.map((descriptor) => descriptor.selector);
|
|
63
62
|
}
|
|
@@ -43,6 +43,6 @@ exports.EvaluateFlowStep = EvaluateFlowStep;
|
|
|
43
43
|
EvaluateFlowStep.mablScriptStepNames = ['evaluate_flow'];
|
|
44
44
|
EvaluateFlowStep.yamlMablScriptNames = [exports.EVALUATE_FLOW_STEP_NAME];
|
|
45
45
|
function isEvaluateFlowStep(step) {
|
|
46
|
-
return
|
|
46
|
+
return step?.getStepName() === exports.EVALUATE_FLOW_STEP_NAME;
|
|
47
47
|
}
|
|
48
48
|
exports.isEvaluateFlowStep = isEvaluateFlowStep;
|
|
@@ -33,14 +33,13 @@ class IfConditionStep extends MablStep_1.MablStep {
|
|
|
33
33
|
return 'If';
|
|
34
34
|
}
|
|
35
35
|
toStepDescriptor() {
|
|
36
|
-
var _a, _b;
|
|
37
36
|
const conditionDescriptor = this.conditionAction !== undefined
|
|
38
|
-
?
|
|
37
|
+
? this.conditionAction?.conditionDescriptor
|
|
39
38
|
: { conditionType: ConditionDescriptor_1.ConditionType.Truthy };
|
|
40
39
|
const find = this.primaryAction.toDescriptor();
|
|
41
40
|
return {
|
|
42
41
|
find,
|
|
43
|
-
extractDescriptor:
|
|
42
|
+
extractDescriptor: this.extractAction?.extractDescriptor,
|
|
44
43
|
conditionDescriptor,
|
|
45
44
|
onFailure: AssertStep_1.OnFailure.FailImmediately,
|
|
46
45
|
descriptorToActionMap: new Map().set(find, this.primaryAction),
|
|
@@ -137,11 +136,10 @@ class IfConditionStep extends MablStep_1.MablStep {
|
|
|
137
136
|
return `${this.actions.reduce((mablscript, action) => `${mablscript}${action.toMablscript()}.`, '')}conditional_if()`;
|
|
138
137
|
}
|
|
139
138
|
getInputVariables() {
|
|
140
|
-
var _a, _b, _c, _d;
|
|
141
139
|
return (0, MablAction_1.distinctStrings)([
|
|
142
140
|
...this.primaryAction.getInputVariables(),
|
|
143
|
-
...(
|
|
144
|
-
...(
|
|
141
|
+
...(this.conditionAction?.getInputVariables() ?? []),
|
|
142
|
+
...(this.extractAction?.getInputVariables() ?? []),
|
|
145
143
|
]);
|
|
146
144
|
}
|
|
147
145
|
}
|
|
@@ -8,10 +8,9 @@ const domUtil_1 = require("../../domUtil");
|
|
|
8
8
|
const ActionsUtils_1 = require("./ActionsUtils");
|
|
9
9
|
class ReleaseStep extends MablStep_1.MablStep {
|
|
10
10
|
constructor(name, args, actions) {
|
|
11
|
-
var _a;
|
|
12
11
|
super(name, args, actions);
|
|
13
12
|
this.findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(this.actions);
|
|
14
|
-
this.releaseArgs =
|
|
13
|
+
this.releaseArgs = this.parseArgs(args) ?? { isHtml5: false };
|
|
15
14
|
}
|
|
16
15
|
parseArgs(args) {
|
|
17
16
|
if (args.length === 0) {
|
|
@@ -27,10 +27,9 @@ class SendHttpRequestStep extends MablStep_1.MablStep {
|
|
|
27
27
|
return formatted;
|
|
28
28
|
}
|
|
29
29
|
static fromYaml(_stepName, stepArgs) {
|
|
30
|
-
var _a;
|
|
31
30
|
const formatted = stepArgs;
|
|
32
31
|
if (formatted.assertions) {
|
|
33
|
-
formatted.assertions =
|
|
32
|
+
formatted.assertions = formatted.assertions?.map((assertion) => ({
|
|
34
33
|
...assertion,
|
|
35
34
|
assertion: AssertStep_1.assertionStepToField[`Assert${assertion.assertion}`],
|
|
36
35
|
}));
|
|
@@ -47,8 +46,7 @@ class SendHttpRequestStep extends MablStep_1.MablStep {
|
|
|
47
46
|
return MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.sendRequest);
|
|
48
47
|
}
|
|
49
48
|
getOutputVariables() {
|
|
50
|
-
|
|
51
|
-
return (_b = (_a = this.sendRequest.variables) === null || _a === void 0 ? void 0 : _a.map((variable) => variable.name)) !== null && _b !== void 0 ? _b : [];
|
|
49
|
+
return this.sendRequest.variables?.map((variable) => variable.name) ?? [];
|
|
52
50
|
}
|
|
53
51
|
}
|
|
54
52
|
exports.SendHttpRequestStep = SendHttpRequestStep;
|
|
@@ -19,7 +19,7 @@ class SendKeyStep extends MablStep_1.MablStep {
|
|
|
19
19
|
throw new Error(`Unexpected find action for ${name} step: ${JSON.stringify(this.actions[0])}`);
|
|
20
20
|
}
|
|
21
21
|
const keys = this.getActionArgs();
|
|
22
|
-
if (!
|
|
22
|
+
if (!keys?.length) {
|
|
23
23
|
throw new Error(`${name} step expects at least one key`);
|
|
24
24
|
}
|
|
25
25
|
if (keys.every(SendKeyStepDescriptor_1.isCrossPlatformKeyPress)) {
|
|
@@ -5,24 +5,54 @@ 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
|
-
const validValueCharacters = /^(!|[\x23-\x2B]|[\x2D-\x3A]|[\x3C-\x5B]|[\x5D-\x7E])*$/;
|
|
9
8
|
class SetCookieStep extends MablStep_1.MablStep {
|
|
10
9
|
constructor(name, args, actions) {
|
|
11
10
|
super(name, args, actions);
|
|
12
|
-
|
|
13
|
-
this.
|
|
11
|
+
const cookieSelector = this.getActionArgs()[0];
|
|
12
|
+
this.cookieName = CookieUtils_1.CookieUtils.normalizeName(cookieSelector.name);
|
|
13
|
+
this.cookieValue = CookieUtils_1.CookieUtils.normalizeValue(cookieSelector.value);
|
|
14
|
+
const cookieOptions = {
|
|
15
|
+
domain: cookieSelector.domain,
|
|
16
|
+
path: cookieSelector.path,
|
|
17
|
+
expires: cookieSelector.expiry,
|
|
18
|
+
httpOnly: cookieSelector.http_only,
|
|
19
|
+
secure: cookieSelector.secure,
|
|
20
|
+
sameSite: cookieSelector.same_site,
|
|
21
|
+
url: cookieSelector.url,
|
|
22
|
+
};
|
|
23
|
+
if (Object.values(cookieOptions).filter((optionValue) => optionValue !== undefined).length > 0) {
|
|
24
|
+
this.cookieOptions = cookieOptions;
|
|
25
|
+
}
|
|
14
26
|
}
|
|
15
27
|
getStepName() {
|
|
16
28
|
return 'SetCookie';
|
|
17
29
|
}
|
|
18
30
|
toStepDescriptor() {
|
|
19
|
-
return {
|
|
31
|
+
return {
|
|
32
|
+
name: this.cookieName,
|
|
33
|
+
value: this.cookieValue,
|
|
34
|
+
options: this.cookieOptions,
|
|
35
|
+
};
|
|
20
36
|
}
|
|
21
37
|
static fromYaml(_stepName, stepArgs) {
|
|
22
38
|
return new SetCookieStep('set_cookie', [stepArgs], []);
|
|
23
39
|
}
|
|
24
40
|
toMablscript() {
|
|
25
|
-
|
|
41
|
+
const cookieSelector = {
|
|
42
|
+
name: this.cookieName,
|
|
43
|
+
value: this.cookieValue,
|
|
44
|
+
domain: this.cookieOptions?.domain,
|
|
45
|
+
path: this.cookieOptions?.path,
|
|
46
|
+
expiry: this.cookieOptions?.expires,
|
|
47
|
+
http_only: this.cookieOptions?.httpOnly,
|
|
48
|
+
secure: this.cookieOptions?.secure,
|
|
49
|
+
same_site: this.cookieOptions?.sameSite,
|
|
50
|
+
url: this.cookieOptions?.url,
|
|
51
|
+
};
|
|
52
|
+
return `set_cookie(${(0, domUtil_1.buildStepArgumentString)({
|
|
53
|
+
params: cookieSelector,
|
|
54
|
+
legacy: false,
|
|
55
|
+
})})`;
|
|
26
56
|
}
|
|
27
57
|
getInputVariables() {
|
|
28
58
|
return (0, MablAction_1.distinctStrings)([
|
|
@@ -30,21 +60,6 @@ class SetCookieStep extends MablStep_1.MablStep {
|
|
|
30
60
|
...MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.cookieValue),
|
|
31
61
|
]);
|
|
32
62
|
}
|
|
33
|
-
static normalizeValue(value) {
|
|
34
|
-
const trimmed = value.trim();
|
|
35
|
-
const bareValue = trimmed.startsWith('"') && trimmed.endsWith('"')
|
|
36
|
-
? trimmed.substring(1, trimmed.length - 1)
|
|
37
|
-
: trimmed;
|
|
38
|
-
if ('' === bareValue) {
|
|
39
|
-
throw new Error('Cookie value cannot be empty or include only whitespace characters');
|
|
40
|
-
}
|
|
41
|
-
if (!validValueCharacters.test(bareValue)) {
|
|
42
|
-
throw new Error(`Invalid characters found in cookie value [${bareValue}].
|
|
43
|
-
Valid characters include US-ASCII characters excluding control
|
|
44
|
-
characters, whitespace, double-quote, comma, semicolon, and backslash.`);
|
|
45
|
-
}
|
|
46
|
-
return trimmed;
|
|
47
|
-
}
|
|
48
63
|
}
|
|
49
64
|
exports.SetCookieStep = SetCookieStep;
|
|
50
65
|
SetCookieStep.mablScriptStepNames = ['set_cookie'];
|
|
@@ -6,7 +6,7 @@ class SetViewportStep extends MablStep_1.MablStep {
|
|
|
6
6
|
constructor(name, args, actions) {
|
|
7
7
|
super(name, args, actions);
|
|
8
8
|
const viewportArg = this.getActionArgs()[0];
|
|
9
|
-
this.size = viewportArg
|
|
9
|
+
this.size = viewportArg?.size;
|
|
10
10
|
}
|
|
11
11
|
getStepName() {
|
|
12
12
|
return 'SetViewport';
|
|
@@ -60,7 +60,6 @@ class SwitchContextStep extends MablStep_1.MablStep {
|
|
|
60
60
|
return this.switch;
|
|
61
61
|
}
|
|
62
62
|
getFormattedStep() {
|
|
63
|
-
var _a;
|
|
64
63
|
const step = this.toStepDescriptor();
|
|
65
64
|
const stepName = this.getStepName();
|
|
66
65
|
const formatted = {
|
|
@@ -78,7 +77,7 @@ class SwitchContextStep extends MablStep_1.MablStep {
|
|
|
78
77
|
}
|
|
79
78
|
if ((0, SwitchContextStepDescriptor_1.isSwitchFrame)(step)) {
|
|
80
79
|
formatted[stepName].selector = step.frame.findTarget.selector;
|
|
81
|
-
if (
|
|
80
|
+
if (step.frame.findTarget.auxiliaryDescriptors?.length) {
|
|
82
81
|
formatted[stepName].selectorAncestors =
|
|
83
82
|
step.frame.findTarget.auxiliaryDescriptors.map((descriptor) => descriptor.selector);
|
|
84
83
|
}
|
|
@@ -95,15 +94,13 @@ class SwitchContextStep extends MablStep_1.MablStep {
|
|
|
95
94
|
return new SwitchContextStep('switch_context_to', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
|
|
96
95
|
}
|
|
97
96
|
toMablscript() {
|
|
98
|
-
var _a;
|
|
99
97
|
if ((0, SwitchContextStepDescriptor_1.isSwitchRoot)(this.switch) && this.switch.frame === 'root') {
|
|
100
98
|
return 'switch_context_to("root")';
|
|
101
99
|
}
|
|
102
|
-
return `${
|
|
100
|
+
return `${this.findAction?.toMablscript()}.switch_context_to()`;
|
|
103
101
|
}
|
|
104
102
|
getInputVariables() {
|
|
105
|
-
|
|
106
|
-
return (_b = (_a = this.findAction) === null || _a === void 0 ? void 0 : _a.getInputVariables()) !== null && _b !== void 0 ? _b : [];
|
|
103
|
+
return this.findAction?.getInputVariables() ?? [];
|
|
107
104
|
}
|
|
108
105
|
}
|
|
109
106
|
exports.SwitchContextStep = SwitchContextStep;
|