@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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mablhq/mabl-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.14",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "The official mabl command line interface tool",
|
|
6
6
|
"main": "index.js",
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"postinstall": "node ./util/postInstallMessage.js"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@playwright/test": "1.
|
|
28
|
+
"@playwright/test": "1.17.1",
|
|
29
|
+
"playwright-core": "1.17.1",
|
|
29
30
|
"@types/fs-extra": "^8.1.0",
|
|
30
31
|
"@types/serve-handler": "^6.1.0",
|
|
31
32
|
"@types/tmp": "^0.2.0",
|
|
@@ -34,9 +35,10 @@
|
|
|
34
35
|
"anyproxy": "^4.1.3",
|
|
35
36
|
"async-mutex": "^0.3.1",
|
|
36
37
|
"async-retry": "1.3.3",
|
|
38
|
+
"axe-core": "4.3.3",
|
|
37
39
|
"axios": "^0.21.1",
|
|
38
|
-
"axios-cookiejar-support": "
|
|
39
|
-
"chalk": "
|
|
40
|
+
"axios-cookiejar-support": "1.0.1",
|
|
41
|
+
"chalk": "2.4.2",
|
|
40
42
|
"change-case": "^4.1.1",
|
|
41
43
|
"chrome-launcher": "^0.13.1",
|
|
42
44
|
"cli-table3": "^0.5.1",
|
|
@@ -46,6 +48,7 @@
|
|
|
46
48
|
"env-paths": "^2.2.0",
|
|
47
49
|
"esprima": "^4.0.1",
|
|
48
50
|
"estraverse": "^4.3.0",
|
|
51
|
+
"fastest-levenshtein": "^1.0.10",
|
|
49
52
|
"fs-extra": "^8.1.0",
|
|
50
53
|
"git-repo-info": "^2.1.1",
|
|
51
54
|
"glob": "^7.1.4",
|
|
@@ -59,7 +62,7 @@
|
|
|
59
62
|
"markdown-table": "^2.0.0",
|
|
60
63
|
"mime-types": "^2.1.26",
|
|
61
64
|
"mochawesome-report-generator": "^5.2.0",
|
|
62
|
-
"moment": "
|
|
65
|
+
"moment": "2.26.0",
|
|
63
66
|
"moment-duration-format": "^2.3.2",
|
|
64
67
|
"newman": "5.2.3",
|
|
65
68
|
"open": "^6.4.0",
|
package/popupDismissal/index.js
CHANGED
|
@@ -51,7 +51,7 @@ function getEffectiveZIndex(element) {
|
|
|
51
51
|
function getDescendantElements(childElement) {
|
|
52
52
|
let children = [childElement];
|
|
53
53
|
const childNodes = Array.from(childElement.children);
|
|
54
|
-
childNodes.forEach(el => {
|
|
54
|
+
childNodes.forEach((el) => {
|
|
55
55
|
children = children.concat(getDescendantElements(el));
|
|
56
56
|
});
|
|
57
57
|
return children;
|
|
@@ -65,8 +65,8 @@ function matchWithWordBoundary(attribute, matchVal) {
|
|
|
65
65
|
}
|
|
66
66
|
function checkElementAttributes(element) {
|
|
67
67
|
let matches = 0;
|
|
68
|
-
ATTRIBUTES_TO_CHECK.forEach(attr => {
|
|
69
|
-
CLOSE_VALUES.forEach(closeVal => {
|
|
68
|
+
ATTRIBUTES_TO_CHECK.forEach((attr) => {
|
|
69
|
+
CLOSE_VALUES.forEach((closeVal) => {
|
|
70
70
|
if (element.getAttribute(attr.attributeName) &&
|
|
71
71
|
attr.matchFunction(element.getAttribute(attr.attributeName), closeVal)) {
|
|
72
72
|
matches += 1;
|
|
@@ -87,10 +87,10 @@ function checkElementDomCoverage(element) {
|
|
|
87
87
|
}
|
|
88
88
|
function developCloseCandidates(candidates) {
|
|
89
89
|
const candidatesByZIndex = [];
|
|
90
|
-
candidates.forEach(candidate => {
|
|
90
|
+
candidates.forEach((candidate) => {
|
|
91
91
|
const domCovering = [];
|
|
92
92
|
const actionableElements = [];
|
|
93
|
-
candidate.elements.forEach(element => {
|
|
93
|
+
candidate.elements.forEach((element) => {
|
|
94
94
|
var _a, _b;
|
|
95
95
|
if ((_a = element) === null || _a === void 0 ? void 0 : _a.offsetParent) {
|
|
96
96
|
if (['BUTTON', 'A', 'DIV'].includes((_b = element.tagName) === null || _b === void 0 ? void 0 : _b.toUpperCase()) &&
|
|
@@ -139,11 +139,11 @@ function elementsInFront(element, pointX, pointY) {
|
|
|
139
139
|
const x = pointX !== undefined ? pointX : getBoundingClientRectWithXY(element).x;
|
|
140
140
|
const y = pointY !== undefined ? pointY : getBoundingClientRectWithXY(element).y;
|
|
141
141
|
const elementsAtPoint = document.elementsFromPoint(x, y);
|
|
142
|
-
const targetIndex = elementsAtPoint.findIndex(iterElement => iterElement === element);
|
|
142
|
+
const targetIndex = elementsAtPoint.findIndex((iterElement) => iterElement === element);
|
|
143
143
|
return targetIndex ? elementsAtPoint.slice(0, targetIndex) : [];
|
|
144
144
|
}
|
|
145
145
|
function sleep(time) {
|
|
146
|
-
return new Promise(resolve => setTimeout(resolve, time));
|
|
146
|
+
return new Promise((resolve) => setTimeout(resolve, time));
|
|
147
147
|
}
|
|
148
148
|
function getBoundingClientRectWithXY(element) {
|
|
149
149
|
const rect = element.getBoundingClientRect();
|
|
@@ -178,11 +178,8 @@ async function detectAndDismissPopupCandidates(element) {
|
|
|
178
178
|
const elementsInFrontCount = higherElements.length;
|
|
179
179
|
if (elementsInFrontCount === 0) {
|
|
180
180
|
return {
|
|
181
|
-
zIndex: 0,
|
|
182
181
|
elementsInFront: 0,
|
|
183
182
|
dismissedStatus: false,
|
|
184
|
-
domCovering: [],
|
|
185
|
-
actionableElements: [],
|
|
186
183
|
};
|
|
187
184
|
}
|
|
188
185
|
const clickCandidates = async function (candidates, leftEdgeClick) {
|
|
@@ -204,8 +201,10 @@ async function detectAndDismissPopupCandidates(element) {
|
|
|
204
201
|
matched = await clickCandidates(candidate.actionableElements, false);
|
|
205
202
|
}
|
|
206
203
|
if (matched) {
|
|
207
|
-
|
|
208
|
-
|
|
204
|
+
return {
|
|
205
|
+
dismissedStatus: true,
|
|
206
|
+
elementsInFront: 0,
|
|
207
|
+
};
|
|
209
208
|
}
|
|
210
209
|
}
|
|
211
210
|
higherElements = elementsInFront(element, elementBoundingBox.x, elementBoundingBox.y);
|
|
@@ -222,16 +221,16 @@ async function detectAndDismissPopupCandidates(element) {
|
|
|
222
221
|
};
|
|
223
222
|
result.elementsInFront = higherElements.length;
|
|
224
223
|
result.dismissedStatus = false;
|
|
225
|
-
return
|
|
224
|
+
return {
|
|
225
|
+
dismissedStatus: result.dismissedStatus,
|
|
226
|
+
elementsInFront: result.elementsInFront,
|
|
227
|
+
};
|
|
226
228
|
}
|
|
227
229
|
catch (error) {
|
|
228
230
|
return {
|
|
229
|
-
zIndex: 0,
|
|
230
231
|
elementsInFront: 0,
|
|
231
232
|
dismissedStatus: false,
|
|
232
|
-
|
|
233
|
-
actionableElements: [],
|
|
234
|
-
errorInDetection: error.toString(),
|
|
233
|
+
error: error.toString(),
|
|
235
234
|
};
|
|
236
235
|
}
|
|
237
236
|
}
|
|
@@ -30,8 +30,7 @@ class AuthenticationProvider {
|
|
|
30
30
|
this.oktaClient = new OktaClient_1.OktaClient(client);
|
|
31
31
|
}
|
|
32
32
|
async getAuthConfigWithAutoRenew() {
|
|
33
|
-
let authConfig = cliConfigProvider_1.CliConfigProvider.getCliConfig()
|
|
34
|
-
.authentication;
|
|
33
|
+
let authConfig = cliConfigProvider_1.CliConfigProvider.getCliConfig().authentication;
|
|
35
34
|
if (authConfig.accessToken) {
|
|
36
35
|
if (this.verbose) {
|
|
37
36
|
loggingProvider_1.logger.info('Found existing access token');
|
|
@@ -134,7 +133,7 @@ class AuthenticationProvider {
|
|
|
134
133
|
async authenticate() {
|
|
135
134
|
var _a;
|
|
136
135
|
try {
|
|
137
|
-
const { codeChallenge, codeVerifier
|
|
136
|
+
const { codeChallenge, codeVerifier } = this.oktaClient.generateCodeChallenge();
|
|
138
137
|
const redirectUri = `${env_1.BASE_APP_URL}/app-code`;
|
|
139
138
|
const authUrl = this.oktaClient.buildAuthorizationUrl(codeChallenge, redirectUri);
|
|
140
139
|
loggingProvider_1.logger.info(`Your browser has been opened to the following URL for obtaining an authorization code:
|
|
@@ -103,7 +103,7 @@ class CliConfigProvider {
|
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
105
|
static clearAuthConfig() {
|
|
106
|
-
AUTH_KEY_NAMES.forEach(keyName => clearValue(keyName));
|
|
106
|
+
AUTH_KEY_NAMES.forEach((keyName) => clearValue(keyName));
|
|
107
107
|
return this.getCliConfig();
|
|
108
108
|
}
|
|
109
109
|
static setCliConfig(config) {
|
|
@@ -69,7 +69,7 @@ class ExportRequestProvider {
|
|
|
69
69
|
return new Promise((resolve, reject) => {
|
|
70
70
|
setTimeout(() => this.awaitCompletion()
|
|
71
71
|
.then(() => resolve())
|
|
72
|
-
.catch(error => reject(error)), this.pollingIntervalMilliseconds);
|
|
72
|
+
.catch((error) => reject(error)), this.pollingIntervalMilliseconds);
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -60,11 +60,11 @@ class CliTransport extends winston_transport_1.default {
|
|
|
60
60
|
}
|
|
61
61
|
exports.logger = winston.createLogger({
|
|
62
62
|
level: defaultEnv_1.CONSOLE_LOGGING_LEVEL,
|
|
63
|
-
format: winston.format.printf(info => `${stripAnsi(info.message)}`),
|
|
63
|
+
format: winston.format.printf((info) => `${stripAnsi(info.message)}`),
|
|
64
64
|
defaultMeta: { service: 'mabl-cli' },
|
|
65
65
|
transports: [
|
|
66
66
|
new CliTransport({
|
|
67
|
-
format: winston.format.printf(info => { var _a; return `${(_a = info.message) !== null && _a !== void 0 ? _a : info[MESSAGE]}`; }),
|
|
67
|
+
format: winston.format.printf((info) => { var _a; return `${(_a = info.message) !== null && _a !== void 0 ? _a : info[MESSAGE]}`; }),
|
|
68
68
|
}),
|
|
69
69
|
],
|
|
70
70
|
});
|
|
@@ -85,12 +85,16 @@ function generateMochAwesomeReportFromTestResults(testResults, reportOptions) {
|
|
|
85
85
|
exports.generateMochAwesomeReportFromTestResults = generateMochAwesomeReportFromTestResults;
|
|
86
86
|
function generatePlainSuiteFromTestResults(testResults) {
|
|
87
87
|
const parentId = uuid_1.v4();
|
|
88
|
-
const plainTests = testResults.testResults.map(testResult => generatePlainTestForTestRun(parentId, testResult));
|
|
89
|
-
const passes = plainTests
|
|
90
|
-
|
|
88
|
+
const plainTests = testResults.testResults.map((testResult) => generatePlainTestForTestRun(parentId, testResult));
|
|
89
|
+
const passes = plainTests
|
|
90
|
+
.filter((test) => test.pass)
|
|
91
|
+
.map((test) => test.uuid);
|
|
92
|
+
const failures = plainTests
|
|
93
|
+
.filter((test) => test.fail)
|
|
94
|
+
.map((test) => test.uuid);
|
|
91
95
|
const skipped = plainTests
|
|
92
|
-
.filter(test => test.skipped)
|
|
93
|
-
.map(test => test.uuid);
|
|
96
|
+
.filter((test) => test.skipped)
|
|
97
|
+
.map((test) => test.uuid);
|
|
94
98
|
const command = constructTestRunCommand();
|
|
95
99
|
return {
|
|
96
100
|
uuid: parentId,
|
|
@@ -160,7 +164,7 @@ function getTestState(testResultStatus) {
|
|
|
160
164
|
function constructTestRunCommand() {
|
|
161
165
|
try {
|
|
162
166
|
const processArgs = process.argv;
|
|
163
|
-
const testArgIndex = processArgs.findIndex(arg => arg === 'tests');
|
|
167
|
+
const testArgIndex = processArgs.findIndex((arg) => arg === 'tests');
|
|
164
168
|
if (testArgIndex) {
|
|
165
169
|
processArgs.splice(0, testArgIndex + 1);
|
|
166
170
|
}
|
package/reporters/reporter.js
CHANGED
|
@@ -29,7 +29,7 @@ exports.handleReportingForTestsRun = handleReportingForTestsRun;
|
|
|
29
29
|
function parseOutReportOptions(suppliedOptions) {
|
|
30
30
|
const reporterOptions = {};
|
|
31
31
|
const pairs = suppliedOptions.split(',');
|
|
32
|
-
pairs.forEach(pair => {
|
|
32
|
+
pairs.forEach((pair) => {
|
|
33
33
|
const [key, value] = pair.split('=', 3);
|
|
34
34
|
if (value.toLowerCase() === 'false' || value.toLowerCase() === 'true') {
|
|
35
35
|
reporterOptions[key] = value.toLowerCase() === 'true';
|