@mablhq/mabl-cli 1.12.20 → 1.13.14
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 -11
- package/api/mablApiClient.js +9 -9
- package/api/mablApiClientFactory.js +1 -0
- package/auth/AuthClient.js +1 -4
- package/browserLauncher/browserLauncherFactory.js +7 -3
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +6 -2
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +1 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +61 -21
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +24 -17
- package/browserLauncher/playwrightBrowserLauncher/playwrightHttpResponse.js +3 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +72 -68
- package/browserLauncher/playwrightBrowserLauncher/wrappers.js +1 -1
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerBrowser.js +7 -3
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerElementHandle.js +13 -7
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerFrame.js +7 -7
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerHttpRequest.js +1 -1
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerHttpResponse.js +4 -1
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerJsHandle.js +3 -3
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerPage.js +23 -16
- package/browserLauncher/puppeteerBrowserLauncher/wrappers.js +1 -1
- package/browserLauncher/types.js +6 -1
- package/cli.js +6 -4
- package/commands/applications/applications_cmds/list.js +1 -1
- package/commands/branches/branches_cmds/create.js +1 -1
- package/commands/branches/branches_cmds/list.js +1 -1
- package/commands/branches/branches_cmds/merge.js +1 -1
- package/commands/commandUtil/awaitCompletion.js +2 -2
- package/commands/commandUtil/codeInsights.js +6 -6
- package/commands/commandUtil/fileUtil.js +1 -1
- package/commands/commandUtil/util.js +12 -12
- package/commands/config/config_cmds/list.js +1 -1
- package/commands/constants.js +1 -1
- package/commands/credentials/credentials_cmds/list.js +1 -1
- package/commands/deploy/deploy_cmds/create.js +2 -2
- package/commands/deploy/deploy_cmds/executionResultPresenter.js +7 -7
- package/commands/deploy/deploy_cmds/list.js +1 -1
- package/commands/environments/environments_cmds/create.js +3 -3
- package/commands/environments/environments_cmds/list.js +1 -1
- package/commands/environments/environments_cmds/urls_cmds/add.js +1 -1
- package/commands/flows/flows_cmds/list.js +1 -1
- package/commands/plans/plans_cmds/list.js +1 -1
- package/commands/test-runs/test-runs_cmds/export.js +1 -1
- package/commands/tests/executionUtil.js +1 -1
- package/commands/tests/testsUtil.js +16 -20
- package/commands/tests/tests_cmds/edit.js +1 -1
- package/commands/tests/tests_cmds/export.js +1 -1
- package/commands/tests/tests_cmds/import.js +13 -13
- package/commands/tests/tests_cmds/list.js +2 -2
- package/commands/tests/tests_cmds/run-alpha.js +1 -1
- package/commands/tests/tests_cmds/run-cloud.js +7 -7
- package/commands/tests/tests_cmds/run-legacy.js +2 -2
- package/commands/tests/tests_cmds/run.js +25 -7
- package/commands/workspaces/workspace_cmds/copy.js +1 -1
- package/commands/workspaces/workspace_cmds/list.js +1 -1
- package/configGenerators/flowConfigGenerator.js +3 -3
- package/configGenerators/selIdeGenerator.js +1 -1
- package/configGenerators/testConfigGenerator.js +7 -8
- package/core/execution/ApiTestUtils.js +2 -2
- package/core/trainer/openUtils.js +47 -0
- package/core/trainer/trainingSessions.js +36 -61
- package/env/defaultEnv.js +2 -1
- package/env/dev.js +2 -1
- package/env/env.js +3 -1
- package/env/local.js +2 -1
- package/env/prod.js +2 -1
- package/execution/index.js +1 -1
- package/execution/index.js.LICENSE.txt +12 -0
- package/index.d.ts +7 -0
- package/mablApi/index.js +1 -1
- package/mablscript/MablStep.js +11 -7
- package/mablscript/actions/ConditionAction.js +2 -4
- package/mablscript/actions/FindAction.js +4 -4
- package/mablscript/importer.js +16 -14
- package/mablscript/steps/AccessibilityCheck.js +88 -0
- package/mablscript/steps/AssertStep.js +6 -5
- package/mablscript/steps/CreateVariableStep.js +2 -3
- package/mablscript/steps/DownloadStep.js +1 -2
- package/mablscript/steps/EnterTextStep.js +2 -1
- package/mablscript/steps/IfConditionStep.js +3 -3
- package/mablscript/steps/SendHttpRequestStep.js +11 -3
- package/mablscript/steps/SendKeyStep.js +2 -2
- package/mablscript/steps/SetFilesStep.js +1 -1
- package/mablscript/steps/SwitchContextStep.js +2 -1
- package/mablscript/types/AccessibilityCheckStepDescriptor.js +2 -0
- package/mablscript/types/AccessibilityCheckTypes.js +9 -0
- package/mablscript/types/VariableDataType.js +1 -8
- package/mablscript/types/VariableNamespace.js +1 -1
- package/mablscriptFind/index.js +1 -1
- package/package.json +8 -5
- package/popupDismissal/index.js +16 -17
- package/providers/authenticationProvider.js +2 -3
- package/providers/cliConfigProvider.js +1 -1
- package/providers/exportRequestProvider.js +1 -1
- package/providers/logging/loggingProvider.js +2 -2
- package/providers/scmContextProvider.js +1 -1
- package/reporters/mochAwesome/mochAwesomeReporter.js +10 -6
- package/reporters/reporter.js +1 -1
- package/resources/mablFind.js +1 -1
- package/resources/popupDismissal.js +1 -1
- package/util/RichPromise.js +2 -2
- package/util/actionabilityUtil.js +36 -7
- package/util/asyncUtil.js +45 -0
- package/util/downloadUtil.js +1 -1
- package/util/logUtils.js +20 -1
- package/util/markdownUtil.js +3 -3
- package/util/pureUtil.js +6 -6
- package/util/resourceUtil.js +18 -1
- package/core/trainer/trainerBrowserUtil.js +0 -33
package/mablscript/MablStep.js
CHANGED
|
@@ -50,7 +50,7 @@ class MablStep extends MablAction_1.MablAction {
|
|
|
50
50
|
}
|
|
51
51
|
toStepDescriptor(_fullLocatorsOn) {
|
|
52
52
|
const formatted = {
|
|
53
|
-
names: this.actions.map(action => action.getActionName()),
|
|
53
|
+
names: this.actions.map((action) => action.getActionName()),
|
|
54
54
|
};
|
|
55
55
|
formatted.names.push(this.getActionName());
|
|
56
56
|
return formatted;
|
|
@@ -74,7 +74,8 @@ class MablStep extends MablAction_1.MablAction {
|
|
|
74
74
|
}
|
|
75
75
|
getFormattedStep(fullLocatorsOn) {
|
|
76
76
|
const formatted = {};
|
|
77
|
-
formatted[this.getStepName()] =
|
|
77
|
+
formatted[this.getStepName()] =
|
|
78
|
+
this.annotationsAsYml();
|
|
78
79
|
Object.assign(formatted[this.getStepName()], this.toStepDescriptor(fullLocatorsOn));
|
|
79
80
|
return formatted;
|
|
80
81
|
}
|
|
@@ -88,8 +89,8 @@ class MablStep extends MablAction_1.MablAction {
|
|
|
88
89
|
convertObjectToMablscriptArgs(objectArgs) {
|
|
89
90
|
const mablArgs = Object.keys(objectArgs)
|
|
90
91
|
.sort()
|
|
91
|
-
.filter(key => (objectArgs === null || objectArgs === void 0 ? void 0 : objectArgs[key]) !== undefined)
|
|
92
|
-
.map(key => {
|
|
92
|
+
.filter((key) => (objectArgs === null || objectArgs === void 0 ? void 0 : objectArgs[key]) !== undefined)
|
|
93
|
+
.map((key) => {
|
|
93
94
|
switch (typeof objectArgs[key]) {
|
|
94
95
|
case 'object':
|
|
95
96
|
return `${key}: ${this.convertObjectToMablscriptArgs(objectArgs[key])}`;
|
|
@@ -113,7 +114,7 @@ function buildSourceRepresentationOfObject(object) {
|
|
|
113
114
|
const stringedValues = Object.entries(object).map(([key, value]) => {
|
|
114
115
|
if (Array.isArray(value)) {
|
|
115
116
|
return `${key}: [${value
|
|
116
|
-
.map(arrayVal => buildSourceRepresentationOfObject(arrayVal))
|
|
117
|
+
.map((arrayVal) => buildSourceRepresentationOfObject(arrayVal))
|
|
117
118
|
.join(', ')}]`;
|
|
118
119
|
}
|
|
119
120
|
else if (typeof value !== 'object') {
|
|
@@ -130,8 +131,11 @@ exports.buildSourceRepresentationOfObject = buildSourceRepresentationOfObject;
|
|
|
130
131
|
function buildObjectString(objectString) {
|
|
131
132
|
const final = [];
|
|
132
133
|
Object.keys(objectString)
|
|
133
|
-
.filter(key => key !== 'value')
|
|
134
|
-
.forEach(key => {
|
|
134
|
+
.filter((key) => key !== 'value')
|
|
135
|
+
.forEach((key) => {
|
|
136
|
+
if (typeof objectString[key] === 'undefined') {
|
|
137
|
+
return final;
|
|
138
|
+
}
|
|
135
139
|
if (typeof objectString[key] === 'string') {
|
|
136
140
|
return final.push(`${key}: "${escapeMablscriptString(objectString[key])}"`);
|
|
137
141
|
}
|
|
@@ -14,10 +14,8 @@ class ConditionAction extends MablAction_1.MablAction {
|
|
|
14
14
|
setConditionAttributes() {
|
|
15
15
|
const conditionActionArgs = this.getActionArgs();
|
|
16
16
|
if (conditionActionArgs) {
|
|
17
|
-
[
|
|
18
|
-
this.
|
|
19
|
-
this.conditionValueAttribute,
|
|
20
|
-
] = this.getActionArgs();
|
|
17
|
+
[this.conditionAttribute, this.conditionValueAttribute] =
|
|
18
|
+
this.getActionArgs();
|
|
21
19
|
}
|
|
22
20
|
}
|
|
23
21
|
getConditionDescriptor() {
|
|
@@ -129,7 +129,7 @@ class FindAction extends MablAction_1.MablAction {
|
|
|
129
129
|
case mablscriptFind_1.FindType.FIND_ONE:
|
|
130
130
|
result.selector = find.findTarget.selector;
|
|
131
131
|
if ((_a = find.findTarget.auxiliaryDescriptors) === null || _a === void 0 ? void 0 : _a.length) {
|
|
132
|
-
result.selectorAncestors = find.findTarget.auxiliaryDescriptors.map(descriptor => descriptor.selector);
|
|
132
|
+
result.selectorAncestors = find.findTarget.auxiliaryDescriptors.map((descriptor) => descriptor.selector);
|
|
133
133
|
}
|
|
134
134
|
break;
|
|
135
135
|
default:
|
|
@@ -165,14 +165,14 @@ class FindAction extends MablAction_1.MablAction {
|
|
|
165
165
|
const selectors = ((_a = find.findTarget.auxiliaryDescriptors) === null || _a === void 0 ? void 0 : _a.length) ? '[' +
|
|
166
166
|
[
|
|
167
167
|
find.findTarget.selector,
|
|
168
|
-
...find.findTarget.auxiliaryDescriptors.map(descriptor => descriptor.selector),
|
|
168
|
+
...find.findTarget.auxiliaryDescriptors.map((descriptor) => descriptor.selector),
|
|
169
169
|
]
|
|
170
170
|
.map(buildElementSelectorString)
|
|
171
171
|
.join(', ') +
|
|
172
172
|
']'
|
|
173
173
|
: buildElementSelectorString(find.findTarget.selector);
|
|
174
174
|
const options = buildFindOptionsString(find.findOptions);
|
|
175
|
-
const args = [selectors, options].filter(str => str).join(', ');
|
|
175
|
+
const args = [selectors, options].filter((str) => str).join(', ');
|
|
176
176
|
return `${action}(${args})`;
|
|
177
177
|
}
|
|
178
178
|
case mablscriptFind_1.FindType.FIND_FIRST:
|
|
@@ -233,7 +233,7 @@ function buildFindOptionsString(findOptions) {
|
|
|
233
233
|
}
|
|
234
234
|
function buildElementSelectorString(selectorObject) {
|
|
235
235
|
const findInfoList = MablStep_1.buildObjectString(selectorObject);
|
|
236
|
-
if (!findInfoList.find(info => info.includes('selector_type'))) {
|
|
236
|
+
if (!findInfoList.find((info) => info.includes('selector_type'))) {
|
|
237
237
|
findInfoList.push('selector_type: "element"');
|
|
238
238
|
}
|
|
239
239
|
findInfoList.sort();
|
package/mablscript/importer.js
CHANGED
|
@@ -50,6 +50,7 @@ const ClickAndHoldStep_1 = require("./steps/ClickAndHoldStep");
|
|
|
50
50
|
const ReleaseStep_1 = require("./steps/ReleaseStep");
|
|
51
51
|
const CountAction_1 = require("./actions/CountAction");
|
|
52
52
|
const loggingProvider_1 = require("../providers/logging/loggingProvider");
|
|
53
|
+
const AccessibilityCheck_1 = require("./steps/AccessibilityCheck");
|
|
53
54
|
const ActionTypes = [
|
|
54
55
|
AwaitDownloadAction_1.AwaitDownloadAction,
|
|
55
56
|
AwaitPDFDownloadAction_1.AwaitPDFDownloadAction,
|
|
@@ -64,6 +65,7 @@ const ActionTypes = [
|
|
|
64
65
|
JavaScriptAction_1.JavaScriptAction,
|
|
65
66
|
];
|
|
66
67
|
const StepTypes = [
|
|
68
|
+
AccessibilityCheck_1.AccessibilityCheckStep,
|
|
67
69
|
AssertStep_1.AssertStep,
|
|
68
70
|
AssertStepOld_1.AssertStepOld,
|
|
69
71
|
AwaitTabStep_1.AwaitTabStep,
|
|
@@ -129,12 +131,12 @@ function parseMablScript(mablscript) {
|
|
|
129
131
|
}
|
|
130
132
|
exports.parseMablScript = parseMablScript;
|
|
131
133
|
const rawMablscriptToObjectsStepMap = {};
|
|
132
|
-
StepTypes.forEach(step => {
|
|
133
|
-
step.mablScriptStepNames.forEach(name => (rawMablscriptToObjectsStepMap[name] = step));
|
|
134
|
+
StepTypes.forEach((step) => {
|
|
135
|
+
step.mablScriptStepNames.forEach((name) => (rawMablscriptToObjectsStepMap[name] = step));
|
|
134
136
|
});
|
|
135
137
|
const rawMablscriptToObjectsActionsMap = {};
|
|
136
|
-
ActionTypes.forEach(step => {
|
|
137
|
-
step.mablScriptStepNames.forEach(name => (rawMablscriptToObjectsActionsMap[name] = step));
|
|
138
|
+
ActionTypes.forEach((step) => {
|
|
139
|
+
step.mablScriptStepNames.forEach((name) => (rawMablscriptToObjectsActionsMap[name] = step));
|
|
138
140
|
});
|
|
139
141
|
function loadMablScriptIntoSteps(parsedMablscript) {
|
|
140
142
|
return Object.entries(parsedMablscript).map(([stepIndexString, [...parsed]]) => {
|
|
@@ -158,17 +160,17 @@ function loadMablScriptIntoSteps(parsedMablscript) {
|
|
|
158
160
|
}
|
|
159
161
|
exports.loadMablScriptIntoSteps = loadMablScriptIntoSteps;
|
|
160
162
|
function yamlifyTheLoadedSteps(translatedSteps, fullLocatorsOn = true) {
|
|
161
|
-
const steps = translatedSteps.map(step => step.getFormattedStep(fullLocatorsOn));
|
|
163
|
+
const steps = translatedSteps.map((step) => step.getFormattedStep(fullLocatorsOn));
|
|
162
164
|
return js_yaml_1.dump(steps);
|
|
163
165
|
}
|
|
164
166
|
exports.yamlifyTheLoadedSteps = yamlifyTheLoadedSteps;
|
|
165
167
|
const yamlMablscriptToObjectsStepMap = {};
|
|
166
|
-
StepTypes.forEach(step => {
|
|
167
|
-
step.yamlMablScriptNames.forEach(name => (yamlMablscriptToObjectsStepMap[name] = step.fromYaml));
|
|
168
|
+
StepTypes.forEach((step) => {
|
|
169
|
+
step.yamlMablScriptNames.forEach((name) => (yamlMablscriptToObjectsStepMap[name] = step.fromYaml));
|
|
168
170
|
});
|
|
169
171
|
function loadYamlSteps(yamlSteps) {
|
|
170
172
|
const loadedStepData = js_yaml_1.safeLoad(yamlSteps);
|
|
171
|
-
return loadedStepData.map(stepObject => {
|
|
173
|
+
return loadedStepData.map((stepObject) => {
|
|
172
174
|
const stepName = Object.keys(stepObject)[0];
|
|
173
175
|
const stepArgs = stepObject[stepName];
|
|
174
176
|
const isStepDisabled = stepObject[stepName].disabled;
|
|
@@ -196,7 +198,7 @@ function getMablscriptMaybeWithComment(step) {
|
|
|
196
198
|
return `${step.isDisabled() ? '//' : ''}${step.toMablscript()}`;
|
|
197
199
|
}
|
|
198
200
|
function mablscriptTheLoadedSteps(translatedSteps) {
|
|
199
|
-
const steps = translatedSteps.map(step => getMablscriptMaybeWithComment(step));
|
|
201
|
+
const steps = translatedSteps.map((step) => getMablscriptMaybeWithComment(step));
|
|
200
202
|
return steps.join('\n');
|
|
201
203
|
}
|
|
202
204
|
exports.mablscriptTheLoadedSteps = mablscriptTheLoadedSteps;
|
|
@@ -224,7 +226,7 @@ function getNameFromCallee(expression) {
|
|
|
224
226
|
}
|
|
225
227
|
function getArgumentsFromCallExpressionArgs(expressionArguments) {
|
|
226
228
|
const expressionArgs = [];
|
|
227
|
-
expressionArguments.forEach(expressionArg => {
|
|
229
|
+
expressionArguments.forEach((expressionArg) => {
|
|
228
230
|
switch (expressionArg.type) {
|
|
229
231
|
case 'ArrayExpression':
|
|
230
232
|
const arrayExpression = expressionArg;
|
|
@@ -272,9 +274,9 @@ function memberExpressionChainBuilder(memberExpression) {
|
|
|
272
274
|
function parseObjectExpression(expression) {
|
|
273
275
|
const finalObj = {};
|
|
274
276
|
expression.properties
|
|
275
|
-
.filter(property => !!property.value)
|
|
276
|
-
.map(property => property)
|
|
277
|
-
.forEach(property => {
|
|
277
|
+
.filter((property) => !!property.value)
|
|
278
|
+
.map((property) => property)
|
|
279
|
+
.forEach((property) => {
|
|
278
280
|
let key;
|
|
279
281
|
let value;
|
|
280
282
|
switch (property.value.type) {
|
|
@@ -317,7 +319,7 @@ function parseObjectExpression(expression) {
|
|
|
317
319
|
}
|
|
318
320
|
function parseArrayExpression(arrayExpression) {
|
|
319
321
|
let arrayArgs = [];
|
|
320
|
-
arrayExpression.elements.forEach(element => {
|
|
322
|
+
arrayExpression.elements.forEach((element) => {
|
|
321
323
|
arrayArgs = [
|
|
322
324
|
...arrayArgs,
|
|
323
325
|
...getArgumentsFromCallExpressionArgs([element]),
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccessibilityCheckStep = void 0;
|
|
4
|
+
const MablStep_1 = require("../MablStep");
|
|
5
|
+
const FindAction_1 = require("../actions/FindAction");
|
|
6
|
+
const ActionsUtils_1 = require("./ActionsUtils");
|
|
7
|
+
const mablscriptFind_1 = require("../../mablscriptFind");
|
|
8
|
+
class AccessibilityCheckStep extends MablStep_1.MablStep {
|
|
9
|
+
constructor(name, args, actions) {
|
|
10
|
+
super(name, args, actions);
|
|
11
|
+
if (this.actions.length) {
|
|
12
|
+
this.findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(this.actions);
|
|
13
|
+
}
|
|
14
|
+
this.checkConfig =
|
|
15
|
+
this.getActionArgs()[0];
|
|
16
|
+
}
|
|
17
|
+
getStepName() {
|
|
18
|
+
return AccessibilityCheckStep.yamlMablScriptNames[0];
|
|
19
|
+
}
|
|
20
|
+
toStepDescriptor() {
|
|
21
|
+
var _a, _b, _c;
|
|
22
|
+
if (this.findAction) {
|
|
23
|
+
const find = this.findAction.toDescriptor();
|
|
24
|
+
switch (find.findType) {
|
|
25
|
+
case mablscriptFind_1.FindType.FIND_FIRST:
|
|
26
|
+
case mablscriptFind_1.FindType.FIND_LAST:
|
|
27
|
+
case mablscriptFind_1.FindType.FIND_ANY:
|
|
28
|
+
case mablscriptFind_1.FindType.FIND_ONE:
|
|
29
|
+
return {
|
|
30
|
+
...this.checkConfig,
|
|
31
|
+
find,
|
|
32
|
+
descriptorToActionMap: new Map().set(find, this),
|
|
33
|
+
};
|
|
34
|
+
default:
|
|
35
|
+
throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
tags: (_a = this.checkConfig) === null || _a === void 0 ? void 0 : _a.tags,
|
|
40
|
+
rules: (_b = this.checkConfig) === null || _b === void 0 ? void 0 : _b.rules,
|
|
41
|
+
disabledRules: (_c = this.checkConfig) === null || _c === void 0 ? void 0 : _c.disabledRules,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
getFormattedStep(_fullLocatorsOn) {
|
|
45
|
+
if (this.findAction) {
|
|
46
|
+
return {
|
|
47
|
+
AccessibilityCheck: {
|
|
48
|
+
...super.annotationsAsYml(),
|
|
49
|
+
...this.findAction.toYaml(),
|
|
50
|
+
...this.checkConfig,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
AccessibilityCheck: {
|
|
56
|
+
...super.annotationsAsYml(),
|
|
57
|
+
...this.checkConfig,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
static fromYaml(_stepName, stepArgs) {
|
|
62
|
+
const actions = [];
|
|
63
|
+
if (stepArgs.selector) {
|
|
64
|
+
actions.push(FindAction_1.FindAction.findActionFromStepArgs(stepArgs));
|
|
65
|
+
}
|
|
66
|
+
const checkConfig = {
|
|
67
|
+
tags: stepArgs.tags,
|
|
68
|
+
rules: stepArgs.rules,
|
|
69
|
+
disabledRules: stepArgs.disabledRules,
|
|
70
|
+
};
|
|
71
|
+
return new AccessibilityCheckStep(AccessibilityCheckStep.mablScriptStepNames[0], [checkConfig], actions);
|
|
72
|
+
}
|
|
73
|
+
toMablscript() {
|
|
74
|
+
var _a, _b, _c;
|
|
75
|
+
let argString = '';
|
|
76
|
+
if (((_a = this.checkConfig) === null || _a === void 0 ? void 0 : _a.tags) || ((_b = this.checkConfig) === null || _b === void 0 ? void 0 : _b.disabledRules) || ((_c = this.checkConfig) === null || _c === void 0 ? void 0 : _c.rules)) {
|
|
77
|
+
argString = `{${MablStep_1.buildObjectString(this.checkConfig)}}`;
|
|
78
|
+
}
|
|
79
|
+
let findAction = '';
|
|
80
|
+
if (this.findAction) {
|
|
81
|
+
findAction = `${this.findAction.toMablscript()}.`;
|
|
82
|
+
}
|
|
83
|
+
return `${findAction}${AccessibilityCheckStep.mablScriptStepNames[0]}(${argString})`;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.AccessibilityCheckStep = AccessibilityCheckStep;
|
|
87
|
+
AccessibilityCheckStep.mablScriptStepNames = ['accessibility_check'];
|
|
88
|
+
AccessibilityCheckStep.yamlMablScriptNames = ['AccessibilityCheck'];
|
|
@@ -62,11 +62,11 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
62
62
|
this.assertionType = this.conditionAction.conditionAttribute;
|
|
63
63
|
this.assertionValue = this.conditionAction.conditionValueAttribute;
|
|
64
64
|
this.isWaitUntilStep = this.determineIfWaitUntilStep();
|
|
65
|
-
|
|
66
|
-
args[0]
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
const assertArguments = args[0] && typeof args[0] === 'object'
|
|
66
|
+
? args[0]
|
|
67
|
+
: undefined;
|
|
68
|
+
this.continueOnFailure = (assertArguments === null || assertArguments === void 0 ? void 0 : assertArguments.onFailure) === 'continue';
|
|
69
|
+
this.observationScope = assertArguments === null || assertArguments === void 0 ? void 0 : assertArguments.observationScope;
|
|
70
70
|
}
|
|
71
71
|
validate() {
|
|
72
72
|
if (!(this.actions.length === 2 || this.actions.length === 3) &&
|
|
@@ -109,6 +109,7 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
109
109
|
conditionDescriptor: this.conditionAction.conditionDescriptor,
|
|
110
110
|
countDescriptor: (_b = this.countAction) === null || _b === void 0 ? void 0 : _b.countDescriptor,
|
|
111
111
|
continueOnFailure: this.continueOnFailure,
|
|
112
|
+
observationScope: this.observationScope,
|
|
112
113
|
descriptorToActionMap,
|
|
113
114
|
};
|
|
114
115
|
}
|
|
@@ -129,7 +129,7 @@ class CreateVariableStep extends MablStep_1.MablStep {
|
|
|
129
129
|
generator: step.generator,
|
|
130
130
|
name: this.variableName,
|
|
131
131
|
selector: step.generator.find.findTarget.selector,
|
|
132
|
-
selectorAncestors: ((_a = step.generator.find.findTarget.auxiliaryDescriptors) !== null && _a !== void 0 ? _a : []).map(descriptor => descriptor.selector),
|
|
132
|
+
selectorAncestors: ((_a = step.generator.find.findTarget.auxiliaryDescriptors) !== null && _a !== void 0 ? _a : []).map((descriptor) => descriptor.selector),
|
|
133
133
|
};
|
|
134
134
|
break;
|
|
135
135
|
case CreateVariableStepDescriptor_1.VariableGenerator.JAVASCRIPT:
|
|
@@ -165,8 +165,7 @@ class CreateVariableStep extends MablStep_1.MablStep {
|
|
|
165
165
|
seleniumStep.value = this.variableName;
|
|
166
166
|
return [seleniumStep];
|
|
167
167
|
case CreateVariableStepDescriptor_1.VariableGenerator.PATTERN:
|
|
168
|
-
const generateString = this
|
|
169
|
-
.actions[0].generateString;
|
|
168
|
+
const generateString = this.actions[0].generateString;
|
|
170
169
|
const translated = generateString.replace(/{{([^{}]+)}}/g, (_match, p1) => {
|
|
171
170
|
let cleaned = p1;
|
|
172
171
|
if (cleaned[0] === '@') {
|
|
@@ -30,8 +30,7 @@ class DownloadStep extends MablStep_1.MablStep {
|
|
|
30
30
|
toStepDescriptor() {
|
|
31
31
|
const formatted = {};
|
|
32
32
|
if (this.isPDFDownload()) {
|
|
33
|
-
formatted.tabIdentifier = this
|
|
34
|
-
.actions[0].pdfUUID;
|
|
33
|
+
formatted.tabIdentifier = this.actions[0].pdfUUID;
|
|
35
34
|
}
|
|
36
35
|
if (this.fileAttributes.file_name !== undefined) {
|
|
37
36
|
formatted.fileName = this.fileAttributes.file_name;
|
|
@@ -59,7 +59,8 @@ class EnterTextStep extends MablStep_1.MablStep {
|
|
|
59
59
|
if (step.find.findType === mablscriptFind_1.FindType.FIND_ONE) {
|
|
60
60
|
formatted[stepName].selector = step.find.findTarget.selector;
|
|
61
61
|
if ((_a = step.find.findTarget.auxiliaryDescriptors) === null || _a === void 0 ? void 0 : _a.length) {
|
|
62
|
-
formatted[stepName].selectorAncestors =
|
|
62
|
+
formatted[stepName].selectorAncestors =
|
|
63
|
+
step.find.findTarget.auxiliaryDescriptors.map((descriptor) => descriptor.selector);
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
else {
|
|
@@ -14,7 +14,7 @@ const ConditionDescriptor_1 = require("../types/ConditionDescriptor");
|
|
|
14
14
|
class IfConditionStep extends MablStep_1.MablStep {
|
|
15
15
|
constructor(name, args, actions) {
|
|
16
16
|
super(name, args, actions);
|
|
17
|
-
const candidatePrimaryActions = actions.filter(action => action instanceof FindAction_1.FindAction ||
|
|
17
|
+
const candidatePrimaryActions = actions.filter((action) => action instanceof FindAction_1.FindAction ||
|
|
18
18
|
action instanceof GetVariableValue_1.GetVariableValue ||
|
|
19
19
|
action instanceof GetUrlAction_1.GetUrlAction ||
|
|
20
20
|
action instanceof JavaScriptAction_1.JavaScriptAction);
|
|
@@ -25,8 +25,8 @@ class IfConditionStep extends MablStep_1.MablStep {
|
|
|
25
25
|
throw new Error(`At least one primary action is required: Find, Get Url, Get Variable, or Javascript action.`);
|
|
26
26
|
}
|
|
27
27
|
this.primaryAction = candidatePrimaryActions[0];
|
|
28
|
-
this.conditionAction = actions.find(action => action instanceof ConditionAction_1.ConditionAction);
|
|
29
|
-
this.extractAction = actions.find(action => action instanceof ExtractAction_1.ExtractAction);
|
|
28
|
+
this.conditionAction = actions.find((action) => action instanceof ConditionAction_1.ConditionAction);
|
|
29
|
+
this.extractAction = actions.find((action) => action instanceof ExtractAction_1.ExtractAction);
|
|
30
30
|
}
|
|
31
31
|
getStepName() {
|
|
32
32
|
return 'If';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HttpResponseAssertion = exports.SendHttpRequestStep = void 0;
|
|
3
|
+
exports.VariableSource = exports.HttpResponseAssertion = exports.SendHttpRequestStep = void 0;
|
|
4
4
|
const MablStep_1 = require("../MablStep");
|
|
5
5
|
const AssertStep_1 = require("./AssertStep");
|
|
6
6
|
const ConditionDescriptor_1 = require("../types/ConditionDescriptor");
|
|
@@ -17,7 +17,7 @@ class SendHttpRequestStep extends MablStep_1.MablStep {
|
|
|
17
17
|
toStepDescriptor() {
|
|
18
18
|
const formatted = JSON.parse(JSON.stringify(this.sendRequest));
|
|
19
19
|
if (formatted.assertions) {
|
|
20
|
-
formatted.assertions = formatted.assertions.map(assertion => ({
|
|
20
|
+
formatted.assertions = formatted.assertions.map((assertion) => ({
|
|
21
21
|
...assertion,
|
|
22
22
|
assertion: evalAssertionType[assertion.assertion],
|
|
23
23
|
}));
|
|
@@ -28,7 +28,7 @@ class SendHttpRequestStep extends MablStep_1.MablStep {
|
|
|
28
28
|
var _a;
|
|
29
29
|
const formatted = stepArgs;
|
|
30
30
|
if (formatted.assertions) {
|
|
31
|
-
formatted.assertions = (_a = formatted.assertions) === null || _a === void 0 ? void 0 : _a.map(assertion => ({
|
|
31
|
+
formatted.assertions = (_a = formatted.assertions) === null || _a === void 0 ? void 0 : _a.map((assertion) => ({
|
|
32
32
|
...assertion,
|
|
33
33
|
assertion: AssertStep_1.assertionStepToField[`Assert${assertion.assertion}`],
|
|
34
34
|
}));
|
|
@@ -55,3 +55,11 @@ var HttpResponseAssertion;
|
|
|
55
55
|
}
|
|
56
56
|
HttpResponseAssertion.toComparisonDescriptor = toComparisonDescriptor;
|
|
57
57
|
})(HttpResponseAssertion = exports.HttpResponseAssertion || (exports.HttpResponseAssertion = {}));
|
|
58
|
+
var VariableSource;
|
|
59
|
+
(function (VariableSource) {
|
|
60
|
+
VariableSource["Body"] = "body";
|
|
61
|
+
VariableSource["Header"] = "header";
|
|
62
|
+
VariableSource["Json"] = "json";
|
|
63
|
+
VariableSource["Response"] = "response";
|
|
64
|
+
VariableSource["Status"] = "status";
|
|
65
|
+
})(VariableSource = exports.VariableSource || (exports.VariableSource = {}));
|
|
@@ -84,7 +84,7 @@ class SendKeyStep extends MablStep_1.MablStep {
|
|
|
84
84
|
const seleniumStep = SeleniumIdeStep_1.buildSeleniumIdeStep('sendKeys', this);
|
|
85
85
|
seleniumStep.target = this.findAction.getSelIdeTarget();
|
|
86
86
|
seleniumStep.value = this.keys
|
|
87
|
-
.map(keyPress => {
|
|
87
|
+
.map((keyPress) => {
|
|
88
88
|
if (Object.keys(SEL_IDE_KEYS).includes(keyPress.key)) {
|
|
89
89
|
return `\${${SEL_IDE_KEYS[keyPress.key]}}`;
|
|
90
90
|
}
|
|
@@ -100,7 +100,7 @@ class SendKeyStep extends MablStep_1.MablStep {
|
|
|
100
100
|
}
|
|
101
101
|
toMablscript() {
|
|
102
102
|
const keysToSend = this.keys
|
|
103
|
-
.map(key => this.convertObjectToMablscriptArgs(key))
|
|
103
|
+
.map((key) => this.convertObjectToMablscriptArgs(key))
|
|
104
104
|
.join(', ');
|
|
105
105
|
return `${this.findAction.toMablscript()}.send_keys(${keysToSend})`;
|
|
106
106
|
}
|
|
@@ -51,7 +51,7 @@ class SetFilesStep extends MablStep_1.MablStep {
|
|
|
51
51
|
}
|
|
52
52
|
toMablscript() {
|
|
53
53
|
const files = this.files
|
|
54
|
-
.map(key => this.convertObjectToMablscriptArgs(key))
|
|
54
|
+
.map((key) => this.convertObjectToMablscriptArgs(key))
|
|
55
55
|
.join(', ');
|
|
56
56
|
return `${this.findAction.toMablscript()}.set_files(${files})`;
|
|
57
57
|
}
|
|
@@ -80,7 +80,8 @@ class SwitchContextStep extends MablStep_1.MablStep {
|
|
|
80
80
|
if (SwitchContextStepDescriptor_1.isSwitchFrame(step)) {
|
|
81
81
|
formatted[stepName].selector = step.frame.findTarget.selector;
|
|
82
82
|
if ((_a = step.frame.findTarget.auxiliaryDescriptors) === null || _a === void 0 ? void 0 : _a.length) {
|
|
83
|
-
formatted[stepName].selectorAncestors =
|
|
83
|
+
formatted[stepName].selectorAncestors =
|
|
84
|
+
step.frame.findTarget.auxiliaryDescriptors.map((descriptor) => descriptor.selector);
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
if (SwitchContextStepDescriptor_1.isSwitchRoot(step) && step.frame === 'root') {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAccessibilityCheckResult = void 0;
|
|
4
|
+
function isAccessibilityCheckResult(value) {
|
|
5
|
+
return (value &&
|
|
6
|
+
typeof value === 'object' &&
|
|
7
|
+
typeof value.axeCoreResults === 'object');
|
|
8
|
+
}
|
|
9
|
+
exports.isAccessibilityCheckResult = isAccessibilityCheckResult;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isSimpleObject = exports.isVariableDataType = void 0;
|
|
4
4
|
function isVariableDataType(value) {
|
|
5
5
|
if (value === null ||
|
|
6
6
|
value === undefined ||
|
|
@@ -26,10 +26,3 @@ function isSimpleObject(value) {
|
|
|
26
26
|
return Object.prototype.constructor === value.constructor;
|
|
27
27
|
}
|
|
28
28
|
exports.isSimpleObject = isSimpleObject;
|
|
29
|
-
function variableDataToString(value) {
|
|
30
|
-
if (typeof value !== 'object') {
|
|
31
|
-
return '' + value;
|
|
32
|
-
}
|
|
33
|
-
return JSON.stringify(value);
|
|
34
|
-
}
|
|
35
|
-
exports.variableDataToString = variableDataToString;
|
|
@@ -7,7 +7,7 @@ function isVariableNamespace(value) {
|
|
|
7
7
|
typeof value === 'object' &&
|
|
8
8
|
!Array.isArray(value) &&
|
|
9
9
|
VariableDataType_1.isSimpleObject(value) &&
|
|
10
|
-
Object.keys(value).every(key => key) &&
|
|
10
|
+
Object.keys(value).every((key) => key) &&
|
|
11
11
|
Object.values(value).every(VariableDataType_1.isVariableDataType));
|
|
12
12
|
}
|
|
13
13
|
exports.isVariableNamespace = isVariableNamespace;
|