@testrigor/testrigor-cli 1.0.0 → 1.0.1
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/README.md +452 -0
- package/dist/commands/authenticate.js +1 -1
- package/dist/commands/test-suite/config.js +1 -1
- package/dist/commands/test-suite/run.js +18 -17
- package/dist/commands/test-suite/validate-syntax.js +3 -2
- package/dist/flags/chrome-extension.js +3 -2
- package/dist/types.d.ts +0 -1
- package/dist/util/appium.js +29 -25
- package/dist/util/certificate-uploader.js +5 -5
- package/dist/util/config.js +15 -15
- package/dist/util/parser.js +8 -8
- package/dist/util/request-builder.d.ts +1 -1
- package/dist/util/request-builder.js +7 -7
- package/dist/util/trtc.d.ts +2 -0
- package/dist/util/trtc.js +107 -38
- package/dist/util/tunnel.js +7 -6
- package/dist/util/type-guards.js +3 -4
- package/dist/util/utils.d.ts +3 -3
- package/dist/util/utils.js +23 -23
- package/dist/util/variable-file-uploader.js +7 -7
- package/dist/util/variables-path-parser.js +4 -4
- package/oclif.manifest.json +1 -1
- package/package.json +7 -7
package/dist/util/utils.js
CHANGED
|
@@ -1,61 +1,66 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
exports.UPLOAD_TIMEOUT_MS = exports.MAX_FILE_SIZE_100_MB = void 0;
|
|
4
|
+
exports.createDirectory = createDirectory;
|
|
5
|
+
exports.getHomeDir = getHomeDir;
|
|
6
|
+
exports.pathExists = pathExists;
|
|
7
|
+
exports.isRunningOnCi = isRunningOnCi;
|
|
8
|
+
exports.rendererToUse = rendererToUse;
|
|
9
|
+
exports.isYamlFile = isYamlFile;
|
|
10
|
+
exports.isTextFile = isTextFile;
|
|
11
|
+
exports.isJsonFile = isJsonFile;
|
|
12
|
+
exports.isValidFileExtensionToUpload = isValidFileExtensionToUpload;
|
|
13
|
+
exports.getExtensionLength = getExtensionLength;
|
|
14
|
+
exports.removeExtension = removeExtension;
|
|
15
|
+
exports.extractUrlWithoutQueryParams = extractUrlWithoutQueryParams;
|
|
16
|
+
exports.extractRunIdFromDetailsUrl = extractRunIdFromDetailsUrl;
|
|
17
|
+
exports.isValidUrl = isValidUrl;
|
|
18
|
+
const tslib_1 = require("tslib");
|
|
19
|
+
const fs_1 = tslib_1.__importDefault(require("@supercharge/fs"));
|
|
20
|
+
const path = tslib_1.__importStar(require("path"));
|
|
21
|
+
const is_ci_1 = tslib_1.__importDefault(require("is-ci"));
|
|
8
22
|
const YAML_EXTENSION = ".yaml";
|
|
9
23
|
const YML_EXTENSION = ".yml";
|
|
10
24
|
const TXT_EXTENSION = ".txt";
|
|
11
25
|
const JSON_EXTENSION = ".json";
|
|
12
26
|
const FILE_UPLOAD_EXTENSIONS = [".zip", ".exe", ".msi", ".apk", ".aab", ".ipa"];
|
|
13
27
|
const DIRECTORY_NAME = ".testrigor";
|
|
14
|
-
const TESTRIGOR_CLI_HOME = process.env.TESTRIGOR_CLI_HOME || path.join(
|
|
28
|
+
const TESTRIGOR_CLI_HOME = process.env.TESTRIGOR_CLI_HOME || path.join(fs_1.default.homeDir(), DIRECTORY_NAME);
|
|
15
29
|
const NOT_AVAILABLE_TEST_SUITE_RUN = "not-available";
|
|
16
30
|
exports.MAX_FILE_SIZE_100_MB = 100 * 1024 * 1024;
|
|
17
31
|
exports.UPLOAD_TIMEOUT_MS = 10 * 60 * 1000; // 10 minutes for large file uploads
|
|
18
32
|
async function createDirectory(name) {
|
|
19
33
|
const directoryPath = path.join(TESTRIGOR_CLI_HOME, name);
|
|
20
|
-
await
|
|
34
|
+
await fs_1.default.ensureDir(directoryPath);
|
|
21
35
|
return directoryPath;
|
|
22
36
|
}
|
|
23
|
-
exports.createDirectory = createDirectory;
|
|
24
37
|
function getHomeDir() {
|
|
25
38
|
return TESTRIGOR_CLI_HOME;
|
|
26
39
|
}
|
|
27
|
-
exports.getHomeDir = getHomeDir;
|
|
28
40
|
async function pathExists(name) {
|
|
29
41
|
if (!name) {
|
|
30
42
|
return false;
|
|
31
43
|
}
|
|
32
|
-
return
|
|
44
|
+
return fs_1.default.pathExists(path.join(TESTRIGOR_CLI_HOME, name));
|
|
33
45
|
}
|
|
34
|
-
exports.pathExists = pathExists;
|
|
35
46
|
function isRunningOnCi() {
|
|
36
|
-
return
|
|
47
|
+
return is_ci_1.default;
|
|
37
48
|
}
|
|
38
|
-
exports.isRunningOnCi = isRunningOnCi;
|
|
39
49
|
function rendererToUse() {
|
|
40
50
|
return isRunningOnCi() ? "verbose" : "default";
|
|
41
51
|
}
|
|
42
|
-
exports.rendererToUse = rendererToUse;
|
|
43
52
|
function isYamlFile(fileName) {
|
|
44
53
|
return fileName.endsWith(YAML_EXTENSION) || fileName.endsWith(YML_EXTENSION);
|
|
45
54
|
}
|
|
46
|
-
exports.isYamlFile = isYamlFile;
|
|
47
55
|
function isTextFile(fileName) {
|
|
48
56
|
return fileName.endsWith(TXT_EXTENSION);
|
|
49
57
|
}
|
|
50
|
-
exports.isTextFile = isTextFile;
|
|
51
58
|
function isJsonFile(fileName) {
|
|
52
59
|
return fileName.endsWith(JSON_EXTENSION);
|
|
53
60
|
}
|
|
54
|
-
exports.isJsonFile = isJsonFile;
|
|
55
61
|
function isValidFileExtensionToUpload(fileName) {
|
|
56
62
|
return FILE_UPLOAD_EXTENSIONS.some((ext) => fileName.endsWith(ext));
|
|
57
63
|
}
|
|
58
|
-
exports.isValidFileExtensionToUpload = isValidFileExtensionToUpload;
|
|
59
64
|
function getExtensionLength(fileName) {
|
|
60
65
|
if (fileName.endsWith(YAML_EXTENSION)) {
|
|
61
66
|
return 5;
|
|
@@ -65,17 +70,14 @@ function getExtensionLength(fileName) {
|
|
|
65
70
|
}
|
|
66
71
|
return 0;
|
|
67
72
|
}
|
|
68
|
-
exports.getExtensionLength = getExtensionLength;
|
|
69
73
|
function removeExtension(fileName) {
|
|
70
74
|
return fileName.slice(0, -getExtensionLength(fileName));
|
|
71
75
|
}
|
|
72
|
-
exports.removeExtension = removeExtension;
|
|
73
76
|
function extractUrlWithoutQueryParams(urlString) {
|
|
74
77
|
const url = new URL(urlString);
|
|
75
78
|
url.search = "";
|
|
76
79
|
return url.toString();
|
|
77
80
|
}
|
|
78
|
-
exports.extractUrlWithoutQueryParams = extractUrlWithoutQueryParams;
|
|
79
81
|
function extractRunIdFromDetailsUrl(detailsUrl) {
|
|
80
82
|
if (!detailsUrl) {
|
|
81
83
|
return NOT_AVAILABLE_TEST_SUITE_RUN;
|
|
@@ -83,7 +85,6 @@ function extractRunIdFromDetailsUrl(detailsUrl) {
|
|
|
83
85
|
const parts = detailsUrl.split("/");
|
|
84
86
|
return parts[parts.length - 1];
|
|
85
87
|
}
|
|
86
|
-
exports.extractRunIdFromDetailsUrl = extractRunIdFromDetailsUrl;
|
|
87
88
|
function isValidUrl(url) {
|
|
88
89
|
try {
|
|
89
90
|
// Basic URL validation - accepts http, https, localhost, self, and supports ports
|
|
@@ -94,4 +95,3 @@ function isValidUrl(url) {
|
|
|
94
95
|
return false;
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
|
-
exports.isValidUrl = isValidUrl;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uploadVariableFile =
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
3
|
+
exports.uploadVariableFile = uploadVariableFile;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs_1 = tslib_1.__importDefault(require("@supercharge/fs"));
|
|
6
|
+
const path = tslib_1.__importStar(require("path"));
|
|
7
|
+
const node_fetch_commonjs_1 = tslib_1.__importDefault(require("node-fetch-commonjs"));
|
|
7
8
|
const utils_1 = require("./utils");
|
|
8
9
|
const type_guards_1 = require("./type-guards");
|
|
9
10
|
async function uploadVariableFile(api2BaseUrl, testSuiteId, token, localFilePath) {
|
|
10
11
|
const fileName = path.basename(localFilePath);
|
|
11
|
-
const fileSize =
|
|
12
|
+
const fileSize = fs_1.default.statSync(localFilePath).size;
|
|
12
13
|
const presignedResp = await (0, node_fetch_commonjs_1.default)(`${api2BaseUrl}/apps/${testSuiteId}/test_data/global_variables/file/pre_signed_url`, {
|
|
13
14
|
method: "POST",
|
|
14
15
|
body: JSON.stringify({ fileName }),
|
|
@@ -27,7 +28,7 @@ async function uploadVariableFile(api2BaseUrl, testSuiteId, token, localFilePath
|
|
|
27
28
|
!presignedJson.data) {
|
|
28
29
|
throw new Error(`Failed to request presigned URL for variable file '${fileName}': ${presignedJson.message}`);
|
|
29
30
|
}
|
|
30
|
-
const fileStream =
|
|
31
|
+
const fileStream = fs_1.default.createReadStream(localFilePath);
|
|
31
32
|
const putResp = await (0, node_fetch_commonjs_1.default)(presignedJson.data.url, {
|
|
32
33
|
method: "PUT",
|
|
33
34
|
body: fileStream,
|
|
@@ -40,4 +41,3 @@ async function uploadVariableFile(api2BaseUrl, testSuiteId, token, localFilePath
|
|
|
40
41
|
}
|
|
41
42
|
return (0, utils_1.extractUrlWithoutQueryParams)(presignedJson.data.url);
|
|
42
43
|
}
|
|
43
|
-
exports.uploadVariableFile = uploadVariableFile;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseVariablesJson =
|
|
4
|
-
const
|
|
5
|
-
const
|
|
3
|
+
exports.parseVariablesJson = parseVariablesJson;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
6
|
+
const path = tslib_1.__importStar(require("path"));
|
|
6
7
|
const type_guards_1 = require("./type-guards");
|
|
7
8
|
const MAX_FILE_SIZE_BYTES = 100 * 1024 * 1024;
|
|
8
9
|
const MAX_COMBINED_SIZE_BYTES = 100 * 1024 * 1024;
|
|
@@ -123,4 +124,3 @@ function parseVariablesJson(parsed) {
|
|
|
123
124
|
}
|
|
124
125
|
return { textValues, fileInputs, certInputs };
|
|
125
126
|
}
|
|
126
|
-
exports.parseVariablesJson = parseVariablesJson;
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testrigor/testrigor-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "TestRigor Command Line",
|
|
5
5
|
"author": "Ivo Parun Rua @parunruaivo",
|
|
6
6
|
"bin": {
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"/bin",
|
|
18
18
|
"/dist",
|
|
19
19
|
"/.appium",
|
|
20
|
-
"/npm-shrinkwrap.json",
|
|
21
20
|
"oclif.manifest.json"
|
|
22
21
|
],
|
|
23
22
|
"dependencies": {
|
|
@@ -42,11 +41,12 @@
|
|
|
42
41
|
"@types/eslint__js": "^8.42.3",
|
|
43
42
|
"@types/is-ci": "^3.0.4",
|
|
44
43
|
"@types/mocha": "^9.0.0",
|
|
45
|
-
"@types/node": "^
|
|
46
|
-
"@types/tar-stream": "
|
|
44
|
+
"@types/node": "^18.19.130",
|
|
45
|
+
"@types/tar-stream": "3.1.5",
|
|
47
46
|
"@types/unzip-stream": "^0.3.4",
|
|
48
47
|
"@types/unzipper": "^0.10.9",
|
|
49
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
48
|
+
"@typescript-eslint/eslint-plugin": "^8.71.0",
|
|
49
|
+
"@typescript-eslint/parser": "^8.71.0",
|
|
50
50
|
"chai": "^4",
|
|
51
51
|
"eslint": "^8.57.0",
|
|
52
52
|
"eslint-config-prettier": "^9.1.0",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"shx": "^0.3.4",
|
|
59
59
|
"ts-node": "^10.9.1",
|
|
60
60
|
"tslib": "^2.6.1",
|
|
61
|
-
"typescript": "
|
|
62
|
-
"typescript-eslint": "^
|
|
61
|
+
"typescript": "~6.0.3",
|
|
62
|
+
"typescript-eslint": "^8.71.0"
|
|
63
63
|
},
|
|
64
64
|
"oclif": {
|
|
65
65
|
"bin": "testrigor",
|