@mablhq/mabl-cli 1.12.24 → 1.12.33
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 +1 -1
- package/api/mablApiClient.js +9 -9
- package/auth/AuthClient.js +1 -4
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +2 -2
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +25 -11
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +24 -17
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +19 -19
- package/browserLauncher/playwrightBrowserLauncher/wrappers.js +1 -1
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerBrowser.js +3 -3
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerElementHandle.js +6 -6
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerFrame.js +7 -7
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerHttpRequest.js +1 -1
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerHttpResponse.js +1 -1
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerJsHandle.js +3 -3
- package/browserLauncher/puppeteerBrowserLauncher/puppeteerPage.js +23 -16
- package/browserLauncher/puppeteerBrowserLauncher/wrappers.js +1 -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 +10 -17
- 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 +6 -6
- package/commands/tests/tests_cmds/run-legacy.js +2 -2
- package/commands/tests/tests_cmds/run.js +4 -4
- 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/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 +2 -2
- 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 +6 -5
- package/popupDismissal/index.js +7 -7
- 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/util/RichPromise.js +2 -2
- package/util/actionabilityUtil.js +5 -3
- 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 +14 -1
- package/core/trainer/trainerBrowserUtil.js +0 -33
package/util/RichPromise.js
CHANGED
|
@@ -41,7 +41,9 @@ async function checkActionabilityAtWithRetries(elementHandle, executionContext,
|
|
|
41
41
|
if (failIfClickablePointWasNotFound && error === NO_CLICKABLE_POINT_ERROR) {
|
|
42
42
|
throw new Error('Unable to find a clickable point for the element');
|
|
43
43
|
}
|
|
44
|
-
logUtils_1.logWebUIAndCliOutput(`Found element may not be actionable`, loggingProvider_1.LogLevel.Warn, executionContext, {
|
|
44
|
+
logUtils_1.logWebUIAndCliOutput(`Found element may not be actionable`, loggingProvider_1.LogLevel.Warn, executionContext, {
|
|
45
|
+
executionPhase: messaging_1.ExecutionPhase.DURING_ACTION,
|
|
46
|
+
});
|
|
45
47
|
logUtils_1.logInternal(`Found element might not be actionable at the expected point (x: ${(_b = (_a = actionabilityResult === null || actionabilityResult === void 0 ? void 0 : actionabilityResult.clickablePoint) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 'Not found'}, y: ${(_d = (_c = actionabilityResult === null || actionabilityResult === void 0 ? void 0 : actionabilityResult.clickablePoint) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 'Not found'}), performing action anyway`);
|
|
46
48
|
}
|
|
47
49
|
}
|
|
@@ -84,7 +86,7 @@ async function attemptPopupDismissal(element) {
|
|
|
84
86
|
return false;
|
|
85
87
|
}
|
|
86
88
|
await maybeAddPopupLogic(element);
|
|
87
|
-
const { dismissedStatus, elementsInFront } = await element.evaluate(element => window.popupDismissal.detectAndDismissPopupCandidates(element));
|
|
89
|
+
const { dismissedStatus, elementsInFront } = await element.evaluate((element) => window.popupDismissal.detectAndDismissPopupCandidates(element));
|
|
88
90
|
if (!dismissedStatus) {
|
|
89
91
|
if (elementsInFront) {
|
|
90
92
|
logUtils_1.logInternal('Failed to auto dismiss and there are still elements in front. Sending escape key to body.');
|
|
@@ -92,7 +94,7 @@ async function attemptPopupDismissal(element) {
|
|
|
92
94
|
if (bodyElement) {
|
|
93
95
|
await bodyElement.press('Escape');
|
|
94
96
|
}
|
|
95
|
-
const elementsInFront = await element.evaluate(element => window.popupDismissal.elementsInFrontCount(element));
|
|
97
|
+
const elementsInFront = await element.evaluate((element) => window.popupDismissal.elementsInFrontCount(element));
|
|
96
98
|
if (elementsInFront) {
|
|
97
99
|
logUtils_1.logInternal('The popup did not dismiss using the escape key.');
|
|
98
100
|
return false;
|
package/util/downloadUtil.js
CHANGED
|
@@ -54,7 +54,7 @@ async function getLatestFile(downloadDirectory, filePathSuffix) {
|
|
|
54
54
|
const filesInDownloadDir = await readDirectoryAsync(downloadDirectory);
|
|
55
55
|
let latestFileTime = 0;
|
|
56
56
|
let latestFilePath;
|
|
57
|
-
filesInDownloadDir.forEach(fileName => {
|
|
57
|
+
filesInDownloadDir.forEach((fileName) => {
|
|
58
58
|
const fullPath = `${downloadDirectory}/${fileName}`;
|
|
59
59
|
try {
|
|
60
60
|
const stats = fs.statSync(path.normalize(fullPath));
|
package/util/logUtils.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.logWebUIAndCliOutput = exports.findResultSeverityToLogLevel = exports.logCliOutput = exports.logInternal = void 0;
|
|
6
|
+
exports.formatTimestamp = exports.valueToString = exports.logWebUIAndCliOutput = exports.findResultSeverityToLogLevel = exports.logCliOutput = exports.logInternal = void 0;
|
|
4
7
|
const mablscriptFind_1 = require("../mablscriptFind");
|
|
5
8
|
const loggingProvider_1 = require("../providers/logging/loggingProvider");
|
|
9
|
+
const moment_1 = __importDefault(require("moment"));
|
|
10
|
+
const constants_1 = require("../commands/constants");
|
|
6
11
|
function logInternal(logLine) {
|
|
7
12
|
loggingProvider_1.logger.debug(logLine);
|
|
8
13
|
}
|
|
@@ -55,3 +60,17 @@ function logWebUIAndCliOutput(logLine, logLevel, executionContext, metadata) {
|
|
|
55
60
|
}
|
|
56
61
|
}
|
|
57
62
|
exports.logWebUIAndCliOutput = logWebUIAndCliOutput;
|
|
63
|
+
function valueToString(value) {
|
|
64
|
+
if (typeof value !== 'object') {
|
|
65
|
+
return '' + value;
|
|
66
|
+
}
|
|
67
|
+
return JSON.stringify(value);
|
|
68
|
+
}
|
|
69
|
+
exports.valueToString = valueToString;
|
|
70
|
+
function formatTimestamp(timeAsNumber) {
|
|
71
|
+
if (!timeAsNumber) {
|
|
72
|
+
return '';
|
|
73
|
+
}
|
|
74
|
+
return moment_1.default.utc(timeAsNumber).format(constants_1.ListTimeFormat);
|
|
75
|
+
}
|
|
76
|
+
exports.formatTimestamp = formatTimestamp;
|
package/util/markdownUtil.js
CHANGED
|
@@ -19,7 +19,7 @@ function formatResultsAsGithubMarkdown(results) {
|
|
|
19
19
|
const tableRows = [];
|
|
20
20
|
tableRows.push(['Plan', 'Test', 'Browser', 'Status', 'Run Time']);
|
|
21
21
|
const finalExecutions = (_a = results === null || results === void 0 ? void 0 : results.executions) !== null && _a !== void 0 ? _a : [];
|
|
22
|
-
finalExecutions.forEach(summary => {
|
|
22
|
+
finalExecutions.forEach((summary) => {
|
|
23
23
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
24
24
|
const retryPrefix = ((_a = summary === null || summary === void 0 ? void 0 : summary.plan_execution) === null || _a === void 0 ? void 0 : _a.is_retry) ? '[Retry] ' : '';
|
|
25
25
|
const planName = retryPrefix + ((_c = (_b = summary.plan) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : '<plan name unavailable>');
|
|
@@ -29,7 +29,7 @@ function formatResultsAsGithubMarkdown(results) {
|
|
|
29
29
|
maybeCapitalize(humanizedPlanRunStatus === null || humanizedPlanRunStatus === void 0 ? void 0 : humanizedPlanRunStatus.toString());
|
|
30
30
|
const planHref = (_e = summary.plan) === null || _e === void 0 ? void 0 : _e.app_href;
|
|
31
31
|
const journeyMap = new Map();
|
|
32
|
-
(_f = summary.journeys) === null || _f === void 0 ? void 0 : _f.forEach(journeySummary => journeyMap.set(journeySummary.id, journeySummary));
|
|
32
|
+
(_f = summary.journeys) === null || _f === void 0 ? void 0 : _f.forEach((journeySummary) => journeyMap.set(journeySummary.id, journeySummary));
|
|
33
33
|
tableRows.push([
|
|
34
34
|
`[${planName}](${planHref})`,
|
|
35
35
|
'---',
|
|
@@ -37,7 +37,7 @@ function formatResultsAsGithubMarkdown(results) {
|
|
|
37
37
|
planRunStatus,
|
|
38
38
|
summaryToElapsedTime(summary),
|
|
39
39
|
]);
|
|
40
|
-
(_g = summary.journey_executions) === null || _g === void 0 ? void 0 : _g.forEach(journeyRun => {
|
|
40
|
+
(_g = summary.journey_executions) === null || _g === void 0 ? void 0 : _g.forEach((journeyRun) => {
|
|
41
41
|
const humanizedJourneyRunStatus = humanizeMablStatus(journeyRun.status);
|
|
42
42
|
const journeyStatus = humanizedMablStatusToGithubIcon(humanizedJourneyRunStatus) +
|
|
43
43
|
' ' +
|
package/util/pureUtil.js
CHANGED
|
@@ -32,8 +32,8 @@ function getCliPackage() {
|
|
|
32
32
|
return cliPackage;
|
|
33
33
|
}
|
|
34
34
|
const packagePath = possibleCliPackagePaths
|
|
35
|
-
.map(relativePath => path.resolve(__dirname, relativePath))
|
|
36
|
-
.find(path => fs.existsSync(path));
|
|
35
|
+
.map((relativePath) => path.resolve(__dirname, relativePath))
|
|
36
|
+
.find((path) => fs.existsSync(path));
|
|
37
37
|
if (!packagePath) {
|
|
38
38
|
throw new Error('Cannot find package.json');
|
|
39
39
|
}
|
|
@@ -82,10 +82,10 @@ exports.getCliName = getCliName;
|
|
|
82
82
|
function extractKeyCountsFromArgs(argv) {
|
|
83
83
|
const ignoreKeys = ['$0', '_'];
|
|
84
84
|
const keysUsed = Object.keys(argv)
|
|
85
|
-
.filter(key => !ignoreKeys.includes(key))
|
|
86
|
-
.filter(key => !/[A-Z]/.test(key));
|
|
85
|
+
.filter((key) => !ignoreKeys.includes(key))
|
|
86
|
+
.filter((key) => !/[A-Z]/.test(key));
|
|
87
87
|
const keyValueCountMap = {};
|
|
88
|
-
keysUsed.forEach(key => {
|
|
88
|
+
keysUsed.forEach((key) => {
|
|
89
89
|
const value = argv[key];
|
|
90
90
|
let count;
|
|
91
91
|
if (value === undefined || value === null) {
|
|
@@ -118,7 +118,7 @@ function extractKeyCountsFromArgs(argv) {
|
|
|
118
118
|
}
|
|
119
119
|
exports.extractKeyCountsFromArgs = extractKeyCountsFromArgs;
|
|
120
120
|
function getCaseInsensitiveProperty(obj, key) {
|
|
121
|
-
const keyInObject = Object.keys(obj).find(k => k.toLowerCase() === key.toLowerCase());
|
|
121
|
+
const keyInObject = Object.keys(obj).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
122
122
|
if (keyInObject !== undefined) {
|
|
123
123
|
return obj[keyInObject];
|
|
124
124
|
}
|
package/util/resourceUtil.js
CHANGED
|
@@ -19,7 +19,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.findDirectory = exports.findResource = void 0;
|
|
22
|
+
exports.findNodeModulesDirectory = exports.findDirectory = exports.findResource = void 0;
|
|
23
23
|
const path = __importStar(require("path"));
|
|
24
24
|
const fs = __importStar(require("fs"));
|
|
25
25
|
function findResource(pathInResource) {
|
|
@@ -40,3 +40,16 @@ function findDirectory(pathFromBase) {
|
|
|
40
40
|
return packedPath;
|
|
41
41
|
}
|
|
42
42
|
exports.findDirectory = findDirectory;
|
|
43
|
+
function findNodeModulesDirectory() {
|
|
44
|
+
const unpackedPath = path.normalize(path.resolve(`${__dirname}/../../../node_modules`));
|
|
45
|
+
if (fs.existsSync(unpackedPath)) {
|
|
46
|
+
return unpackedPath;
|
|
47
|
+
}
|
|
48
|
+
const packedAsMabltronDependency = path.normalize(path.resolve(`${__dirname}/../../mabl-cli-internal/node_modules/`));
|
|
49
|
+
if (fs.existsSync(packedAsMabltronDependency)) {
|
|
50
|
+
return packedAsMabltronDependency;
|
|
51
|
+
}
|
|
52
|
+
const packedPath = path.normalize(path.resolve(`${__dirname}/../../node_modules`));
|
|
53
|
+
return packedPath;
|
|
54
|
+
}
|
|
55
|
+
exports.findNodeModulesDirectory = findNodeModulesDirectory;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addClosedAllWindowsEventWatch = exports.addManualCloseEventWatch = void 0;
|
|
4
|
-
const messaging_1 = require("../messaging/messaging");
|
|
5
|
-
const testsUtil_1 = require("../../commands/tests/testsUtil");
|
|
6
|
-
const browserLauncher_1 = require("../../browserLauncher/browserLauncher");
|
|
7
|
-
function addManualCloseEventWatch(trainingBrowser, closeAction) {
|
|
8
|
-
trainingBrowser.on(browserLauncher_1.BrowserEvent.Disconnected, async () => {
|
|
9
|
-
await testsUtil_1.sleep(1000);
|
|
10
|
-
if (closeAction) {
|
|
11
|
-
closeAction();
|
|
12
|
-
}
|
|
13
|
-
trainingBrowser
|
|
14
|
-
.close()
|
|
15
|
-
.catch(error => messaging_1.mablEventEmitter.log('Error shutting down browser on manual close' + error));
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
exports.addManualCloseEventWatch = addManualCloseEventWatch;
|
|
19
|
-
function addClosedAllWindowsEventWatch(trainingBrowser, closeAction) {
|
|
20
|
-
trainingBrowser.on(browserLauncher_1.BrowserEvent.PageDestroyed, async () => {
|
|
21
|
-
const pages = await trainingBrowser.pages();
|
|
22
|
-
if (pages.length === 0) {
|
|
23
|
-
await testsUtil_1.sleep(1000);
|
|
24
|
-
if (closeAction) {
|
|
25
|
-
closeAction();
|
|
26
|
-
}
|
|
27
|
-
trainingBrowser
|
|
28
|
-
.close()
|
|
29
|
-
.catch(error => messaging_1.mablEventEmitter.log('Error shutting down browser on manual close' + error));
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
exports.addClosedAllWindowsEventWatch = addClosedAllWindowsEventWatch;
|