@mablhq/mabl-cli 1.58.10 → 1.58.15
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/featureSet.js +4 -0
- package/commands/commandUtil/util.js +13 -1
- package/commands/credentials/credentials_cmds/list.js +13 -3
- package/core/trainer/trainingSessions.js +16 -0
- package/execution/index.js +1 -1
- package/mablApi/index.js +1 -1
- package/package.json +1 -1
- package/util/TestOutputWriter.js +29 -2
package/api/featureSet.js
CHANGED
|
@@ -5,6 +5,7 @@ const types_1 = require("../browserLauncher/types");
|
|
|
5
5
|
const ACCESSIBILITY_CHECK_FEATURE_FLAG = 'accessibility_checks';
|
|
6
6
|
const PERFORMANCE_TESTING_BROWSER_RUNS_FEATURE_FLAG = 'performance_testing_browser_runs';
|
|
7
7
|
const SMARTER_WAIT_FEATURE_FLAG = 'smarter_wait';
|
|
8
|
+
const CREDENTIALS_CLOUD = 'credentials_cloud';
|
|
8
9
|
var FindImplementationVersion;
|
|
9
10
|
(function (FindImplementationVersion) {
|
|
10
11
|
FindImplementationVersion[FindImplementationVersion["V1"] = 0] = "V1";
|
|
@@ -25,6 +26,9 @@ class FeatureSet {
|
|
|
25
26
|
hasAccessibilityChecksEnabled() {
|
|
26
27
|
return this.featureFlags.has(ACCESSIBILITY_CHECK_FEATURE_FLAG);
|
|
27
28
|
}
|
|
29
|
+
hasCloudCredentialsEnabled() {
|
|
30
|
+
return this.featureFlags.has(CREDENTIALS_CLOUD);
|
|
31
|
+
}
|
|
28
32
|
hasPerformanceTestingBrowserRunsFeatureEnabled() {
|
|
29
33
|
return this.featureFlags.has(PERFORMANCE_TESTING_BROWSER_RUNS_FEATURE_FLAG);
|
|
30
34
|
}
|
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.parseColinJoinedVariablePair = exports.validateValuePairInputs = exports.validateArrayInputs = exports.getWorkspaceIdFromAppOrEnv = exports.getJourneyFlowArray = exports.TEST_WITHOUT_FLOWS_MESSAGE = exports.getWorkspaceId = exports.failWrapper = exports.getDescribeDescriptions = void 0;
|
|
6
|
+
exports.getCredentialType = exports.parseColinJoinedVariablePair = exports.validateValuePairInputs = exports.validateArrayInputs = exports.getWorkspaceIdFromAppOrEnv = exports.getJourneyFlowArray = exports.TEST_WITHOUT_FLOWS_MESSAGE = exports.getWorkspaceId = exports.failWrapper = exports.getDescribeDescriptions = void 0;
|
|
7
|
+
const mablApi_1 = require("../../mablApi");
|
|
7
8
|
const cliConfigProvider_1 = require("../../providers/cliConfigProvider");
|
|
8
9
|
const constants_1 = require("../constants");
|
|
9
10
|
const loggingProvider_1 = require("../../providers/logging/loggingProvider");
|
|
@@ -112,3 +113,14 @@ function parseColinJoinedVariablePair(input) {
|
|
|
112
113
|
return { name, value };
|
|
113
114
|
}
|
|
114
115
|
exports.parseColinJoinedVariablePair = parseColinJoinedVariablePair;
|
|
116
|
+
function getCredentialType(credential) {
|
|
117
|
+
if (credential.cloud_only) {
|
|
118
|
+
return credential.type === mablApi_1.Credentials.TypeEnum.Basic
|
|
119
|
+
? 'Cloud'
|
|
120
|
+
: 'Cloud with MFA';
|
|
121
|
+
}
|
|
122
|
+
return credential.type === mablApi_1.Credentials.TypeEnum.Basic
|
|
123
|
+
? 'Basic'
|
|
124
|
+
: 'Basic with MFA';
|
|
125
|
+
}
|
|
126
|
+
exports.getCredentialType = getCredentialType;
|
|
@@ -11,6 +11,7 @@ const moment = require("moment");
|
|
|
11
11
|
const list_1 = require("../../commandUtil/list");
|
|
12
12
|
const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
|
|
13
13
|
const constants_1 = require("../../constants");
|
|
14
|
+
const chalk = require('chalk');
|
|
14
15
|
exports.command = 'list';
|
|
15
16
|
exports.describe = 'List your credentials';
|
|
16
17
|
exports.builder = (0, list_1.getListBuilderOptions)('credentials');
|
|
@@ -20,11 +21,12 @@ async function listCredentials(parsed) {
|
|
|
20
21
|
const limit = parsed.limit;
|
|
21
22
|
const workspaceId = await (0, util_1.getWorkspaceId)(parsed);
|
|
22
23
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
24
|
+
const hasCloudCredentialsEnabled = (await apiClient.getEffectiveFeaturesByWorkspaceId(workspaceId)).hasCloudCredentialsEnabled();
|
|
23
25
|
const credentials = await apiClient.getCredentials(workspaceId, limit);
|
|
24
|
-
printCredentials(credentials, output);
|
|
26
|
+
printCredentials(credentials, output, hasCloudCredentialsEnabled);
|
|
25
27
|
return credentials.length;
|
|
26
28
|
}
|
|
27
|
-
function printCredentials(credentials, output) {
|
|
29
|
+
function printCredentials(credentials, output, hasCloudCredentialsEnabled) {
|
|
28
30
|
switch (output) {
|
|
29
31
|
case 'json':
|
|
30
32
|
loggingProvider_1.logger.info(JSON.stringify(credentials, null, 2));
|
|
@@ -34,13 +36,18 @@ function printCredentials(credentials, output) {
|
|
|
34
36
|
break;
|
|
35
37
|
default:
|
|
36
38
|
const table = new cli_table3_1.default({
|
|
37
|
-
head: ['ID', 'Name', 'Description', 'Created time'],
|
|
39
|
+
head: ['ID', 'Name', 'Type', 'Description', 'Created time'],
|
|
38
40
|
wordWrap: true,
|
|
39
41
|
});
|
|
40
42
|
credentials.forEach((credential) => {
|
|
41
43
|
table.push([
|
|
42
44
|
{ rowSpan: 1, content: credential.id, vAlign: 'center' },
|
|
43
45
|
{ rowSpan: 1, content: credential.name, vAlign: 'center' },
|
|
46
|
+
{
|
|
47
|
+
rowSpan: 1,
|
|
48
|
+
content: (0, util_1.getCredentialType)(credential),
|
|
49
|
+
vAlign: 'center',
|
|
50
|
+
},
|
|
44
51
|
{
|
|
45
52
|
rowSpan: 1,
|
|
46
53
|
content: credential.description || '---',
|
|
@@ -56,4 +63,7 @@ function printCredentials(credentials, output) {
|
|
|
56
63
|
loggingProvider_1.logger.info(table.toString());
|
|
57
64
|
break;
|
|
58
65
|
}
|
|
66
|
+
if (hasCloudCredentialsEnabled) {
|
|
67
|
+
loggingProvider_1.logger.info(chalk.bgBlack(chalk.yellow.bold('\nCloud credentials are not available for local runs.')));
|
|
68
|
+
}
|
|
59
69
|
}
|
|
@@ -8,6 +8,8 @@ const constants_1 = require("../../commands/constants");
|
|
|
8
8
|
const util_1 = require("../util");
|
|
9
9
|
const openUtils_1 = require("./openUtils");
|
|
10
10
|
const util_2 = require("../../commands/commandUtil/util");
|
|
11
|
+
const loggingProvider_1 = require("../../providers/logging/loggingProvider");
|
|
12
|
+
const chalk = require('chalk');
|
|
11
13
|
exports.DEFAULT_HEIGHT = 800;
|
|
12
14
|
exports.DEFAULT_WIDTH = 1000;
|
|
13
15
|
exports.SENDER = 'cli';
|
|
@@ -31,6 +33,13 @@ async function trainNewTest(trainingSessionOptions) {
|
|
|
31
33
|
if (planId) {
|
|
32
34
|
await apiClient.getPlan(planId);
|
|
33
35
|
}
|
|
36
|
+
if (credentialsId) {
|
|
37
|
+
const credential = await apiClient.getCredential(credentialsId);
|
|
38
|
+
if (credential.cloud_only) {
|
|
39
|
+
loggingProvider_1.logger.error(chalk.red.bold(`Cannot use Cloud Credentials in the trainer. Use a basic one instead.`));
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
34
43
|
if (applicationId) {
|
|
35
44
|
await apiClient.getApplication(applicationId);
|
|
36
45
|
}
|
|
@@ -70,6 +79,13 @@ async function editTest(trainingSessionOptions) {
|
|
|
70
79
|
const credentialsId = (_b = trainingSessionOptions.credentialsId) !== null && _b !== void 0 ? _b : testRunIdConfig.credentialsId;
|
|
71
80
|
const branchName = (_d = (_c = trainingSessionOptions.branchName) !== null && _c !== void 0 ? _c : testRunIdConfig.branchName) !== null && _d !== void 0 ? _d : constants_1.DefaultBranchName;
|
|
72
81
|
const environmentId = (_e = trainingSessionOptions.environmentId) !== null && _e !== void 0 ? _e : testRunIdConfig.environmentId;
|
|
82
|
+
if (credentialsId) {
|
|
83
|
+
const credential = await apiClient.getCredential(credentialsId);
|
|
84
|
+
if (credential.cloud_only) {
|
|
85
|
+
loggingProvider_1.logger.error(chalk.red.bold(`Cannot use Cloud Credentials in the trainer. Use a basic one instead.`));
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
73
89
|
const testId = (_f = trainingSessionOptions.testId) !== null && _f !== void 0 ? _f : testRunIdConfig.testId;
|
|
74
90
|
if (!testId) {
|
|
75
91
|
throw new Error('Unable to determine test Id run');
|