@mablhq/mabl-cli 2.6.7 → 2.8.25
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 +14 -0
- package/api/mablApiClient.js +17 -1
- package/api/types.js +1 -0
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumPageDelegate.js +3 -0
- package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractPageDelegate.js +3 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +6 -4
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +1 -1
- package/cli.js +1 -1
- package/commands/commandUtil/fileUtil.js +8 -7
- package/commands/config/config_cmds/install.js +2 -2
- package/domUtil/index.js +1 -1
- package/execution/index.js +9 -9
- package/mablApi/index.js +1 -1
- package/mablscript/steps/CreateVariableStep.js +23 -0
- package/mablscript/types/CreateVariableStepDescriptor.js +1 -0
- package/mablscriptFind/index.js +1 -1
- package/mobile/index.js +2 -0
- package/mobile/types.js +2 -0
- package/package.json +5 -3
- package/proxy/index.js +2 -2
- package/resources/mablFind.js +1 -1
- package/upload/index.js +2 -5
- package/upload/index.js.LICENSE.txt +27 -0
- package/util/fileUploadUtil.js +33 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* mime-db
|
|
3
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
4
|
+
* MIT Licensed
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/*!
|
|
8
|
+
* mime-types
|
|
9
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
10
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
11
|
+
* MIT Licensed
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/*! *****************************************************************************
|
|
15
|
+
Copyright (c) Microsoft Corporation.
|
|
16
|
+
|
|
17
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
18
|
+
purpose with or without fee is hereby granted.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
21
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
22
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
23
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
24
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
25
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
26
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
27
|
+
***************************************************************************** */
|
package/util/fileUploadUtil.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.removeUploadDirs = exports.cleanupOldFiles = exports.downloadFileUpload = void 0;
|
|
29
|
+
exports.downloadFileUploadsAndSetReferenceInContext = exports.downloadAllFileUploadsAndSetContext = exports.createTempDirectoryForFileUploads = exports.createFileUploadDirectoryName = exports.removeUploadDirs = exports.cleanupOldFiles = exports.downloadFileUpload = void 0;
|
|
30
30
|
const axios_1 = __importDefault(require("axios"));
|
|
31
31
|
const axiosProxyConfig_1 = require("../http/axiosProxyConfig");
|
|
32
32
|
const path_1 = __importDefault(require("path"));
|
|
@@ -112,3 +112,35 @@ function removeUploadDirs(dirFullPath) {
|
|
|
112
112
|
fs.rmSync(dirFullPath, rmOpts);
|
|
113
113
|
}
|
|
114
114
|
exports.removeUploadDirs = removeUploadDirs;
|
|
115
|
+
function createFileUploadDirectoryName() {
|
|
116
|
+
const dir = Globals_1.Globals.getUploadDirectory();
|
|
117
|
+
const prefix = Globals_1.Globals.getUploadDirectoryPrefix();
|
|
118
|
+
return `${dir}/${prefix}${Date.now()}-`;
|
|
119
|
+
}
|
|
120
|
+
exports.createFileUploadDirectoryName = createFileUploadDirectoryName;
|
|
121
|
+
function createTempDirectoryForFileUploads(fileUploadDirName) {
|
|
122
|
+
return fs.mkdtempSync(fileUploadDirName);
|
|
123
|
+
}
|
|
124
|
+
exports.createTempDirectoryForFileUploads = createTempDirectoryForFileUploads;
|
|
125
|
+
async function downloadAllFileUploadsAndSetContext(apiClient, testContext, uploadDirectory, fileUploadReferences) {
|
|
126
|
+
await Promise.all(fileUploadReferences.map(async (fileRef) => {
|
|
127
|
+
const fileUploadUrl = await apiClient.getFileUploadUrl(fileRef.id);
|
|
128
|
+
const finalPathDownloaded = await downloadFileUpload(fileUploadUrl.redirectUrl, fileRef, uploadDirectory, apiClient);
|
|
129
|
+
testContext.setFileUploadReference(fileRef.id, finalPathDownloaded);
|
|
130
|
+
}));
|
|
131
|
+
}
|
|
132
|
+
exports.downloadAllFileUploadsAndSetContext = downloadAllFileUploadsAndSetContext;
|
|
133
|
+
async function downloadFileUploadsAndSetReferenceInContext(apiClient, testContext, fileUploadReferences) {
|
|
134
|
+
const uploadDirs = testContext.getFileUploadDirs();
|
|
135
|
+
let uploadDirectoryPath;
|
|
136
|
+
if (uploadDirs.size === 0) {
|
|
137
|
+
const dirName = createFileUploadDirectoryName();
|
|
138
|
+
uploadDirectoryPath = createTempDirectoryForFileUploads(dirName);
|
|
139
|
+
testContext.addFileUploadDir(uploadDirectoryPath);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
uploadDirectoryPath = uploadDirs.values().next().value;
|
|
143
|
+
}
|
|
144
|
+
return downloadAllFileUploadsAndSetContext(apiClient, testContext, uploadDirectoryPath, fileUploadReferences);
|
|
145
|
+
}
|
|
146
|
+
exports.downloadFileUploadsAndSetReferenceInContext = downloadFileUploadsAndSetReferenceInContext;
|