@mablhq/mabl-cli 2.41.1 → 2.45.2
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/mablApiClient.js +3 -2
- package/browserEngines/chromiumBrowserEngine.js +0 -4
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumElementHandleDelegate.js +0 -2
- package/cli.js +0 -1
- package/commands/config/config_cmds/install.js +2 -2
- package/commands/tests/testsUtil.js +4 -0
- package/core/execution/ApiTestUtils.js +171 -48
- package/core/execution/newman-types.js +7 -0
- package/core/messaging/messaging.js +2 -1
- package/execution/index.js +3 -3
- package/mablApi/index.js +1 -1
- package/mablscript/actions/ConditionAction.js +4 -3
- package/mablscript/steps/AssertStep.js +23 -18
- package/mablscript/steps/IfConditionStep.js +13 -5
- package/mobile/types.js +6 -0
- package/package.json +3 -4
- package/providers/exportRequestProvider.js +5 -0
- package/upload/index.js +1 -1
- package/util/logUtils.js +18 -5
|
@@ -67,9 +67,9 @@ class ConditionAction extends MablAction_1.MablAction {
|
|
|
67
67
|
getEvaluateAIPrompt() {
|
|
68
68
|
const conditionActionArgs = this.getActionArgs();
|
|
69
69
|
let userPrompt;
|
|
70
|
-
let
|
|
70
|
+
let options;
|
|
71
71
|
if (conditionActionArgs) {
|
|
72
|
-
[userPrompt,
|
|
72
|
+
[userPrompt, options] = this.getActionArgs();
|
|
73
73
|
}
|
|
74
74
|
if (userPrompt === undefined) {
|
|
75
75
|
throw new Error('Invalid ai prompt condition. Missing user prompt');
|
|
@@ -77,7 +77,8 @@ class ConditionAction extends MablAction_1.MablAction {
|
|
|
77
77
|
return {
|
|
78
78
|
conditionType: ConditionDescriptor_1.ConditionType.AIPrompt,
|
|
79
79
|
userPrompt,
|
|
80
|
-
metaPrompt,
|
|
80
|
+
metaPrompt: typeof options === 'string' ? options : options === null || options === void 0 ? void 0 : options.metaPrompt,
|
|
81
|
+
criteria: options === null || options === void 0 ? void 0 : options.criteria,
|
|
81
82
|
};
|
|
82
83
|
}
|
|
83
84
|
generateEvaluateConditionMablscript() {
|
|
@@ -52,11 +52,12 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
52
52
|
else {
|
|
53
53
|
this.conditionAction = actions[1];
|
|
54
54
|
}
|
|
55
|
-
this.
|
|
56
|
-
?
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
this.aiPrompt = (0, ConditionDescriptor_1.isAIPromptCondition)(this.conditionAction.conditionDescriptor)
|
|
56
|
+
? {
|
|
57
|
+
userPrompt: this.conditionAction.conditionDescriptor.userPrompt,
|
|
58
|
+
metaPrompt: this.conditionAction.conditionDescriptor.metaPrompt,
|
|
59
|
+
criteria: this.conditionAction.conditionDescriptor.criteria,
|
|
60
|
+
}
|
|
60
61
|
: undefined;
|
|
61
62
|
this.assertionType = (0, ConditionDescriptor_1.getAssertionConditionFieldFromDescriptor)(this.conditionAction.conditionDescriptor);
|
|
62
63
|
this.assertionValue = (0, ConditionDescriptor_1.getOptionalComparatorValue)(this.conditionAction.conditionDescriptor);
|
|
@@ -140,11 +141,8 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
140
141
|
if (this.assertionValue !== undefined) {
|
|
141
142
|
formatted.assertionValue = this.assertionValue;
|
|
142
143
|
}
|
|
143
|
-
if (this.
|
|
144
|
-
formatted.
|
|
145
|
-
}
|
|
146
|
-
if (this.metaPrompt !== undefined) {
|
|
147
|
-
formatted.metaPrompt = this.metaPrompt;
|
|
144
|
+
if (this.aiPrompt !== undefined) {
|
|
145
|
+
formatted.aiPrompt = this.aiPrompt;
|
|
148
146
|
}
|
|
149
147
|
const targetDescriptor = this.primaryAction.toDescriptor();
|
|
150
148
|
if ((0, GetVariableDescriptor_1.isGetVariableDescriptor)(targetDescriptor)) {
|
|
@@ -168,7 +166,7 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
168
166
|
return result;
|
|
169
167
|
}
|
|
170
168
|
static fromYaml(stepName, stepArgs) {
|
|
171
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
169
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
172
170
|
const actions = [];
|
|
173
171
|
const assertionType = ConditionDescriptor_1.AssertionStepNameToField[stepName];
|
|
174
172
|
const assertionValue = stepArgs.assertionValue;
|
|
@@ -204,8 +202,11 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
204
202
|
actions.push(primaryAction);
|
|
205
203
|
if (assertionType === 'ai_prompt') {
|
|
206
204
|
actions.push(new ConditionAction_1.ConditionAction('evaluate_ai_prompt', [
|
|
207
|
-
stepArgs.userPrompt,
|
|
208
|
-
|
|
205
|
+
(_h = (_g = stepArgs.aiPrompt) === null || _g === void 0 ? void 0 : _g.userPrompt) !== null && _h !== void 0 ? _h : stepArgs.userPrompt,
|
|
206
|
+
{
|
|
207
|
+
metaPrompt: (_k = (_j = stepArgs.aiPrompt) === null || _j === void 0 ? void 0 : _j.metaPrompt) !== null && _k !== void 0 ? _k : stepArgs.metaPrompt,
|
|
208
|
+
criteria: (_l = stepArgs.aiPrompt) === null || _l === void 0 ? void 0 : _l.criteria,
|
|
209
|
+
},
|
|
209
210
|
]));
|
|
210
211
|
}
|
|
211
212
|
else if (assertionType === 'present' || assertionType === 'not_present') {
|
|
@@ -218,7 +219,7 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
218
219
|
if (stepArgs.attribute === 'count') {
|
|
219
220
|
actions.push(new CountAction_1.CountAction('count', [stepArgs.attribute]));
|
|
220
221
|
}
|
|
221
|
-
else if (((
|
|
222
|
+
else if (((_m = stepArgs.target) === null || _m === void 0 ? void 0 : _m.kind) !== GetVariableDescriptor_1.GET_VARIABLE_VALUE) {
|
|
222
223
|
actions.push(new ExtractAction_1.ExtractAction(ExtractAction_1.ExtractAction.mablScriptTypeFromYamlType(stepArgs.extractType), [stepArgs.attribute]));
|
|
223
224
|
}
|
|
224
225
|
actions.push(new ConditionAction_1.ConditionAction('evaluate_condition', [
|
|
@@ -235,7 +236,7 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
235
236
|
return assertStep;
|
|
236
237
|
}
|
|
237
238
|
toMablscript() {
|
|
238
|
-
var _a, _b, _c, _d;
|
|
239
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
239
240
|
if (this.primaryAction instanceof MobileFindAction_1.MobileFindAction) {
|
|
240
241
|
throw new Error('Mobile steps do not generate mablscript');
|
|
241
242
|
}
|
|
@@ -259,10 +260,14 @@ class AssertStep extends MablStep_1.MablStep {
|
|
|
259
260
|
return `${this.primaryAction.generateFindMablscript()}.evaluate_presence("${this.assertionType}")${assertAction}`;
|
|
260
261
|
}
|
|
261
262
|
if (this.assertionType === 'ai_prompt') {
|
|
262
|
-
|
|
263
|
-
|
|
263
|
+
const aiOptions = {};
|
|
264
|
+
if ((_e = this.aiPrompt) === null || _e === void 0 ? void 0 : _e.metaPrompt) {
|
|
265
|
+
aiOptions.metaPrompt = this.aiPrompt.metaPrompt;
|
|
266
|
+
}
|
|
267
|
+
if (((_f = this.aiPrompt) === null || _f === void 0 ? void 0 : _f.criteria) && this.aiPrompt.criteria.length > 0) {
|
|
268
|
+
aiOptions.criteria = (_g = this.aiPrompt) === null || _g === void 0 ? void 0 : _g.criteria;
|
|
264
269
|
}
|
|
265
|
-
return `${this.primaryAction.generateFindMablscript()}.evaluate_ai_prompt("${this.userPrompt}",
|
|
270
|
+
return `${this.primaryAction.generateFindMablscript()}.evaluate_ai_prompt("${(_h = this.aiPrompt) === null || _h === void 0 ? void 0 : _h.userPrompt}", ${JSON.stringify(aiOptions)})${assertAction}`;
|
|
266
271
|
}
|
|
267
272
|
return `${this.primaryAction.toMablscript()}.${this.conditionAction.toMablscript()}${assertAction}`;
|
|
268
273
|
}
|
|
@@ -69,10 +69,11 @@ class IfConditionStep extends MablStep_1.MablStep {
|
|
|
69
69
|
: undefined;
|
|
70
70
|
if (this.conditionAction.conditionDescriptor.conditionType ===
|
|
71
71
|
ConditionDescriptor_1.ConditionType.AIPrompt) {
|
|
72
|
-
details.
|
|
73
|
-
this.conditionAction.conditionDescriptor.userPrompt
|
|
74
|
-
|
|
75
|
-
this.conditionAction.conditionDescriptor.
|
|
72
|
+
details.aiPrompt = {
|
|
73
|
+
userPrompt: this.conditionAction.conditionDescriptor.userPrompt,
|
|
74
|
+
metaPrompt: this.conditionAction.conditionDescriptor.metaPrompt,
|
|
75
|
+
criteria: this.conditionAction.conditionDescriptor.criteria,
|
|
76
|
+
};
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
79
|
if (this.primaryAction instanceof GetVariableValue_1.GetVariableValue) {
|
|
@@ -111,6 +112,7 @@ class IfConditionStep extends MablStep_1.MablStep {
|
|
|
111
112
|
return details;
|
|
112
113
|
}
|
|
113
114
|
static getActionsFromYamlForCondition(stepArgs) {
|
|
115
|
+
var _a, _b, _c, _d, _e;
|
|
114
116
|
const actions = [];
|
|
115
117
|
if (stepArgs.selector) {
|
|
116
118
|
const findAction = FindAction_1.FindAction.findActionFromStepArgs(stepArgs);
|
|
@@ -133,7 +135,13 @@ class IfConditionStep extends MablStep_1.MablStep {
|
|
|
133
135
|
if (stepArgs.condition) {
|
|
134
136
|
const conditionType = ConditionDescriptor_1.AssertionStepNameToField[stepArgs.condition];
|
|
135
137
|
if (conditionType === 'ai_prompt') {
|
|
136
|
-
actions.push(new ConditionAction_1.ConditionAction(this.getConditionActionNameForConditionType(conditionType), [
|
|
138
|
+
actions.push(new ConditionAction_1.ConditionAction(this.getConditionActionNameForConditionType(conditionType), [
|
|
139
|
+
(_b = (_a = stepArgs.aiPrompt) === null || _a === void 0 ? void 0 : _a.userPrompt) !== null && _b !== void 0 ? _b : stepArgs.userPrompt,
|
|
140
|
+
{
|
|
141
|
+
metaPrompt: (_d = (_c = stepArgs.aiPrompt) === null || _c === void 0 ? void 0 : _c.metaPrompt) !== null && _d !== void 0 ? _d : stepArgs.metaPrompt,
|
|
142
|
+
criteria: (_e = stepArgs.aiPrompt) === null || _e === void 0 ? void 0 : _e.criteria,
|
|
143
|
+
},
|
|
144
|
+
]));
|
|
137
145
|
}
|
|
138
146
|
else {
|
|
139
147
|
actions.push(new ConditionAction_1.ConditionAction(this.getConditionActionNameForConditionType(conditionType), [
|
package/mobile/types.js
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MobileAutomationName = void 0;
|
|
4
|
+
var MobileAutomationName;
|
|
5
|
+
(function (MobileAutomationName) {
|
|
6
|
+
MobileAutomationName["UiAutomator2"] = "UiAutomator2";
|
|
7
|
+
MobileAutomationName["XCUITest"] = "XCUITest";
|
|
8
|
+
})(MobileAutomationName || (exports.MobileAutomationName = MobileAutomationName = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mablhq/mabl-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.45.2",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "The official mabl command line interface tool",
|
|
6
6
|
"main": "index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"adm-zip": "0.5.10",
|
|
33
33
|
"agent-base": "6.0.2",
|
|
34
34
|
"analytics-node": "6.2.0",
|
|
35
|
-
"appium": "2.3
|
|
35
|
+
"appium": "2.11.3",
|
|
36
36
|
"async-mutex": "0.3.1",
|
|
37
37
|
"async-retry": "1.3.3",
|
|
38
38
|
"axe-core": "4.8.3",
|
|
@@ -98,8 +98,7 @@
|
|
|
98
98
|
"tough-cookie": "4.0.0",
|
|
99
99
|
"triple-beam": "1.3.0",
|
|
100
100
|
"uuid": "9.0.0",
|
|
101
|
-
"
|
|
102
|
-
"webdriverio": "7.30.0",
|
|
101
|
+
"webdriverio": "8.39.1",
|
|
103
102
|
"winston": "3.13.0",
|
|
104
103
|
"winston-transport": "4.7.0",
|
|
105
104
|
"xpath": "0.0.32",
|
|
@@ -75,6 +75,11 @@ class ExportRequestProvider {
|
|
|
75
75
|
}
|
|
76
76
|
async processExport() {
|
|
77
77
|
try {
|
|
78
|
+
const testRun = await this.apiClient.getTestRun(this.targetEntityId);
|
|
79
|
+
if (testRun.test_type === mablApi_1.TestTypeEnum.Api) {
|
|
80
|
+
loggingProvider_1.logger.error(chalk.red(`Test run export not supported for API test runs: ${this.targetEntityId}`));
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
78
83
|
loggingProvider_1.logger.info(`Export ${this.targetEntityType} [${chalk.magenta.bold(this.targetEntityId)}]`);
|
|
79
84
|
this.createExportSpinner = ora({
|
|
80
85
|
prefixText: ' ',
|