@mablhq/mabl-cli 1.25.1 → 1.25.19
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/Globals.js +20 -0
- package/api/featureSet.js +4 -0
- package/api/mablApiClient.js +10 -2
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +19 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +3 -0
- package/commands/deploy/deploy_cmds/awaitDeploymentCompletion.js +2 -6
- package/commands/deploy/deploy_cmds/create.js +0 -3
- package/commands/deploy/deploy_cmds/executionResultPresenter.js +9 -27
- package/commands/environments/environments_cmds/create.js +3 -0
- package/commands/tests/testsUtil.js +25 -20
- package/domUtil/index.js +1 -1
- package/execution/index.js +1 -1
- package/execution/index.js.LICENSE.txt +6 -2
- package/mablApi/index.js +1 -1
- package/mablscript/diffing/diffingUtil.js +81 -16
- package/mablscript/steps/EvaluateFlowStep.js +8 -3
- package/mablscriptFind/index.js +1 -1
- package/package.json +11 -10
- package/reporters/__tests__/resources/sampleData.js +5 -0
- package/resources/mablFind.js +1 -1
- package/util/asyncUtil.js +7 -6
- package/util/markdownUtil.js +3 -21
- package/util/timeUtil.js +31 -0
|
@@ -3,7 +3,7 @@ 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.diffFlows = exports.diffTests = exports.convertDiffingFormatIntoDiffingSteps = exports.flattenTestFlowsIntoLineDiffingFormat = exports.convertFlowToStepList = exports.lineModeDiff = exports.DiffOperation = void 0;
|
|
6
|
+
exports.diffFlows = exports.diffTests = exports.convertDiffingFormatIntoDiffingSteps = exports.flattenTestFlowsIntoLineDiffingFormat = exports.constructTestFlowsFromSteps = exports.flattenTestFlowsIntoSteps = exports.convertStepListToFlow = exports.convertFlowToStepList = exports.lineModeDiff = exports.DiffOperation = void 0;
|
|
7
7
|
const mablApi_1 = require("../../mablApi");
|
|
8
8
|
const importer_1 = require("../importer");
|
|
9
9
|
const EvaluateFlowStep_1 = require("../steps/EvaluateFlowStep");
|
|
@@ -46,24 +46,89 @@ function convertFlowToStepList(flow, flowConfig) {
|
|
|
46
46
|
if (!flow.reusable && flow.flow_type === mablApi_1.Flow.FlowTypeEnum.Mablscript) {
|
|
47
47
|
return (0, importer_1.parseMablScriptIntoSteps)(flow);
|
|
48
48
|
}
|
|
49
|
-
const evaluateFlowStep = new EvaluateFlowStep_1.EvaluateFlowStep(EvaluateFlowStep_1.EvaluateFlowStep.mablScriptStepNames[0], [
|
|
50
|
-
{
|
|
51
|
-
invariant_id: flow === null || flow === void 0 ? void 0 : flow.invariant_id,
|
|
52
|
-
},
|
|
53
|
-
flowConfig,
|
|
54
|
-
], []);
|
|
49
|
+
const evaluateFlowStep = new EvaluateFlowStep_1.EvaluateFlowStep(EvaluateFlowStep_1.EvaluateFlowStep.mablScriptStepNames[0], [{ invariant_id: flow === null || flow === void 0 ? void 0 : flow.invariant_id }, flowConfig], []);
|
|
55
50
|
if (flow.description) {
|
|
56
51
|
evaluateFlowStep.setDescription(flow.description);
|
|
57
52
|
}
|
|
58
53
|
return [evaluateFlowStep];
|
|
59
54
|
}
|
|
60
55
|
exports.convertFlowToStepList = convertFlowToStepList;
|
|
61
|
-
function
|
|
62
|
-
|
|
56
|
+
function convertStepListToFlow(steps) {
|
|
57
|
+
if (steps.length > 1 && steps.some((step) => (0, EvaluateFlowStep_1.isEvaluateFlowStep)(step))) {
|
|
58
|
+
throw new Error('EvaluateFlow step(s) cannot be combined with other steps in a flow');
|
|
59
|
+
}
|
|
60
|
+
if ((0, EvaluateFlowStep_1.isEvaluateFlowStep)(steps[0])) {
|
|
61
|
+
const evaluateFlowStep = steps[0];
|
|
62
|
+
const { flowDescriptor, config: flowConfig } = evaluateFlowStep;
|
|
63
|
+
const description = evaluateFlowStep.getDescription();
|
|
64
|
+
const flow = { ...flowDescriptor };
|
|
65
|
+
if (description) {
|
|
66
|
+
flow.description = description;
|
|
67
|
+
}
|
|
68
|
+
return { flow, flowConfig };
|
|
69
|
+
}
|
|
70
|
+
const stepAnnotations = steps.reduce((annotations, step, index) => {
|
|
71
|
+
const annotation = step.getAnnotation();
|
|
72
|
+
if (annotation) {
|
|
73
|
+
const key = Number(index).toString();
|
|
74
|
+
annotations[key] = annotation;
|
|
75
|
+
}
|
|
76
|
+
return annotations;
|
|
77
|
+
}, {});
|
|
78
|
+
const flow = {
|
|
79
|
+
script: addTrailingNewline((0, importer_1.mablscriptTheLoadedSteps)(steps)),
|
|
80
|
+
script_description: steps
|
|
81
|
+
.map((step) => { var _a; return (_a = step.getDescription()) !== null && _a !== void 0 ? _a : ''; })
|
|
82
|
+
.join('\n'),
|
|
83
|
+
step_annotations: stepAnnotations,
|
|
84
|
+
};
|
|
85
|
+
return { flow };
|
|
86
|
+
}
|
|
87
|
+
exports.convertStepListToFlow = convertStepListToFlow;
|
|
88
|
+
function flattenTestFlowsIntoSteps(flows, flowConfigs) {
|
|
89
|
+
return flows.flatMap((flow, index) => convertFlowToStepList(flow, flowConfigs === null || flowConfigs === void 0 ? void 0 : flowConfigs[index]));
|
|
90
|
+
}
|
|
91
|
+
exports.flattenTestFlowsIntoSteps = flattenTestFlowsIntoSteps;
|
|
92
|
+
function constructTestFlowsFromSteps(steps) {
|
|
93
|
+
const flowSteps = [];
|
|
94
|
+
let chunk = [];
|
|
95
|
+
for (const step of steps) {
|
|
96
|
+
if ((0, EvaluateFlowStep_1.isEvaluateFlowStep)(step)) {
|
|
97
|
+
if (chunk.length > 0) {
|
|
98
|
+
flowSteps.push(chunk);
|
|
99
|
+
flowSteps.push([step]);
|
|
100
|
+
chunk = [];
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
flowSteps.push([step]);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
chunk.push(step);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (chunk.length > 0) {
|
|
111
|
+
flowSteps.push(chunk);
|
|
112
|
+
}
|
|
113
|
+
const output = {
|
|
114
|
+
flows: [],
|
|
115
|
+
flowConfigs: {},
|
|
116
|
+
};
|
|
117
|
+
flowSteps.reduce((output, chunk, index) => {
|
|
118
|
+
const { flow, flowConfig } = convertStepListToFlow(chunk);
|
|
119
|
+
output.flows.push(flow);
|
|
120
|
+
if (flowConfig) {
|
|
121
|
+
const key = Number(index).toString();
|
|
122
|
+
output.flowConfigs[key] = flowConfig;
|
|
123
|
+
}
|
|
124
|
+
return output;
|
|
125
|
+
}, output);
|
|
126
|
+
return output;
|
|
63
127
|
}
|
|
128
|
+
exports.constructTestFlowsFromSteps = constructTestFlowsFromSteps;
|
|
64
129
|
function flattenTestFlowsIntoLineDiffingFormat(flows, flowConfig) {
|
|
65
130
|
const flattenedSteps = flattenTestFlowsIntoSteps(flows, flowConfig);
|
|
66
|
-
const diffingFormat =
|
|
131
|
+
const diffingFormat = addTrailingNewline(flattenedSteps.map((step) => step.toLineDiffFormat()).join('\n'));
|
|
67
132
|
return { flattenedSteps, diffingFormat };
|
|
68
133
|
}
|
|
69
134
|
exports.flattenTestFlowsIntoLineDiffingFormat = flattenTestFlowsIntoLineDiffingFormat;
|
|
@@ -110,9 +175,9 @@ exports.diffTests = diffTests;
|
|
|
110
175
|
function diffFlows(flow1, flow2) {
|
|
111
176
|
var _a, _b;
|
|
112
177
|
const flow1Steps = (0, importer_1.parseMablScriptIntoSteps)(flow1);
|
|
113
|
-
const formattedFlow1Steps =
|
|
178
|
+
const formattedFlow1Steps = addTrailingNewline(flow1Steps.map((step) => step.toLineDiffFormat()).join('\n'));
|
|
114
179
|
const flow2Steps = (0, importer_1.parseMablScriptIntoSteps)(flow2);
|
|
115
|
-
const formattedFlow2Steps =
|
|
180
|
+
const formattedFlow2Steps = addTrailingNewline(flow2Steps.map((step) => step.toLineDiffFormat()).join('\n'));
|
|
116
181
|
const flattenedDiffs = lineModeDiff(formattedFlow1Steps, formattedFlow2Steps);
|
|
117
182
|
const stepDiffs = convertDiffingFormatIntoDiffingSteps(flattenedDiffs, flow1Steps, flow2Steps);
|
|
118
183
|
const parametersDiff = diffFlowVariables(flow1.parameters, flow2.parameters);
|
|
@@ -138,9 +203,9 @@ function flattenFlowVariables(flowVariables) {
|
|
|
138
203
|
var _a;
|
|
139
204
|
return ((_a = flowVariables === null || flowVariables === void 0 ? void 0 : flowVariables.sort((a, b) => a.name.localeCompare(b.name)).map((parameter) => (0, fast_json_stable_stringify_1.default)(parameter)).join('\n')) !== null && _a !== void 0 ? _a : '');
|
|
140
205
|
}
|
|
141
|
-
function
|
|
142
|
-
if (!
|
|
143
|
-
return
|
|
206
|
+
function addTrailingNewline(text) {
|
|
207
|
+
if (!text) {
|
|
208
|
+
return text;
|
|
144
209
|
}
|
|
145
|
-
return
|
|
210
|
+
return text + '\n';
|
|
146
211
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EvaluateFlowStep = void 0;
|
|
3
|
+
exports.isEvaluateFlowStep = exports.EvaluateFlowStep = exports.EVALUATE_FLOW_STEP_NAME = void 0;
|
|
4
4
|
const MablStep_1 = require("../MablStep");
|
|
5
5
|
const domUtil_1 = require("../../domUtil");
|
|
6
|
+
exports.EVALUATE_FLOW_STEP_NAME = 'EvaluateFlow';
|
|
6
7
|
class EvaluateFlowStep extends MablStep_1.MablStep {
|
|
7
8
|
constructor(name, args, actions) {
|
|
8
9
|
super(name, args, actions);
|
|
@@ -15,7 +16,7 @@ class EvaluateFlowStep extends MablStep_1.MablStep {
|
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
getStepName() {
|
|
18
|
-
return
|
|
19
|
+
return exports.EVALUATE_FLOW_STEP_NAME;
|
|
19
20
|
}
|
|
20
21
|
toStepDescriptor() {
|
|
21
22
|
return {
|
|
@@ -37,4 +38,8 @@ class EvaluateFlowStep extends MablStep_1.MablStep {
|
|
|
37
38
|
}
|
|
38
39
|
exports.EvaluateFlowStep = EvaluateFlowStep;
|
|
39
40
|
EvaluateFlowStep.mablScriptStepNames = ['evaluate_flow'];
|
|
40
|
-
EvaluateFlowStep.yamlMablScriptNames = [
|
|
41
|
+
EvaluateFlowStep.yamlMablScriptNames = [exports.EVALUATE_FLOW_STEP_NAME];
|
|
42
|
+
function isEvaluateFlowStep(step) {
|
|
43
|
+
return (step === null || step === void 0 ? void 0 : step.getStepName()) === exports.EVALUATE_FLOW_STEP_NAME;
|
|
44
|
+
}
|
|
45
|
+
exports.isEvaluateFlowStep = isEvaluateFlowStep;
|