@mablhq/mabl-cli 2.5.4 → 2.6.7
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/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +5 -2
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +6 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +3 -0
- package/commands/commandUtil/codeInsights.js +7 -1
- package/execution/index.js +3 -3
- package/http/axiosProxyConfig.js +2 -25
- package/index.d.ts +1 -0
- package/mablApi/index.js +1 -1
- package/mablscript/importer.js +2 -0
- package/mablscript/mobile/steps/PushFileStep.js +27 -0
- package/mablscript/mobile/tests/steps/PushFileStep.mobiletest.js +55 -0
- package/mablscript/types/mobile/PushFileDescriptor.js +2 -0
- package/package.json +2 -2
- package/util/asyncUtil.js +9 -7
- package/util/logUtils.js +14 -8
- package/util/pureUtil.js +9 -1
package/mablscript/importer.js
CHANGED
|
@@ -63,6 +63,7 @@ const NavigateHomeStep_1 = require("./mobile/steps/NavigateHomeStep");
|
|
|
63
63
|
const CreateVariableStepDescriptor_1 = require("./types/CreateVariableStepDescriptor");
|
|
64
64
|
const JavaScriptDescriptor_1 = require("./types/JavaScriptDescriptor");
|
|
65
65
|
const MablStepV2_1 = require("./MablStepV2");
|
|
66
|
+
const PushFileStep_1 = require("./mobile/steps/PushFileStep");
|
|
66
67
|
const ActionTypes = [
|
|
67
68
|
AwaitDownloadAction_1.AwaitDownloadAction,
|
|
68
69
|
AwaitPDFDownloadAction_1.AwaitPDFDownloadAction,
|
|
@@ -122,6 +123,7 @@ const MobileStepTypes = [
|
|
|
122
123
|
EnterTextStep_2.EnterTextStep,
|
|
123
124
|
SetOrientationStep_1.SetOrientationStep,
|
|
124
125
|
ScrollStep_1.ScrollStep,
|
|
126
|
+
PushFileStep_1.PushFileStep,
|
|
125
127
|
];
|
|
126
128
|
const SyntheticActionCodes = [
|
|
127
129
|
'autologin',
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PushFileStep = void 0;
|
|
4
|
+
const MablStepV2_1 = require("../../MablStepV2");
|
|
5
|
+
class PushFileStep extends MablStepV2_1.MablStepV2 {
|
|
6
|
+
constructor(descriptor) {
|
|
7
|
+
super(PushFileStep.stepName, descriptor, PushFileStep.stepName);
|
|
8
|
+
}
|
|
9
|
+
stepDescription() {
|
|
10
|
+
const filesLength = this.descriptor.files.length;
|
|
11
|
+
if (filesLength > 1) {
|
|
12
|
+
return `Push ${filesLength} files to the test device`;
|
|
13
|
+
}
|
|
14
|
+
const firstFile = this.descriptor.files[0];
|
|
15
|
+
if (firstFile.file.name) {
|
|
16
|
+
return `Push the file "${firstFile.file.name}" to the test device at path "${firstFile.path}"`;
|
|
17
|
+
}
|
|
18
|
+
return `Push file to the test device at path "${firstFile.path}"`;
|
|
19
|
+
}
|
|
20
|
+
static fromYaml(_stepName, stepDescriptor) {
|
|
21
|
+
return new PushFileStep(stepDescriptor);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.PushFileStep = PushFileStep;
|
|
25
|
+
PushFileStep.stepName = 'PushFile';
|
|
26
|
+
PushFileStep.yamlMablScriptNames = [PushFileStep.stepName];
|
|
27
|
+
PushFileStep.stepVersion = 2;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const StepTestsUtil_1 = require("../StepTestsUtil");
|
|
4
|
+
const PushFileStep_1 = require("../../steps/PushFileStep");
|
|
5
|
+
describe('Push File steps parse correctly', () => {
|
|
6
|
+
it('Parses a PushFile step', () => {
|
|
7
|
+
const pushFileDescriptor = {
|
|
8
|
+
id: 'pushItRealGood',
|
|
9
|
+
files: [
|
|
10
|
+
{
|
|
11
|
+
file: {
|
|
12
|
+
id: 'id-1',
|
|
13
|
+
name: 'candy1.jpeg',
|
|
14
|
+
},
|
|
15
|
+
path: '@mabl.sandbox:documents/Presentation.key',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
const steps = [
|
|
20
|
+
{
|
|
21
|
+
PushFile: pushFileDescriptor,
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
(0, StepTestsUtil_1.parseAndValidateYamlConversion)(steps, PushFileStep_1.PushFileStep.stepName, pushFileDescriptor);
|
|
25
|
+
const pushFileStep = new PushFileStep_1.PushFileStep(pushFileDescriptor);
|
|
26
|
+
expect(pushFileStep.stepId()).toEqual(pushFileDescriptor.id);
|
|
27
|
+
const stepDescription = pushFileStep.stepDescription();
|
|
28
|
+
expect(stepDescription).toEqual(`Push the file \"candy1.jpeg\" to the test device at path \"@mabl.sandbox:documents/Presentation.key\"`);
|
|
29
|
+
});
|
|
30
|
+
it('Humanizes a push file step with multiple files', () => {
|
|
31
|
+
const pushFileDescriptor = {
|
|
32
|
+
id: 'pushItRealGood',
|
|
33
|
+
files: [
|
|
34
|
+
{
|
|
35
|
+
file: {
|
|
36
|
+
id: 'id-1',
|
|
37
|
+
name: 'candy1.jpeg',
|
|
38
|
+
},
|
|
39
|
+
path: '@mabl.sandbox:documents/Presentation.key',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
file: {
|
|
43
|
+
id: 'id-2',
|
|
44
|
+
name: 'candy2.jpeg',
|
|
45
|
+
},
|
|
46
|
+
path: '@mabl.sandbox:documents/Presentations.key',
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
};
|
|
50
|
+
const pushFileStep = new PushFileStep_1.PushFileStep(pushFileDescriptor);
|
|
51
|
+
expect(pushFileStep.stepId()).toEqual(pushFileDescriptor.id);
|
|
52
|
+
const stepDescription = pushFileStep.stepDescription();
|
|
53
|
+
expect(stepDescription).toEqual(`Push 2 files to the test device`);
|
|
54
|
+
});
|
|
55
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mablhq/mabl-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.7",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "The official mabl command line interface tool",
|
|
6
6
|
"main": "index.js",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"newman": "5.3.2",
|
|
76
76
|
"open": "6.4.0",
|
|
77
77
|
"ora": "4.0.4",
|
|
78
|
-
"playwright": "1.
|
|
78
|
+
"playwright": "1.40.0",
|
|
79
79
|
"pluralize": "8.0.0",
|
|
80
80
|
"pngjs": "6.0.0",
|
|
81
81
|
"portfinder": "1.0.28",
|
package/util/asyncUtil.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.filterAsync = exports.
|
|
3
|
+
exports.filterAsync = exports.TimeoutError = exports.promiseWithTimeout = void 0;
|
|
4
4
|
const loggingProvider_1 = require("../providers/logging/loggingProvider");
|
|
5
|
+
const pureUtil_1 = require("./pureUtil");
|
|
6
|
+
const logUtils_1 = require("./logUtils");
|
|
5
7
|
async function promiseWithTimeout(promise, timeoutMillis, description, timeoutType = 'mabl timeout', printToConsole = true) {
|
|
6
8
|
const startTimeMillis = new Date().getTime();
|
|
7
9
|
const { timer, cancelTimer, errorMessage } = startTimer(timeoutMillis, description, timeoutType);
|
|
@@ -48,12 +50,12 @@ const startTimer = (timeoutMillis, description, timeoutType) => {
|
|
|
48
50
|
errorMessage: timeoutError.message,
|
|
49
51
|
};
|
|
50
52
|
};
|
|
51
|
-
function mapAsync(array, callback) {
|
|
52
|
-
return Promise.all(array.map(callback));
|
|
53
|
-
}
|
|
54
|
-
exports.mapAsync = mapAsync;
|
|
55
53
|
async function filterAsync(array, callback) {
|
|
56
|
-
const
|
|
57
|
-
|
|
54
|
+
const results = await Promise.allSettled(array.map(callback));
|
|
55
|
+
(0, logUtils_1.logPromiseSettledRejections)(results);
|
|
56
|
+
return array.filter((_, index) => {
|
|
57
|
+
const result = results[index];
|
|
58
|
+
return (0, pureUtil_1.isFulfilledPromise)(result) && result.value;
|
|
59
|
+
});
|
|
58
60
|
}
|
|
59
61
|
exports.filterAsync = filterAsync;
|
package/util/logUtils.js
CHANGED
|
@@ -3,11 +3,12 @@ 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.logPromiseSettledRejections = exports.logErrorVerbose = exports.formatTimestamp = exports.valueToString = exports.logWebUIAndCliOutput = exports.logWebUI = exports.findResultSeverityToLogLevel = exports.logCliOutput = exports.logInternal = void 0;
|
|
6
|
+
exports.getPromiseSettledValues = exports.logPromiseSettledRejections = exports.logErrorVerbose = exports.formatTimestamp = exports.valueToString = exports.logWebUIAndCliOutput = exports.logWebUI = exports.findResultSeverityToLogLevel = exports.logCliOutput = exports.logInternal = void 0;
|
|
7
7
|
const mablscriptFind_1 = require("../mablscriptFind");
|
|
8
8
|
const loggingProvider_1 = require("../providers/logging/loggingProvider");
|
|
9
9
|
const moment_1 = __importDefault(require("moment"));
|
|
10
10
|
const constants_1 = require("../commands/constants");
|
|
11
|
+
const pureUtil_1 = require("./pureUtil");
|
|
11
12
|
function logInternal(logLine, ...meta) {
|
|
12
13
|
loggingProvider_1.logger.debug(logLine, meta);
|
|
13
14
|
}
|
|
@@ -89,13 +90,18 @@ function logErrorVerbose(error, context) {
|
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
92
|
exports.logErrorVerbose = logErrorVerbose;
|
|
92
|
-
function logPromiseSettledRejections(promises) {
|
|
93
|
+
function logPromiseSettledRejections(promises, reThrow = false) {
|
|
93
94
|
promises
|
|
94
|
-
.filter(
|
|
95
|
-
.forEach((promise) =>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
95
|
+
.filter(pureUtil_1.isRejectedPromise)
|
|
96
|
+
.forEach((promise) => logErrorVerbose(promise.reason));
|
|
97
|
+
const findRejectedPromise = promises.find(pureUtil_1.isRejectedPromise);
|
|
98
|
+
if (findRejectedPromise && reThrow) {
|
|
99
|
+
throw findRejectedPromise.reason;
|
|
100
|
+
}
|
|
100
101
|
}
|
|
101
102
|
exports.logPromiseSettledRejections = logPromiseSettledRejections;
|
|
103
|
+
function getPromiseSettledValues(promises, reThrow = false) {
|
|
104
|
+
logPromiseSettledRejections(promises, reThrow);
|
|
105
|
+
return promises.filter(pureUtil_1.isFulfilledPromise).map((promise) => promise.value);
|
|
106
|
+
}
|
|
107
|
+
exports.getPromiseSettledValues = getPromiseSettledValues;
|
package/util/pureUtil.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.getCaseInsensitiveProperty = exports.extractKeyCountsFromArgs = exports.getCliName = exports.getCliVersion = exports.stringifyIfPresent = exports.stringify = exports.isWholeNumber = exports.isString = exports.isNullish = exports.isDefined = void 0;
|
|
26
|
+
exports.getCaseInsensitiveProperty = exports.extractKeyCountsFromArgs = exports.getCliName = exports.getCliVersion = exports.stringifyIfPresent = exports.stringify = exports.isRejectedPromise = exports.isFulfilledPromise = exports.isWholeNumber = exports.isString = exports.isNullish = exports.isDefined = void 0;
|
|
27
27
|
const fs = __importStar(require("fs"));
|
|
28
28
|
const path = __importStar(require("path"));
|
|
29
29
|
const possibleCliPackagePaths = Object.freeze([
|
|
@@ -65,6 +65,14 @@ function isWholeNumber(value) {
|
|
|
65
65
|
return parsed - Math.floor(parsed) === 0;
|
|
66
66
|
}
|
|
67
67
|
exports.isWholeNumber = isWholeNumber;
|
|
68
|
+
function isFulfilledPromise(settledPromise) {
|
|
69
|
+
return settledPromise.status === 'fulfilled';
|
|
70
|
+
}
|
|
71
|
+
exports.isFulfilledPromise = isFulfilledPromise;
|
|
72
|
+
function isRejectedPromise(settledPromise) {
|
|
73
|
+
return settledPromise.status === 'rejected';
|
|
74
|
+
}
|
|
75
|
+
exports.isRejectedPromise = isRejectedPromise;
|
|
68
76
|
function stringify(value) {
|
|
69
77
|
if (isNullish(value)) {
|
|
70
78
|
return '';
|