@mablhq/mabl-cli 2.31.41 → 2.34.5
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 +18 -3
- package/api/featureSet.js +7 -3
- package/api/mablApiClient.js +16 -10
- package/commands/commandUtil/fileUtil.js +2 -0
- package/commands/constants.js +3 -2
- package/commands/deploy/deploy_cmds/create.js +22 -5
- package/commands/tests/tests_cmds/run-mobile.js +19 -0
- package/commands/tests/tests_cmds/run.js +1 -1
- package/execution/index.js +3 -3
- package/mablApi/index.js +1 -1
- package/mablscript/actions/ConditionAction.js +4 -1
- package/mablscript/steps/AbstractAssertionsAndVariablesStep.js +7 -0
- package/mablscript/steps/SendHttpRequestStep.js +20 -23
- package/mablscript/types/ConditionDescriptor.js +26 -30
- package/package.json +3 -3
- package/providers/scmContextInterfaces.js +1 -1
- package/providers/scmContextProviderV2.js +122 -0
- package/upload/index.js +1 -1
- package/util/analytics.js +25 -10
|
@@ -37,12 +37,15 @@ class ConditionAction extends MablAction_1.MablAction {
|
|
|
37
37
|
if (conditionAttribute === undefined) {
|
|
38
38
|
throw new Error('Invalid equality condition. Missing comparison type.');
|
|
39
39
|
}
|
|
40
|
+
if (!(0, ConditionDescriptor_1.isComparisonType)(conditionAttribute)) {
|
|
41
|
+
throw new Error(`Invalid equality condition. Invalid comparison type: ${conditionAttribute}`);
|
|
42
|
+
}
|
|
40
43
|
if (options) {
|
|
41
44
|
this.hasOptionsAtInstantiation = true;
|
|
42
45
|
}
|
|
43
46
|
return {
|
|
44
47
|
conditionType: ConditionDescriptor_1.ConditionType.Comparison,
|
|
45
|
-
comparisonType:
|
|
48
|
+
comparisonType: conditionAttribute,
|
|
46
49
|
comparatorValue: (0, MablAction_1.parseArgument)(conditionValueAttribute),
|
|
47
50
|
caseInsensitive: options === null || options === void 0 ? void 0 : options.caseInsensitive,
|
|
48
51
|
};
|
|
@@ -4,6 +4,7 @@ exports.AbstractAssertionsAndVariablesStep = void 0;
|
|
|
4
4
|
const domUtil_1 = require("../../domUtil");
|
|
5
5
|
const MablAction_1 = require("../MablAction");
|
|
6
6
|
const MablStep_1 = require("../MablStep");
|
|
7
|
+
const ConditionDescriptor_1 = require("../types/ConditionDescriptor");
|
|
7
8
|
const AssertStep_1 = require("./AssertStep");
|
|
8
9
|
class AbstractAssertionsAndVariablesStep extends MablStep_1.MablStep {
|
|
9
10
|
constructor(name, args, actions, mablScriptName, stepName, descriptor) {
|
|
@@ -15,8 +16,14 @@ class AbstractAssertionsAndVariablesStep extends MablStep_1.MablStep {
|
|
|
15
16
|
return this.stepName;
|
|
16
17
|
}
|
|
17
18
|
toStepDescriptor() {
|
|
19
|
+
var _a;
|
|
18
20
|
const formatted = JSON.parse(JSON.stringify(this.descriptor));
|
|
19
21
|
formatted.actionCode = this.actionCode;
|
|
22
|
+
(_a = formatted.assertions) === null || _a === void 0 ? void 0 : _a.forEach((assertion) => {
|
|
23
|
+
if (!(0, ConditionDescriptor_1.isComparisonType)(assertion.assertion)) {
|
|
24
|
+
throw new Error(`Invalid comparison type: ${assertion.assertion}`);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
20
27
|
return formatted;
|
|
21
28
|
}
|
|
22
29
|
toMablscript() {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SendHttpRequestVariableSource = exports.SendHttpRequestStep = void 0;
|
|
4
|
-
const AbstractAssertionsAndVariablesStep_1 = require("./AbstractAssertionsAndVariablesStep");
|
|
5
4
|
const ConditionDescriptor_1 = require("../types/ConditionDescriptor");
|
|
5
|
+
const AbstractAssertionsAndVariablesStep_1 = require("./AbstractAssertionsAndVariablesStep");
|
|
6
6
|
class SendHttpRequestStep extends AbstractAssertionsAndVariablesStep_1.AbstractAssertionsAndVariablesStep {
|
|
7
7
|
constructor(name, args, actions) {
|
|
8
8
|
super(name, args, actions, 'send_http_request', SendHttpRequestStep.stepName, args[0]);
|
|
@@ -10,32 +10,29 @@ class SendHttpRequestStep extends AbstractAssertionsAndVariablesStep_1.AbstractA
|
|
|
10
10
|
static fromYaml(_stepName, stepArgs) {
|
|
11
11
|
var _a;
|
|
12
12
|
const formatted = stepArgs;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
const comparisonTypeConverter = {
|
|
14
|
+
Equals: ConditionDescriptor_1.AssertionConditionField.Equals,
|
|
15
|
+
DoesNotEqual: ConditionDescriptor_1.AssertionConditionField.DoesNotEqual,
|
|
16
|
+
Contains: ConditionDescriptor_1.AssertionConditionField.Contains,
|
|
17
|
+
DoesNotContain: ConditionDescriptor_1.AssertionConditionField.DoesNotContain,
|
|
18
|
+
StartsWith: ConditionDescriptor_1.AssertionConditionField.StartsWith,
|
|
19
|
+
StartsWithout: ConditionDescriptor_1.AssertionConditionField.StartsWithout,
|
|
20
|
+
EndsWith: ConditionDescriptor_1.AssertionConditionField.EndsWith,
|
|
21
|
+
EndsWithout: ConditionDescriptor_1.AssertionConditionField.EndsWithout,
|
|
22
|
+
GreaterThan: ConditionDescriptor_1.AssertionConditionField.GreaterThan,
|
|
23
|
+
LessThan: ConditionDescriptor_1.AssertionConditionField.LessThan,
|
|
24
|
+
GreaterThanOrEquals: ConditionDescriptor_1.AssertionConditionField.GreaterThanOrEquals,
|
|
25
|
+
LessThanOrEquals: ConditionDescriptor_1.AssertionConditionField.LessThanOrEquals,
|
|
26
|
+
};
|
|
27
|
+
(_a = formatted.assertions) === null || _a === void 0 ? void 0 : _a.forEach((assertion) => {
|
|
28
|
+
if (assertion.assertion in comparisonTypeConverter) {
|
|
29
|
+
assertion.assertion = comparisonTypeConverter[assertion.assertion];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
22
32
|
const step = new SendHttpRequestStep(SendHttpRequestStep.stepName, [formatted], []);
|
|
23
33
|
step.setStepId(stepArgs.id);
|
|
24
34
|
return step;
|
|
25
35
|
}
|
|
26
|
-
toStepDescriptor() {
|
|
27
|
-
const internalDescriptor = this
|
|
28
|
-
.descriptor;
|
|
29
|
-
const formatted = JSON.parse(JSON.stringify(internalDescriptor));
|
|
30
|
-
if (internalDescriptor.assertions) {
|
|
31
|
-
formatted.assertions = internalDescriptor.assertions.map((assertion) => ({
|
|
32
|
-
...assertion,
|
|
33
|
-
assertion: ConditionDescriptor_1.AssertionConditionFieldToCondition[assertion.assertion],
|
|
34
|
-
}));
|
|
35
|
-
}
|
|
36
|
-
formatted.actionCode = this.actionCode;
|
|
37
|
-
return formatted;
|
|
38
|
-
}
|
|
39
36
|
}
|
|
40
37
|
exports.SendHttpRequestStep = SendHttpRequestStep;
|
|
41
38
|
SendHttpRequestStep.stepName = 'SendHttpRequest';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AssertionConditionFieldToStepName = exports.
|
|
3
|
+
exports.AssertionConditionFieldToStepName = exports.AssertionStepNameToField = exports.getAssertionConditionFieldFromDescriptor = exports.PresenceEvaluationType = exports.isAbsenceExpected = exports.isAIPromptCondition = exports.isPresenceCondition = exports.getOptionalConditionOptions = exports.getOptionalComparatorValue = exports.getOptionalComparisonType = exports.isComparisonType = exports.AssertionConditionField = exports.ConditionType = void 0;
|
|
4
4
|
var ConditionType;
|
|
5
5
|
(function (ConditionType) {
|
|
6
6
|
ConditionType["AIPrompt"] = "ai_prompt";
|
|
@@ -8,31 +8,31 @@ var ConditionType;
|
|
|
8
8
|
ConditionType["Presence"] = "presence";
|
|
9
9
|
ConditionType["Truthy"] = "truthy";
|
|
10
10
|
})(ConditionType || (exports.ConditionType = ConditionType = {}));
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
11
|
+
exports.AssertionConditionField = {
|
|
12
|
+
Equals: 'equals',
|
|
13
|
+
Present: 'present',
|
|
14
|
+
NotPresent: 'not_present',
|
|
15
|
+
DoesNotEqual: 'does_not_equal',
|
|
16
|
+
Contains: 'contains',
|
|
17
|
+
DoesNotContain: 'does_not_contain',
|
|
18
|
+
StartsWith: 'starts_with',
|
|
19
|
+
StartsWithout: 'starts_without',
|
|
20
|
+
EndsWith: 'ends_with',
|
|
21
|
+
EndsWithout: 'ends_without',
|
|
22
|
+
GreaterThan: 'greater_than',
|
|
23
|
+
LessThan: 'less_than',
|
|
24
|
+
GreaterThanOrEquals: 'greater_than_or_equals',
|
|
25
|
+
LessThanOrEquals: 'less_than_or_equals',
|
|
26
|
+
AIPrompt: 'ai_prompt',
|
|
27
|
+
};
|
|
28
|
+
function isComparisonType(text) {
|
|
29
|
+
return Object.values(exports.AssertionConditionField)
|
|
30
|
+
.filter((field) => field !== exports.AssertionConditionField.Present &&
|
|
31
|
+
field !== exports.AssertionConditionField.NotPresent &&
|
|
32
|
+
field !== exports.AssertionConditionField.AIPrompt)
|
|
33
|
+
.includes(text);
|
|
34
|
+
}
|
|
35
|
+
exports.isComparisonType = isComparisonType;
|
|
36
36
|
function getOptionalComparisonType(descriptor) {
|
|
37
37
|
if (descriptor === undefined) {
|
|
38
38
|
return undefined;
|
|
@@ -125,10 +125,6 @@ exports.AssertionStepNameToField = {
|
|
|
125
125
|
AssertLessThanOrEquals: 'less_than_or_equals',
|
|
126
126
|
AssertAIPrompt: 'ai_prompt',
|
|
127
127
|
};
|
|
128
|
-
exports.AssertionConditionFieldToCondition = Object.fromEntries(Object.entries(exports.AssertionStepNameToField).map(([stepType, field]) => [
|
|
129
|
-
field,
|
|
130
|
-
`${stepType.split('Assert')[1]}`,
|
|
131
|
-
]));
|
|
132
128
|
exports.AssertionConditionFieldToStepName = Object.fromEntries(Object.entries(exports.AssertionStepNameToField).map(([stepType, field]) => [
|
|
133
129
|
field,
|
|
134
130
|
stepType,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mablhq/mabl-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.34.5",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "The official mabl command line interface tool",
|
|
6
6
|
"main": "index.js",
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
"newman": "6.0.0",
|
|
77
77
|
"open": "6.4.0",
|
|
78
78
|
"ora": "4.0.4",
|
|
79
|
-
"playwright": "1.44.
|
|
80
|
-
"playwright-core": "1.44.
|
|
79
|
+
"playwright": "1.44.1",
|
|
80
|
+
"playwright-core": "1.44.1",
|
|
81
81
|
"pluralize": "8.0.0",
|
|
82
82
|
"pngjs": "6.0.0",
|
|
83
83
|
"portfinder": "1.0.28",
|
|
@@ -6,7 +6,7 @@ var BuildTypes;
|
|
|
6
6
|
BuildTypes["AzureDevOps"] = "azure_devops";
|
|
7
7
|
BuildTypes["BitbucketPipe"] = "bitbucket_pipe";
|
|
8
8
|
BuildTypes["CircleCi"] = "circle_ci";
|
|
9
|
-
BuildTypes["CloudBuild"] = "
|
|
9
|
+
BuildTypes["CloudBuild"] = "cloudbuild";
|
|
10
10
|
BuildTypes["Codeship"] = "codeship";
|
|
11
11
|
BuildTypes["GithubAction"] = "github_action";
|
|
12
12
|
BuildTypes["Jenkins"] = "jenkins";
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ScmContextProviderV2 = void 0;
|
|
4
|
+
const scmContextInterfaces_1 = require("./scmContextInterfaces");
|
|
5
|
+
const loggingProvider_1 = require("./logging/loggingProvider");
|
|
6
|
+
function processBuildEnv(envVariables, mapper, confidenceCheck) {
|
|
7
|
+
const results = {};
|
|
8
|
+
envVariables.forEach((value, key) => {
|
|
9
|
+
mapper(key, value, results);
|
|
10
|
+
});
|
|
11
|
+
results.isCorrectType = confidenceCheck(results);
|
|
12
|
+
if (results.isCorrectType) {
|
|
13
|
+
return results;
|
|
14
|
+
}
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
class ScmContextProviderV2 {
|
|
18
|
+
constructor(processRef) {
|
|
19
|
+
this.envVariables = this.extractEnvVariables(processRef);
|
|
20
|
+
}
|
|
21
|
+
extractScmAndBuildInfo() {
|
|
22
|
+
try {
|
|
23
|
+
return this.innerExtractScmAndBuildInfo();
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
loggingProvider_1.logger.error('Unable to collect build information. Using defaults.');
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
innerExtractScmAndBuildInfo() {
|
|
31
|
+
const maybeBuildInfo = this.attemptExtractBuildInfo();
|
|
32
|
+
return {
|
|
33
|
+
buildInfo: maybeBuildInfo,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
attemptExtractBuildInfo() {
|
|
37
|
+
const processors = [
|
|
38
|
+
() => this.getForCloudBuild(),
|
|
39
|
+
];
|
|
40
|
+
return processors
|
|
41
|
+
.map((processor) => processor())
|
|
42
|
+
.find((result) => result !== undefined);
|
|
43
|
+
}
|
|
44
|
+
extractEnvVariables(processRef) {
|
|
45
|
+
const result = new Map();
|
|
46
|
+
Object.entries(processRef).forEach(([key, value]) => {
|
|
47
|
+
if (value && value !== '') {
|
|
48
|
+
result.set(key, value);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
getForCloudBuild() {
|
|
54
|
+
function mapper(key, value, result) {
|
|
55
|
+
switch (key) {
|
|
56
|
+
case '_HEAD_BRANCH':
|
|
57
|
+
result.pullRequestHeadBranch = value;
|
|
58
|
+
break;
|
|
59
|
+
case '_BASE_BRANCH':
|
|
60
|
+
result.pullRequestBaseBranch = value;
|
|
61
|
+
break;
|
|
62
|
+
case '_HEAD_REPO_URL':
|
|
63
|
+
result.pullRequestHeadRepo = value;
|
|
64
|
+
break;
|
|
65
|
+
case '_PR_NUMBER':
|
|
66
|
+
result.pullRequestId = value;
|
|
67
|
+
break;
|
|
68
|
+
case 'PROJECT_ID':
|
|
69
|
+
result.projectId = value;
|
|
70
|
+
break;
|
|
71
|
+
case 'PROJECT_NUMBER':
|
|
72
|
+
result.projectNumber = value;
|
|
73
|
+
break;
|
|
74
|
+
case 'SERVICE_ACCOUNT':
|
|
75
|
+
case 'SERVICE_ACCOUNT_EMAIL':
|
|
76
|
+
result.hasServiceAccount = true;
|
|
77
|
+
break;
|
|
78
|
+
case 'LOCATION':
|
|
79
|
+
result.cloudRegion = value;
|
|
80
|
+
break;
|
|
81
|
+
case 'BUILD_ID':
|
|
82
|
+
result.buildId = value;
|
|
83
|
+
break;
|
|
84
|
+
case 'COMMIT_SHA':
|
|
85
|
+
result.commitSha = value;
|
|
86
|
+
break;
|
|
87
|
+
case 'SHORT_SHA':
|
|
88
|
+
result.shortSha = value;
|
|
89
|
+
break;
|
|
90
|
+
case 'REPO_NAME':
|
|
91
|
+
result.repoName = value;
|
|
92
|
+
break;
|
|
93
|
+
case 'BRANCH_NAME':
|
|
94
|
+
result.branchName = value;
|
|
95
|
+
break;
|
|
96
|
+
case 'TAG_NAME':
|
|
97
|
+
result.tagName = value;
|
|
98
|
+
break;
|
|
99
|
+
case 'REVISION_ID':
|
|
100
|
+
result.revisionId = value;
|
|
101
|
+
break;
|
|
102
|
+
case 'MABL_CLI_NAME':
|
|
103
|
+
result.isCliDockerContainer = true;
|
|
104
|
+
break;
|
|
105
|
+
default:
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function confidenceCheck(result) {
|
|
109
|
+
const checksOut = (result === null || result === void 0 ? void 0 : result.projectId) !== undefined &&
|
|
110
|
+
result.projectNumber !== undefined &&
|
|
111
|
+
result.cloudRegion !== undefined &&
|
|
112
|
+
result.buildId !== undefined;
|
|
113
|
+
if (checksOut) {
|
|
114
|
+
result.buildType = scmContextInterfaces_1.BuildTypes.CloudBuild;
|
|
115
|
+
result.buildInfoUrl = `https://console.cloud.google.com/cloud-build/builds;region=${result.cloudRegion}/${result.buildId}?project=${result.projectId}`;
|
|
116
|
+
}
|
|
117
|
+
return checksOut;
|
|
118
|
+
}
|
|
119
|
+
return processBuildEnv(this.envVariables, mapper, confidenceCheck);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.ScmContextProviderV2 = ScmContextProviderV2;
|