@autifyhq/autify-cli 0.3.1 → 0.6.0

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.
Files changed (39) hide show
  1. package/README.md +145 -3
  2. package/dist/autify/getWaitIntervalSecond.d.ts +1 -0
  3. package/dist/autify/getWaitIntervalSecond.js +15 -0
  4. package/dist/autify/mobile/createZip.d.ts +1 -0
  5. package/dist/autify/mobile/createZip.js +47 -0
  6. package/dist/autify/mobile/getBuildDetailUrl.d.ts +1 -0
  7. package/dist/autify/mobile/getBuildDetailUrl.js +17 -0
  8. package/dist/autify/mobile/getTestResultUrl.d.ts +1 -0
  9. package/dist/autify/mobile/getTestResultUrl.js +16 -0
  10. package/dist/autify/mobile/inspectBuildFile.d.ts +1 -0
  11. package/dist/autify/mobile/inspectBuildFile.js +34 -0
  12. package/dist/autify/mobile/parseTestPlanUrl.d.ts +4 -0
  13. package/dist/autify/mobile/parseTestPlanUrl.js +17 -0
  14. package/dist/autify/mobile/parseTestResultUrl.d.ts +4 -0
  15. package/dist/autify/mobile/parseTestResultUrl.js +17 -0
  16. package/dist/autify/mobile/uploadBuild.d.ts +2 -0
  17. package/dist/autify/mobile/uploadBuild.js +13 -0
  18. package/dist/autify/mobile/waitTestResult.d.ts +9 -0
  19. package/dist/autify/mobile/waitTestResult.js +69 -0
  20. package/dist/autify/web/runTest.d.ts +2 -1
  21. package/dist/autify/web/runTest.js +9 -1
  22. package/dist/autify/web/waitTestResult.d.ts +1 -0
  23. package/dist/autify/web/waitTestResult.js +1 -1
  24. package/dist/commands/mobile/api/describe-test-result.d.ts +10 -0
  25. package/dist/commands/mobile/api/describe-test-result.js +26 -0
  26. package/dist/commands/mobile/api/list-test-results.d.ts +12 -0
  27. package/dist/commands/mobile/api/list-test-results.js +37 -0
  28. package/dist/commands/mobile/build/upload.d.ts +17 -0
  29. package/dist/commands/mobile/build/upload.js +46 -0
  30. package/dist/commands/mobile/test/run.d.ts +18 -0
  31. package/dist/commands/mobile/test/run.js +86 -0
  32. package/dist/commands/mobile/test/wait.d.ts +15 -0
  33. package/dist/commands/mobile/test/wait.js +60 -0
  34. package/dist/commands/web/test/run.d.ts +2 -1
  35. package/dist/commands/web/test/run.js +6 -0
  36. package/dist/commands/web/test/wait.js +7 -1
  37. package/dist/config.d.ts +1 -1
  38. package/oclif.manifest.json +1 -1
  39. package/package.json +15 -9
package/README.md CHANGED
@@ -20,7 +20,7 @@ $ npm install -g @autifyhq/autify-cli
20
20
  $ autify COMMAND
21
21
  running command...
22
22
  $ autify (--version)
23
- @autifyhq/autify-cli/0.3.1 linux-x64 node-v16.15.1
23
+ @autifyhq/autify-cli/0.6.0 linux-x64 node-v16.17.0
24
24
  $ autify --help [COMMAND]
25
25
  USAGE
26
26
  $ autify COMMAND
@@ -57,9 +57,14 @@ After the installation, you can always get the latest update on `stable` channel
57
57
 
58
58
  <!-- commands -->
59
59
  * [`autify help [COMMAND]`](#autify-help-command)
60
+ * [`autify mobile api describe-test-result`](#autify-mobile-api-describe-test-result)
61
+ * [`autify mobile api list-test-results`](#autify-mobile-api-list-test-results)
60
62
  * [`autify mobile api run-test-plan`](#autify-mobile-api-run-test-plan)
61
63
  * [`autify mobile api upload-build`](#autify-mobile-api-upload-build)
62
64
  * [`autify mobile auth login`](#autify-mobile-auth-login)
65
+ * [`autify mobile build upload BUILD-PATH`](#autify-mobile-build-upload-build-path)
66
+ * [`autify mobile test run TEST-PLAN-URL`](#autify-mobile-test-run-test-plan-url)
67
+ * [`autify mobile test wait TEST-RESULT-URL`](#autify-mobile-test-wait-test-result-url)
63
68
  * [`autify update [CHANNEL]`](#autify-update-channel)
64
69
  * [`autify web api create-url-replacement`](#autify-web-api-create-url-replacement)
65
70
  * [`autify web api delete-url-replacement`](#autify-web-api-delete-url-replacement)
@@ -96,6 +101,47 @@ DESCRIPTION
96
101
 
97
102
  _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.1.12/src/commands/help.ts)_
98
103
 
104
+ ## `autify mobile api describe-test-result`
105
+
106
+ Get a test result.
107
+
108
+ ```
109
+ USAGE
110
+ $ autify mobile api describe-test-result --project-id <value> --id <value>
111
+
112
+ FLAGS
113
+ --id=<value> (required) Test Result ID.
114
+ --project-id=<value> (required) ID of the project from which the test results will be obtained.
115
+
116
+ DESCRIPTION
117
+ Get a test result.
118
+
119
+ EXAMPLES
120
+ $ autify mobile api describe-test-result
121
+ ```
122
+
123
+ ## `autify mobile api list-test-results`
124
+
125
+ List test results.
126
+
127
+ ```
128
+ USAGE
129
+ $ autify mobile api list-test-results --project-id <value> [--page <value>] [--per-page <value>] [--test-plan-id
130
+ <value>]
131
+
132
+ FLAGS
133
+ --page=<value> Page number to be retrieved.
134
+ --per-page=<value> Number of test results per page.
135
+ --project-id=<value> (required) ID of the project from which the list of test results will be retrieved.
136
+ --test-plan-id=<value> ID of the test plan.
137
+
138
+ DESCRIPTION
139
+ List test results.
140
+
141
+ EXAMPLES
142
+ $ autify mobile api list-test-results
143
+ ```
144
+
99
145
  ## `autify mobile api run-test-plan`
100
146
 
101
147
  Run a test plan
@@ -155,6 +201,96 @@ EXAMPLES
155
201
  $ autify mobile auth login < token.txt
156
202
  ```
157
203
 
204
+ ## `autify mobile build upload BUILD-PATH`
205
+
206
+ Upload a build file
207
+
208
+ ```
209
+ USAGE
210
+ $ autify mobile build upload [BUILD-PATH] -w <value> [--json]
211
+
212
+ ARGUMENTS
213
+ BUILD-PATH File path to the iOS app (*.app) or Android app (*.apk).
214
+
215
+ FLAGS
216
+ -w, --workspace-id=<value> (required) Workspace ID to upload the build file
217
+
218
+ GLOBAL FLAGS
219
+ --json Format output as json.
220
+
221
+ DESCRIPTION
222
+ Upload a build file
223
+
224
+ EXAMPLES
225
+ $ autify mobile build upload
226
+
227
+ Upload build file
228
+
229
+ $ autify mobile build upload --workspace-id AAA ./my.app
230
+
231
+ Upload build file (JSON output)
232
+
233
+ $ autify mobile build upload --workspace-id AAA ./my.app --json
234
+ ```
235
+
236
+ ## `autify mobile test run TEST-PLAN-URL`
237
+
238
+ Run a test plan.
239
+
240
+ ```
241
+ USAGE
242
+ $ autify mobile test run [TEST-PLAN-URL] [--build-id <value> | --build-path <value>] [-w] [-t <value>] [-v]
243
+
244
+ ARGUMENTS
245
+ TEST-PLAN-URL Test plan URL e.g. https://mobile-app.autify.com/projects/<ID>/test_plans/<ID>
246
+
247
+ FLAGS
248
+ -t, --timeout=<value> [default: 300] Timeout seconds when waiting for the finish of the test execution.
249
+ -v, --verbose Verbose output
250
+ -w, --wait Wait until the test finishes.
251
+ --build-id=<value> ID of the already uploaded build.
252
+ --build-path=<value> File path to the iOS app (*.app) or Android app (*.apk).
253
+
254
+ DESCRIPTION
255
+ Run a test plan.
256
+
257
+ EXAMPLES
258
+ Run a test plan with a build ID:
259
+
260
+ $ autify mobile test run --build-id CCC https://mobile-app.autify.com/projects/AAA/test_plans/BBB
261
+
262
+ Run a test plan with a new build file:
263
+
264
+ $ autify mobile test run --build-path ./my.[app|apk] https://mobile-app.autify.com/projects/AAA/test_plans/BBB
265
+
266
+ Run and wait a test plan:
267
+
268
+ $ autify mobile test run --build-id CCC https://mobile-app.autify.com/projects/AAA/test_plans/BBB --wait \
269
+ --timeout 600
270
+ ```
271
+
272
+ ## `autify mobile test wait TEST-RESULT-URL`
273
+
274
+ Wait a test result until it finishes.
275
+
276
+ ```
277
+ USAGE
278
+ $ autify mobile test wait [TEST-RESULT-URL] [-t <value>] [-v]
279
+
280
+ ARGUMENTS
281
+ TEST-RESULT-URL Test result URL e.g. https://mobile-app.autify.com/projects/<ID>/results/<ID>
282
+
283
+ FLAGS
284
+ -t, --timeout=<value> [default: 300] Timeout seconds when waiting for the finish of the test execution.
285
+ -v, --verbose Verbose output
286
+
287
+ DESCRIPTION
288
+ Wait a test result until it finishes.
289
+
290
+ EXAMPLES
291
+ $ autify mobile test wait https://mobile-app.autify.com/projects/AAA/results/BBB
292
+ ```
293
+
158
294
  ## `autify update [CHANNEL]`
159
295
 
160
296
  update the autify CLI
@@ -439,8 +575,9 @@ Run a scenario or test plan.
439
575
 
440
576
  ```
441
577
  USAGE
442
- $ autify web test run [SCENARIO-OR-TEST-PLAN-URL] [-n <value>] [-r <value>] [--os <value>] [--os-version
443
- <value>] [--browser <value>] [--device <value>] [--device-type <value>] [-w] [-t <value>] [-v]
578
+ $ autify web test run [SCENARIO-OR-TEST-PLAN-URL] [-n <value>] [-r <value>] [--autify-connect-key <value>] [--os
579
+ <value>] [--os-version <value>] [--browser <value>] [--device <value>] [--device-type <value>] [-w] [-t <value>]
580
+ [-v]
444
581
 
445
582
  ARGUMENTS
446
583
  SCENARIO-OR-TEST-PLAN-URL Scenario URL or Test plan URL e.g.
@@ -452,6 +589,7 @@ FLAGS
452
589
  -t, --timeout=<value> [default: 300] Timeout seconds when waiting for the finish of the test execution.
453
590
  -v, --verbose Verbose output
454
591
  -w, --wait Wait until the test finishes.
592
+ --autify-connect-key=<value> Name of the Autify Connect Key (Only for test scenario execution.)
455
593
  --browser=<value> Browser to run the test
456
594
  --device=<value> Device to run the test
457
595
  --device-type=<value> Device type to run the test
@@ -486,6 +624,10 @@ EXAMPLES
486
624
  Run a test with specifying the execution name:
487
625
 
488
626
  $ autify web test run https://app.autify.com/projects/0000/scenarios/0000 --name "Sample execution"
627
+
628
+ Run a test scenario with Autify Connect:
629
+
630
+ $ autify web test run https://app.autify.com/projects/0000/scenarios/0000 --autify-connect-key KEY_NAME
489
631
  ```
490
632
 
491
633
  ## `autify web test wait TEST-RESULT-URL`
@@ -0,0 +1 @@
1
+ export declare const getWaitIntervalSecond: (configDir: string) => number;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getWaitIntervalSecond = void 0;
4
+ /* eslint-disable unicorn/filename-case */
5
+ const config_1 = require("../config");
6
+ const DEFAULT_INTERVAL_SECOND = 1;
7
+ const getWaitIntervalSecond = (configDir) => {
8
+ var _a;
9
+ const waitIntervalSecondString = (_a = (0, config_1.get)(configDir, "AUTIFY_TEST_WAIT_INTERVAL_SECOND")) !== null && _a !== void 0 ? _a : String(DEFAULT_INTERVAL_SECOND);
10
+ const waitIntervalSecond = Number.parseFloat(waitIntervalSecondString);
11
+ if (Number.isNaN(waitIntervalSecond))
12
+ return DEFAULT_INTERVAL_SECOND;
13
+ return waitIntervalSecond;
14
+ };
15
+ exports.getWaitIntervalSecond = getWaitIntervalSecond;
@@ -0,0 +1 @@
1
+ export declare const createZip: (buildPath: string) => Promise<string>;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ /* eslint-disable unicorn/filename-case */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.createZip = void 0;
5
+ const tslib_1 = require("tslib");
6
+ const errors_1 = require("@oclif/errors");
7
+ const node_child_process_1 = require("node:child_process");
8
+ const node_fs_1 = require("node:fs");
9
+ const node_os_1 = require("node:os");
10
+ const node_path_1 = require("node:path");
11
+ const which_1 = tslib_1.__importDefault(require("which"));
12
+ const tsimportlib_1 = require("tsimportlib");
13
+ const checkPlatform = () => {
14
+ const supportedPlatforms = ["linux", "darwin"];
15
+ const p = (0, node_os_1.platform)();
16
+ if (!supportedPlatforms.includes(p)) {
17
+ throw new errors_1.CLIError(`${p} is not supported to zip file. Only supports: ${supportedPlatforms}`);
18
+ }
19
+ };
20
+ const checkBuildPath = (buildPath) => {
21
+ if (!(0, node_fs_1.lstatSync)(buildPath).isDirectory()) {
22
+ throw new errors_1.CLIError(`Build path (${buildPath}) is expected to directory.`);
23
+ }
24
+ const parentPath = (0, node_path_1.resolve)((0, node_path_1.dirname)(buildPath));
25
+ const name = (0, node_path_1.basename)(buildPath);
26
+ return [parentPath, name];
27
+ };
28
+ const findZip = () => {
29
+ const zip = which_1.default.sync("zip", { nothrow: true });
30
+ if (!zip) {
31
+ throw new errors_1.CLIError("Can't find zip command in PATH.");
32
+ }
33
+ return zip;
34
+ };
35
+ const createZip = async (buildPath) => {
36
+ checkPlatform();
37
+ const [parentPath, name] = checkBuildPath(buildPath);
38
+ const zip = findZip();
39
+ const { temporaryFile } = (await (0, tsimportlib_1.dynamicImport)("tempy",
40
+ // eslint-disable-next-line unicorn/prefer-module
41
+ module));
42
+ const zipFile = temporaryFile({ name: "build.zip" });
43
+ // TODO: Use JSZip.
44
+ (0, node_child_process_1.execFileSync)(zip, ["-r", zipFile, name], { cwd: parentPath });
45
+ return zipFile;
46
+ };
47
+ exports.createZip = createZip;
@@ -0,0 +1 @@
1
+ export declare const getBuildDetailUrl: (configDir: string, workspaceId: string, os: "ios" | "android", buildId: string) => string;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getBuildDetailUrl = void 0;
4
+ /* eslint-disable unicorn/filename-case */
5
+ const autify_sdk_1 = require("@autifyhq/autify-sdk");
6
+ const config_1 = require("../../config");
7
+ const getBuildDetailUrl = (configDir, workspaceId, os, buildId) => {
8
+ var _a;
9
+ // Currently, it's heuristic. We could provide a new API or include the URL in the response of the existing APIs.
10
+ let basePath = (_a = (0, config_1.get)(configDir, "AUTIFY_MOBILE_BASE_PATH")) !== null && _a !== void 0 ? _a : autify_sdk_1.MOBILE_BASE_PATH;
11
+ if (basePath.startsWith("http://localhost:"))
12
+ basePath = autify_sdk_1.MOBILE_BASE_PATH; // Override if it's running integration tests.
13
+ const endpoint = basePath.slice(0, Math.max(0, basePath.indexOf("/api/v1"))); // Assuming the UI endpoint is the same as API endpoint.
14
+ // Currently, there is no way to know the page number via API. We assume the latest build will be shown in page 1 now.
15
+ return `${endpoint}/projects/${workspaceId}/builds?os=${os}&selectedBuildId=${buildId}&page=1`;
16
+ };
17
+ exports.getBuildDetailUrl = getBuildDetailUrl;
@@ -0,0 +1 @@
1
+ export declare const getMobileTestResultUrl: (configDir: string, workspaceId: string, resultId: string) => string;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMobileTestResultUrl = void 0;
4
+ /* eslint-disable unicorn/filename-case */
5
+ const autify_sdk_1 = require("@autifyhq/autify-sdk");
6
+ const config_1 = require("../../config");
7
+ const getMobileTestResultUrl = (configDir, workspaceId, resultId) => {
8
+ var _a;
9
+ // Currently, it's heuristic. We could provide a new API or include the URL in the response of the existing APIs.
10
+ let basePath = (_a = (0, config_1.get)(configDir, "AUTIFY_MOBILE_BASE_PATH")) !== null && _a !== void 0 ? _a : autify_sdk_1.MOBILE_BASE_PATH;
11
+ if (basePath.startsWith("http://localhost:"))
12
+ basePath = autify_sdk_1.MOBILE_BASE_PATH; // Override if it's running integration tests.
13
+ const endpoint = basePath.slice(0, Math.max(0, basePath.indexOf("/api/v1"))); // Assuming the UI endpoint is the same as API endpoint.
14
+ return `${endpoint}/projects/${workspaceId}/results/${resultId}`;
15
+ };
16
+ exports.getMobileTestResultUrl = getMobileTestResultUrl;
@@ -0,0 +1 @@
1
+ export declare const inspectBuildFile: (buildPath: string) => Promise<[string, "ios" | "android"]>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.inspectBuildFile = void 0;
4
+ /* eslint-disable unicorn/filename-case */
5
+ const errors_1 = require("@oclif/errors");
6
+ const node_fs_1 = require("node:fs");
7
+ const createZip_1 = require("./createZip");
8
+ const isIosApp = (buildPath) => {
9
+ return ((0, node_fs_1.lstatSync)(buildPath).isDirectory() &&
10
+ buildPath.replace(/\/$/, "").endsWith(".app"));
11
+ };
12
+ const isAndroidApp = (buildPath) => {
13
+ return (0, node_fs_1.lstatSync)(buildPath).isFile() && buildPath.endsWith(".apk");
14
+ };
15
+ const getOs = (buildPath) => {
16
+ if (isIosApp(buildPath))
17
+ return "ios";
18
+ if (isAndroidApp(buildPath))
19
+ return "android";
20
+ throw new errors_1.CLIError(`${buildPath} doesn't look like iOS app nor Android apk.`);
21
+ };
22
+ const getUploadPath = async (buildPath, os) => {
23
+ if (os === "ios")
24
+ return (0, createZip_1.createZip)(buildPath);
25
+ if (os === "android")
26
+ return buildPath;
27
+ throw new errors_1.CLIError(`Invalid os: ${os}`);
28
+ };
29
+ const inspectBuildFile = async (buildPath) => {
30
+ const os = getOs(buildPath);
31
+ const uploadPath = await getUploadPath(buildPath, os);
32
+ return [uploadPath, os];
33
+ };
34
+ exports.inspectBuildFile = inspectBuildFile;
@@ -0,0 +1,4 @@
1
+ export declare const parseTestPlanUrl: (url: string) => {
2
+ workspaceId: string;
3
+ testPlanId: string;
4
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseTestPlanUrl = void 0;
4
+ /* eslint-disable unicorn/filename-case */
5
+ const errors_1 = require("@oclif/errors");
6
+ const parseTestPlanUrl = (url) => {
7
+ var _a, _b;
8
+ const { pathname } = new URL(url);
9
+ const testPlanUrlPathRegExp = /\/projects\/(?<workspaceId>[^/]+)\/test_plans\/(?<testPlanId>[^/]+)/;
10
+ const match = testPlanUrlPathRegExp.exec(pathname);
11
+ const workspaceId = (_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.workspaceId;
12
+ const testPlanId = (_b = match === null || match === void 0 ? void 0 : match.groups) === null || _b === void 0 ? void 0 : _b.testPlanId;
13
+ if (!workspaceId || !testPlanId)
14
+ throw new errors_1.CLIError(`Invalid URL: ${url}`);
15
+ return { workspaceId, testPlanId };
16
+ };
17
+ exports.parseTestPlanUrl = parseTestPlanUrl;
@@ -0,0 +1,4 @@
1
+ export declare const parseTestResultUrl: (url: string) => {
2
+ workspaceId: string;
3
+ resultId: string;
4
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseTestResultUrl = void 0;
4
+ /* eslint-disable unicorn/filename-case */
5
+ const errors_1 = require("@oclif/errors");
6
+ const parseTestResultUrl = (url) => {
7
+ var _a, _b;
8
+ const { pathname } = new URL(url);
9
+ const testResultUrlPathRegExp = /\/projects\/(?<workspaceId>[^/]+)\/results\/(?<resultId>[^/]+)/;
10
+ const match = testResultUrlPathRegExp.exec(pathname);
11
+ const workspaceId = (_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.workspaceId;
12
+ const resultId = (_b = match === null || match === void 0 ? void 0 : match.groups) === null || _b === void 0 ? void 0 : _b.resultId;
13
+ if (!workspaceId || !resultId)
14
+ throw new errors_1.CLIError(`Invalid URL: ${url}`);
15
+ return { workspaceId, resultId };
16
+ };
17
+ exports.parseTestResultUrl = parseTestResultUrl;
@@ -0,0 +1,2 @@
1
+ import { MobileClient } from "@autifyhq/autify-sdk";
2
+ export declare const uploadBuild: (client: MobileClient, workspaceId: string, buildPath: string) => Promise<[string, "ios" | "android"]>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uploadBuild = void 0;
4
+ const errors_1 = require("@oclif/errors");
5
+ const inspectBuildFile_1 = require("./inspectBuildFile");
6
+ const uploadBuild = async (client, workspaceId, buildPath) => {
7
+ const [uploadPath, os] = await (0, inspectBuildFile_1.inspectBuildFile)(buildPath);
8
+ const res = await client.uploadBuild(workspaceId, uploadPath);
9
+ if (!res.data.id)
10
+ throw new errors_1.CLIError(`Failed to upload ${buildPath}.`);
11
+ return [res.data.id, os];
12
+ };
13
+ exports.uploadBuild = uploadBuild;
@@ -0,0 +1,9 @@
1
+ import { MobileClient } from "@autifyhq/autify-sdk";
2
+ export declare const waitTestResult: (client: MobileClient, workspaceId: string, resultId: string, options: {
3
+ timeoutSecond: number;
4
+ verbose: boolean;
5
+ intervalSecond: number;
6
+ }) => Promise<{
7
+ isPassed: boolean;
8
+ data: any;
9
+ }>;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.waitTestResult = void 0;
4
+ const tslib_1 = require("tslib");
5
+ /* eslint-disable unicorn/filename-case */
6
+ const errors_1 = require("@oclif/errors");
7
+ const listr_1 = tslib_1.__importDefault(require("listr"));
8
+ const promises_1 = require("node:timers/promises");
9
+ const node_emoji_1 = tslib_1.__importDefault(require("node-emoji"));
10
+ const waitUntil = async (callback, timeoutSecond, intervalSecond, verbose) => {
11
+ const task = new listr_1.default([
12
+ {
13
+ title: `Waiting... (timeout: ${timeoutSecond} s)`,
14
+ task: async (ctx, task) => {
15
+ for await (const startTime of (0, promises_1.setInterval)(intervalSecond * 1000, Date.now())) {
16
+ const now = Date.now();
17
+ if (now - startTime > timeoutSecond * 1000) {
18
+ throw new errors_1.CLIError(`Timeout after ${timeoutSecond} seconds.`);
19
+ }
20
+ const result = await callback(task);
21
+ if (result) {
22
+ ctx.result = result;
23
+ return;
24
+ }
25
+ }
26
+ },
27
+ },
28
+ ], {
29
+ renderer: verbose ? "verbose" : "default",
30
+ nonTTYRenderer: "verbose",
31
+ });
32
+ return (await task.run()).result;
33
+ };
34
+ const emojiStatus = (status) => {
35
+ if (status === "queuing")
36
+ return node_emoji_1.default.get("cyclone") + " Queuing";
37
+ if (status === "waiting")
38
+ return node_emoji_1.default.get("hourglass_flowing_sand") + " Waiting";
39
+ if (status === "running")
40
+ return node_emoji_1.default.get("car") + " Running";
41
+ if (status === "passed")
42
+ return node_emoji_1.default.get("+1") + " Passed ";
43
+ if (status === "failed")
44
+ return node_emoji_1.default.get("rotating_light") + " Failed ";
45
+ if (status === "skipped")
46
+ return node_emoji_1.default.get("zzz") + " Skipped";
47
+ return node_emoji_1.default.get("grey_question") + " None ";
48
+ };
49
+ const describeTestResult = (client, workspaceId, resultId) => async (task) => {
50
+ var _a;
51
+ const { data } = await client.describeTestResult(workspaceId, resultId);
52
+ const testPlanStatus = emojiStatus(data.status);
53
+ const testCaseStatus = [];
54
+ for (const testCaseResult of (_a = data.test_case_results) !== null && _a !== void 0 ? _a : []) {
55
+ testCaseStatus.push(emojiStatus(testCaseResult.status));
56
+ }
57
+ task.output = `TestPlan: ${testPlanStatus}, TestCases: ${testCaseStatus.join(" / ")}`;
58
+ if (data.finished_at)
59
+ return data;
60
+ };
61
+ const waitTestResult = async (client, workspaceId, resultId, options) => {
62
+ const data = await waitUntil(describeTestResult(client, workspaceId, resultId), options.timeoutSecond, options.intervalSecond, options.verbose);
63
+ const isPassed = (data === null || data === void 0 ? void 0 : data.status) === "passed";
64
+ return {
65
+ isPassed,
66
+ data,
67
+ };
68
+ };
69
+ exports.waitTestResult = waitTestResult;
@@ -5,8 +5,9 @@ declare type RunTestProps = Readonly<{
5
5
  option: CapabilityOption;
6
6
  name?: string;
7
7
  urlReplacements: CreateUrlReplacementRequest[];
8
+ autifyConnectKey?: string;
8
9
  }>;
9
- export declare const runTest: (client: WebClient, url: string, { option, name, urlReplacements }: RunTestProps) => Promise<{
10
+ export declare const runTest: (client: WebClient, url: string, { option, name, urlReplacements, autifyConnectKey }: RunTestProps) => Promise<{
10
11
  workspaceId: number;
11
12
  resultId: number;
12
13
  capability: string;
@@ -52,7 +52,7 @@ const capabilityToString = ({ os, os_version, browser, browser_version, device,
52
52
  .filter((s) => Boolean(s))
53
53
  .join(" ");
54
54
  };
55
- const runTest = async (client, url, { option, name, urlReplacements }) => {
55
+ const runTest = async (client, url, { option, name, urlReplacements, autifyConnectKey }) => {
56
56
  const scenario = parseScenarioUrl(url);
57
57
  const testPlan = parseTestPlanUrl(url);
58
58
  if (scenario) {
@@ -64,6 +64,12 @@ const runTest = async (client, url, { option, name, urlReplacements }) => {
64
64
  scenarios: [{ id: scenarioId }],
65
65
  // eslint-disable-next-line camelcase
66
66
  url_replacements: urlReplacements,
67
+ ...(autifyConnectKey && {
68
+ // eslint-disable-next-line camelcase
69
+ autify_connect: {
70
+ name: autifyConnectKey,
71
+ },
72
+ }),
67
73
  });
68
74
  return {
69
75
  workspaceId,
@@ -76,6 +82,8 @@ const runTest = async (client, url, { option, name, urlReplacements }) => {
76
82
  throw new errors_1.CLIError(`Running TestPlan doesn't support capability override: ${JSON.stringify(option)}`);
77
83
  if (name)
78
84
  throw new errors_1.CLIError(`Running TestPlan doesn't support --name: ${name}`);
85
+ if (autifyConnectKey)
86
+ throw new errors_1.CLIError(`Running TestPlan doesn't support --autify-connect-key: ${autifyConnectKey}`);
79
87
  const { workspaceId, testPlanId } = testPlan;
80
88
  const urlReplacementIds = [];
81
89
  for await (const urlReplacement of urlReplacements !== null && urlReplacements !== void 0 ? urlReplacements : []) {
@@ -2,6 +2,7 @@ import { WebClient } from "@autifyhq/autify-sdk";
2
2
  export declare const waitTestResult: (client: WebClient, workspaceId: number, resultId: number, options: {
3
3
  timeoutSecond: number;
4
4
  verbose: boolean;
5
+ intervalSecond: number;
5
6
  }) => Promise<{
6
7
  isPassed: boolean;
7
8
  data: any;
@@ -61,7 +61,7 @@ const describeResult = (client, workspaceId, resultId) => async (task) => {
61
61
  return data;
62
62
  };
63
63
  const waitTestResult = async (client, workspaceId, resultId, options) => {
64
- const data = await waitUntil(describeResult(client, workspaceId, resultId), options.timeoutSecond, 1, options.verbose);
64
+ const data = await waitUntil(describeResult(client, workspaceId, resultId), options.timeoutSecond, options.intervalSecond, options.verbose);
65
65
  const isPassed = (data === null || data === void 0 ? void 0 : data.status) === "passed";
66
66
  return {
67
67
  isPassed,
@@ -0,0 +1,10 @@
1
+ import { Command } from "@oclif/core";
2
+ export default class MobileApiDescribeTestResult extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ "project-id": import("@oclif/core/lib/interfaces").OptionFlag<string>;
7
+ id: import("@oclif/core/lib/interfaces").OptionFlag<string>;
8
+ };
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const autify_sdk_1 = require("@autifyhq/autify-sdk");
5
+ const config_1 = require("../../../config");
6
+ class MobileApiDescribeTestResult extends core_1.Command {
7
+ async run() {
8
+ const { flags } = await this.parse(MobileApiDescribeTestResult);
9
+ const { configDir, userAgent } = this.config;
10
+ const accessToken = (0, config_1.getOrThrow)(configDir, "AUTIFY_MOBILE_ACCESS_TOKEN");
11
+ const basePath = (0, config_1.get)(configDir, "AUTIFY_MOBILE_BASE_PATH");
12
+ const client = new autify_sdk_1.MobileClient(accessToken, { basePath, userAgent });
13
+ const res = await client.describeTestResult(flags["project-id"], flags.id);
14
+ console.log(JSON.stringify(res.data, null, 2));
15
+ }
16
+ }
17
+ exports.default = MobileApiDescribeTestResult;
18
+ MobileApiDescribeTestResult.description = "Get a test result.";
19
+ MobileApiDescribeTestResult.examples = ["<%= config.bin %> <%= command.id %>"];
20
+ MobileApiDescribeTestResult.flags = {
21
+ "project-id": core_1.Flags.string({
22
+ description: "ID of the project from which the test results will be obtained.",
23
+ required: true,
24
+ }),
25
+ id: core_1.Flags.string({ description: "Test Result ID.", required: true }),
26
+ };
@@ -0,0 +1,12 @@
1
+ import { Command } from "@oclif/core";
2
+ export default class MobileApiListTestResults extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ "project-id": import("@oclif/core/lib/interfaces").OptionFlag<string>;
7
+ page: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
8
+ "per-page": import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
9
+ "test-plan-id": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
10
+ };
11
+ run(): Promise<void>;
12
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const autify_sdk_1 = require("@autifyhq/autify-sdk");
5
+ const config_1 = require("../../../config");
6
+ class MobileApiListTestResults extends core_1.Command {
7
+ async run() {
8
+ const { flags } = await this.parse(MobileApiListTestResults);
9
+ const { configDir, userAgent } = this.config;
10
+ const accessToken = (0, config_1.getOrThrow)(configDir, "AUTIFY_MOBILE_ACCESS_TOKEN");
11
+ const basePath = (0, config_1.get)(configDir, "AUTIFY_MOBILE_BASE_PATH");
12
+ const client = new autify_sdk_1.MobileClient(accessToken, { basePath, userAgent });
13
+ const res = await client.listTestResults(flags["project-id"], flags.page, flags["per-page"], flags["test-plan-id"]);
14
+ console.log(JSON.stringify(res.data, null, 2));
15
+ }
16
+ }
17
+ exports.default = MobileApiListTestResults;
18
+ MobileApiListTestResults.description = "List test results.";
19
+ MobileApiListTestResults.examples = ["<%= config.bin %> <%= command.id %>"];
20
+ MobileApiListTestResults.flags = {
21
+ "project-id": core_1.Flags.string({
22
+ description: "ID of the project from which the list of test results will be retrieved.",
23
+ required: true,
24
+ }),
25
+ page: core_1.Flags.integer({
26
+ description: "Page number to be retrieved.",
27
+ required: false,
28
+ }),
29
+ "per-page": core_1.Flags.integer({
30
+ description: "Number of test results per page.",
31
+ required: false,
32
+ }),
33
+ "test-plan-id": core_1.Flags.string({
34
+ description: "ID of the test plan.",
35
+ required: false,
36
+ }),
37
+ };
@@ -0,0 +1,17 @@
1
+ import { Command } from "@oclif/core";
2
+ export default class MobileBuildUpload extends Command {
3
+ static enableJsonFlag: boolean;
4
+ static description: string;
5
+ static examples: string[];
6
+ static flags: {
7
+ "workspace-id": import("@oclif/core/lib/interfaces").OptionFlag<string>;
8
+ };
9
+ static args: {
10
+ name: string;
11
+ description: string;
12
+ required: boolean;
13
+ }[];
14
+ run(): Promise<{
15
+ buildId: string;
16
+ }>;
17
+ }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const autify_sdk_1 = require("@autifyhq/autify-sdk");
5
+ const core_1 = require("@oclif/core");
6
+ const node_emoji_1 = tslib_1.__importDefault(require("node-emoji"));
7
+ const getBuildDetailUrl_1 = require("../../../autify/mobile/getBuildDetailUrl");
8
+ const uploadBuild_1 = require("../../../autify/mobile/uploadBuild");
9
+ const config_1 = require("../../../config");
10
+ class MobileBuildUpload extends core_1.Command {
11
+ async run() {
12
+ const { args, flags } = await this.parse(MobileBuildUpload);
13
+ const buildPath = args["build-path"];
14
+ const workspaceId = flags["workspace-id"];
15
+ const { configDir, userAgent } = this.config;
16
+ const accessToken = (0, config_1.getOrThrow)(configDir, "AUTIFY_MOBILE_ACCESS_TOKEN");
17
+ const basePath = (0, config_1.get)(configDir, "AUTIFY_MOBILE_BASE_PATH");
18
+ const client = new autify_sdk_1.MobileClient(accessToken, { basePath, userAgent });
19
+ const [buildId, os] = await (0, uploadBuild_1.uploadBuild)(client, workspaceId, buildPath);
20
+ const buildDetailUrl = (0, getBuildDetailUrl_1.getBuildDetailUrl)(configDir, workspaceId, os, buildId);
21
+ this.log(`${node_emoji_1.default.get("white_check_mark")} Successfully uploaded ${buildPath} (ID: ${buildId}). See ${buildDetailUrl}`);
22
+ return { buildId };
23
+ }
24
+ }
25
+ exports.default = MobileBuildUpload;
26
+ MobileBuildUpload.enableJsonFlag = true;
27
+ MobileBuildUpload.description = "Upload a build file";
28
+ MobileBuildUpload.examples = [
29
+ "<%= config.bin %> <%= command.id %>",
30
+ "Upload build file\n<%= config.bin %> <%= command.id %> --workspace-id AAA ./my.app",
31
+ "Upload build file (JSON output)\n<%= config.bin %> <%= command.id %> --workspace-id AAA ./my.app --json",
32
+ ];
33
+ MobileBuildUpload.flags = {
34
+ "workspace-id": core_1.Flags.string({
35
+ char: "w",
36
+ description: "Workspace ID to upload the build file",
37
+ required: true,
38
+ }),
39
+ };
40
+ MobileBuildUpload.args = [
41
+ {
42
+ name: "build-path",
43
+ description: "File path to the iOS app (*.app) or Android app (*.apk).",
44
+ required: true,
45
+ },
46
+ ];
@@ -0,0 +1,18 @@
1
+ import { Command } from "@oclif/core";
2
+ export default class MobileTestRun extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ "build-id": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
7
+ "build-path": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
8
+ wait: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
+ timeout: import("@oclif/core/lib/interfaces").OptionFlag<number>;
10
+ verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
11
+ };
12
+ static args: {
13
+ name: string;
14
+ description: string;
15
+ required: boolean;
16
+ }[];
17
+ run(): Promise<void>;
18
+ }
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const autify_sdk_1 = require("@autifyhq/autify-sdk");
5
+ const core_1 = require("@oclif/core");
6
+ const errors_1 = require("@oclif/errors");
7
+ const node_emoji_1 = tslib_1.__importDefault(require("node-emoji"));
8
+ const getTestResultUrl_1 = require("../../../autify/mobile/getTestResultUrl");
9
+ const parseTestPlanUrl_1 = require("../../../autify/mobile/parseTestPlanUrl");
10
+ const config_1 = require("../../../config");
11
+ const upload_1 = tslib_1.__importDefault(require("../build/upload"));
12
+ const wait_1 = tslib_1.__importDefault(require("./wait"));
13
+ class MobileTestRun extends core_1.Command {
14
+ async run() {
15
+ const { args, flags } = await this.parse(MobileTestRun);
16
+ let buildId = flags["build-id"];
17
+ const buildPath = flags["build-path"];
18
+ const { configDir, userAgent } = this.config;
19
+ const accessToken = (0, config_1.getOrThrow)(configDir, "AUTIFY_MOBILE_ACCESS_TOKEN");
20
+ const basePath = (0, config_1.get)(configDir, "AUTIFY_MOBILE_BASE_PATH");
21
+ const client = new autify_sdk_1.MobileClient(accessToken, { basePath, userAgent });
22
+ const { workspaceId, testPlanId } = (0, parseTestPlanUrl_1.parseTestPlanUrl)(args["test-plan-url"]);
23
+ if (buildPath) {
24
+ const uploadArgs = ["--workspace-id", workspaceId, buildPath];
25
+ const uploadCommand = new upload_1.default(uploadArgs, this.config);
26
+ buildId = (await uploadCommand.run()).buildId;
27
+ }
28
+ const res = await client.runTestPlan(testPlanId, {
29
+ // eslint-disable-next-line camelcase
30
+ build_id: buildId,
31
+ });
32
+ if (!res.data.id)
33
+ throw new errors_1.CLIError(`Failed to run a test plan.`);
34
+ const testResultUrl = (0, getTestResultUrl_1.getMobileTestResultUrl)(configDir, workspaceId, res.data.id);
35
+ this.log(`${node_emoji_1.default.get("white_check_mark")} Successfully started: ${testResultUrl}`);
36
+ if (flags.wait) {
37
+ const waitArgs = ["--timeout", flags.timeout.toString(), testResultUrl];
38
+ if (flags.verbose)
39
+ waitArgs.push("--verbose");
40
+ await wait_1.default.run(waitArgs);
41
+ }
42
+ else {
43
+ this.log("To wait for the test result, run the command below:");
44
+ this.log(`${node_emoji_1.default.get("computer")} $ autify mobile test wait ${testResultUrl}`);
45
+ }
46
+ }
47
+ }
48
+ exports.default = MobileTestRun;
49
+ MobileTestRun.description = "Run a test plan.";
50
+ MobileTestRun.examples = [
51
+ "Run a test plan with a build ID:\n<%= config.bin %> <%= command.id %> --build-id CCC https://mobile-app.autify.com/projects/AAA/test_plans/BBB",
52
+ "Run a test plan with a new build file:\n<%= config.bin %> <%= command.id %> --build-path ./my.[app|apk] https://mobile-app.autify.com/projects/AAA/test_plans/BBB",
53
+ "Run and wait a test plan:\n<%= config.bin %> <%= command.id %> --build-id CCC https://mobile-app.autify.com/projects/AAA/test_plans/BBB --wait --timeout 600",
54
+ ];
55
+ MobileTestRun.flags = {
56
+ "build-id": core_1.Flags.string({
57
+ description: "ID of the already uploaded build.",
58
+ exclusive: ["build-path"],
59
+ }),
60
+ "build-path": core_1.Flags.file({
61
+ description: "File path to the iOS app (*.app) or Android app (*.apk).",
62
+ exclusive: ["build-id"],
63
+ }),
64
+ wait: core_1.Flags.boolean({
65
+ char: "w",
66
+ description: "Wait until the test finishes.",
67
+ default: false,
68
+ }),
69
+ timeout: core_1.Flags.integer({
70
+ char: "t",
71
+ description: "Timeout seconds when waiting for the finish of the test execution.",
72
+ default: 300,
73
+ }),
74
+ verbose: core_1.Flags.boolean({
75
+ char: "v",
76
+ description: "Verbose output",
77
+ default: false,
78
+ }),
79
+ };
80
+ MobileTestRun.args = [
81
+ {
82
+ name: "test-plan-url",
83
+ description: "Test plan URL e.g. https://mobile-app.autify.com/projects/<ID>/test_plans/<ID>",
84
+ required: true,
85
+ },
86
+ ];
@@ -0,0 +1,15 @@
1
+ import { Command } from "@oclif/core";
2
+ export default class MobileTestWait extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ timeout: import("@oclif/core/lib/interfaces").OptionFlag<number>;
7
+ verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
+ };
9
+ static args: {
10
+ name: string;
11
+ description: string;
12
+ required: boolean;
13
+ }[];
14
+ run(): Promise<void>;
15
+ }
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const autify_sdk_1 = require("@autifyhq/autify-sdk");
5
+ const core_1 = require("@oclif/core");
6
+ const node_emoji_1 = tslib_1.__importDefault(require("node-emoji"));
7
+ const getWaitIntervalSecond_1 = require("../../../autify/getWaitIntervalSecond");
8
+ const getTestResultUrl_1 = require("../../../autify/mobile/getTestResultUrl");
9
+ const parseTestResultUrl_1 = require("../../../autify/mobile/parseTestResultUrl");
10
+ const waitTestResult_1 = require("../../../autify/mobile/waitTestResult");
11
+ const config_1 = require("../../../config");
12
+ class MobileTestWait extends core_1.Command {
13
+ async run() {
14
+ const { args, flags } = await this.parse(MobileTestWait);
15
+ const { configDir, userAgent } = this.config;
16
+ const accessToken = (0, config_1.getOrThrow)(configDir, "AUTIFY_MOBILE_ACCESS_TOKEN");
17
+ const basePath = (0, config_1.get)(configDir, "AUTIFY_MOBILE_BASE_PATH");
18
+ const waitIntervalSecond = (0, getWaitIntervalSecond_1.getWaitIntervalSecond)(configDir);
19
+ const client = new autify_sdk_1.MobileClient(accessToken, { basePath, userAgent });
20
+ const { workspaceId, resultId } = (0, parseTestResultUrl_1.parseTestResultUrl)(args["test-result-url"]);
21
+ const testResultUrl = (0, getTestResultUrl_1.getMobileTestResultUrl)(configDir, workspaceId, resultId);
22
+ this.log(`${node_emoji_1.default.get("clock1")} Waiting for the test result: ${testResultUrl}`);
23
+ const { isPassed, data } = await (0, waitTestResult_1.waitTestResult)(client, workspaceId, resultId, {
24
+ timeoutSecond: flags.timeout,
25
+ verbose: flags.verbose,
26
+ intervalSecond: waitIntervalSecond,
27
+ });
28
+ if (isPassed) {
29
+ this.log(`${node_emoji_1.default.get("white_check_mark")} Test passed!: ${testResultUrl}`);
30
+ this.exit();
31
+ }
32
+ else {
33
+ this.error(`${node_emoji_1.default.get("x")} Test didn't pass. See ${testResultUrl}: ${JSON.stringify(data)}`);
34
+ }
35
+ }
36
+ }
37
+ exports.default = MobileTestWait;
38
+ MobileTestWait.description = "Wait a test result until it finishes.";
39
+ MobileTestWait.examples = [
40
+ "<%= config.bin %> <%= command.id %> https://mobile-app.autify.com/projects/AAA/results/BBB",
41
+ ];
42
+ MobileTestWait.flags = {
43
+ timeout: core_1.Flags.integer({
44
+ char: "t",
45
+ description: "Timeout seconds when waiting for the finish of the test execution.",
46
+ default: 300,
47
+ }),
48
+ verbose: core_1.Flags.boolean({
49
+ char: "v",
50
+ description: "Verbose output",
51
+ default: false,
52
+ }),
53
+ };
54
+ MobileTestWait.args = [
55
+ {
56
+ name: "test-result-url",
57
+ description: "Test result URL e.g. https://mobile-app.autify.com/projects/<ID>/results/<ID>",
58
+ required: true,
59
+ },
60
+ ];
@@ -4,7 +4,8 @@ export default class WebTestRun extends Command {
4
4
  static examples: string[];
5
5
  static flags: {
6
6
  name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
7
- "url-replacements": import("@oclif/core/lib/interfaces").OptionFlag<string[]>;
7
+ "url-replacements": import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined>;
8
+ "autify-connect-key": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
8
9
  os: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
9
10
  "os-version": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
10
11
  browser: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
@@ -41,6 +41,7 @@ class WebTestRun extends core_1.Command {
41
41
  const urlReplacements = parseUrlReplacements((_a = flags["url-replacements"]) !== null && _a !== void 0 ? _a : []);
42
42
  if (urlReplacements.length > 0)
43
43
  this.log(`${node_emoji_1.default.get("memo")} Using URL replacements: ${urlReplacementsToString(urlReplacements)}`);
44
+ const autifyConnectKey = flags["autify-connect-key"];
44
45
  const { configDir, userAgent } = this.config;
45
46
  const accessToken = (0, config_1.getOrThrow)(configDir, "AUTIFY_WEB_ACCESS_TOKEN");
46
47
  const basePath = (0, config_1.get)(configDir, "AUTIFY_WEB_BASE_PATH");
@@ -49,6 +50,7 @@ class WebTestRun extends core_1.Command {
49
50
  option: capabilityOption,
50
51
  name: flags.name,
51
52
  urlReplacements,
53
+ autifyConnectKey,
52
54
  });
53
55
  const testResultUrl = (0, getTestResultUrl_1.getWebTestResultUrl)(configDir, workspaceId, resultId);
54
56
  this.log(`${node_emoji_1.default.get("white_check_mark")} Successfully started: ${testResultUrl} (Capability is ${capability})`);
@@ -73,6 +75,7 @@ WebTestRun.examples = [
73
75
  'Run a test scenario with a specific capability:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 --os "Windows Server" --browser Edge',
74
76
  "With URL replacements:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 -r http://example.com=http://example.net -r http://example.org=http://example.net",
75
77
  'Run a test with specifying the execution name:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 --name "Sample execution"',
78
+ "Run a test scenario with Autify Connect:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 --autify-connect-key KEY_NAME",
76
79
  ];
77
80
  WebTestRun.flags = {
78
81
  name: core_1.Flags.string({
@@ -84,6 +87,9 @@ WebTestRun.flags = {
84
87
  description: "URL replacements. Example: http://example.com=http://example.net",
85
88
  multiple: true,
86
89
  }),
90
+ "autify-connect-key": core_1.Flags.string({
91
+ description: "Name of the Autify Connect Key (Only for test scenario execution.)",
92
+ }),
87
93
  os: core_1.Flags.string({ description: "OS to run the test" }),
88
94
  "os-version": core_1.Flags.string({ description: "OS version to run the test" }),
89
95
  browser: core_1.Flags.string({ description: "Browser to run the test" }),
@@ -8,17 +8,23 @@ const config_1 = require("../../../config");
8
8
  const parseTestResultUrl_1 = require("../../../autify/web/parseTestResultUrl");
9
9
  const waitTestResult_1 = require("../../../autify/web/waitTestResult");
10
10
  const getTestResultUrl_1 = require("../../../autify/web/getTestResultUrl");
11
+ const getWaitIntervalSecond_1 = require("../../../autify/getWaitIntervalSecond");
11
12
  class WebTestWait extends core_1.Command {
12
13
  async run() {
13
14
  const { args, flags } = await this.parse(WebTestWait);
14
15
  const { configDir, userAgent } = this.config;
15
16
  const accessToken = (0, config_1.getOrThrow)(configDir, "AUTIFY_WEB_ACCESS_TOKEN");
16
17
  const basePath = (0, config_1.get)(configDir, "AUTIFY_WEB_BASE_PATH");
18
+ const waitIntervalSecond = (0, getWaitIntervalSecond_1.getWaitIntervalSecond)(configDir);
17
19
  const client = new autify_sdk_1.WebClient(accessToken, { basePath, userAgent });
18
20
  const { workspaceId, resultId } = (0, parseTestResultUrl_1.parseTestResultUrl)(args["test-result-url"]);
19
21
  const testResultUrl = (0, getTestResultUrl_1.getWebTestResultUrl)(configDir, workspaceId, resultId);
20
22
  this.log(`${node_emoji_1.default.get("clock1")} Waiting for the test result: ${testResultUrl}`);
21
- const { isPassed, data } = await (0, waitTestResult_1.waitTestResult)(client, workspaceId, resultId, { timeoutSecond: flags.timeout, verbose: flags.verbose });
23
+ const { isPassed, data } = await (0, waitTestResult_1.waitTestResult)(client, workspaceId, resultId, {
24
+ timeoutSecond: flags.timeout,
25
+ verbose: flags.verbose,
26
+ intervalSecond: waitIntervalSecond,
27
+ });
22
28
  if (isPassed) {
23
29
  this.log(`${node_emoji_1.default.get("white_check_mark")} Test passed!: ${testResultUrl}`);
24
30
  this.exit();
package/dist/config.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- declare type Variable = "AUTIFY_WEB_ACCESS_TOKEN" | "AUTIFY_WEB_BASE_PATH" | "AUTIFY_MOBILE_ACCESS_TOKEN" | "AUTIFY_MOBILE_BASE_PATH";
1
+ declare type Variable = "AUTIFY_WEB_ACCESS_TOKEN" | "AUTIFY_WEB_BASE_PATH" | "AUTIFY_MOBILE_ACCESS_TOKEN" | "AUTIFY_MOBILE_BASE_PATH" | "AUTIFY_TEST_WAIT_INTERVAL_SECOND";
2
2
  export declare const set: (configDir: string, key: Variable, value: string | undefined) => void;
3
3
  export declare const get: (configDir: string, key: Variable) => string | undefined;
4
4
  export declare const getOrThrow: (configDir: string, key: Variable) => string;
@@ -1 +1 @@
1
- {"version":"0.3.1","commands":{"mobile:api:run-test-plan":{"id":"mobile:api:run-test-plan","description":"Run a test plan","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"test-plan-id":{"name":"test-plan-id","type":"option","description":"The ID of the test plan to run.","required":true,"multiple":false},"run-test-plan-request":{"name":"run-test-plan-request","type":"option","description":"The build_id to execute the test plan.","required":true,"multiple":false}},"args":[],"_globalFlags":{}},"mobile:api:upload-build":{"id":"mobile:api:upload-build","description":"Upload the build file.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"The ID of the project to upload the build file to.","required":true,"multiple":false},"file":{"name":"file","type":"option","description":"Build file.","required":true,"multiple":false}},"args":[],"_globalFlags":{}},"mobile:auth:login":{"id":"mobile:auth:login","description":"Login to Autify for Mobile","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["Start interactive setup:\n<%= config.bin %> <%= command.id %>","Reading the token from file:\n<%= config.bin %> <%= command.id %> < token.txt"],"flags":{},"args":[]},"web:api:create-url-replacement":{"id":"web:api:create-url-replacement","description":"Create a new url replacement for the test plan","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"test-plan-id":{"name":"test-plan-id","type":"option","description":"For example, 15 for the following URL: https://app.autify.com/projects/1/test_plans/15","required":true,"multiple":false},"create-url-replacement-request":{"name":"create-url-replacement-request","type":"option","description":"The url to replace","required":true,"multiple":false}},"args":[],"_globalFlags":{}},"web:api:delete-url-replacement":{"id":"web:api:delete-url-replacement","description":"Delete a url replacement for the test plan","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"test-plan-id":{"name":"test-plan-id","type":"option","description":"For example, 15 for the following URL: https://app.autify.com/projects/1/test_plans/15","required":true,"multiple":false},"url-replacement-id":{"name":"url-replacement-id","type":"option","description":"url_replacement id","required":true,"multiple":false}},"args":[],"_globalFlags":{}},"web:api:describe-result":{"id":"web:api:describe-result","description":"Get a result.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/results/4","required":true,"multiple":false},"result-id":{"name":"result-id","type":"option","description":"For example, 4 for the following URL: https://app.autify.com/projects/1/results/4","required":true,"multiple":false}},"args":[],"_globalFlags":{}},"web:api:describe-scenario":{"id":"web:api:describe-scenario","description":"Get a scenario.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/scenarios/2","required":true,"multiple":false},"scenario-id":{"name":"scenario-id","type":"option","description":"For example, 2 for the following URL: https://app.autify.com/projects/1/scenarios/2","required":true,"multiple":false}},"args":[],"_globalFlags":{}},"web:api:execute-scenarios":{"id":"web:api:execute-scenarios","description":"You can execute any scenarios in your workspace using any execution environments (which is called \"capabilities\" here).","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/scenarios","required":true,"multiple":false},"execute-scenarios-request":{"name":"execute-scenarios-request","type":"option","description":"The scenarios and settings to execute","required":true,"multiple":false}},"args":[],"_globalFlags":{}},"web:api:execute-schedule":{"id":"web:api:execute-schedule","description":"Run a test plan. (Note: \"Schedule\" is called as \"TestPlan\" now.)","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"schedule-id":{"name":"schedule-id","type":"option","description":"For example, 3 for the following URL: https://app.autify.com/projects/1/test_plans/3","required":true,"multiple":false}},"args":[],"_globalFlags":{}},"web:api:list-capabilities":{"id":"web:api:list-capabilities","description":"List available Capabilities.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/capabilities","required":true,"multiple":false},"os":{"name":"os","type":"option","description":"os name to filter","required":false,"multiple":false},"browser":{"name":"browser","type":"option","description":"browser name to filter","required":false,"multiple":false},"device-type":{"name":"device-type","type":"option","description":"device_type name to filter","required":false,"multiple":false}},"args":[],"_globalFlags":{}},"web:api:list-results":{"id":"web:api:list-results","description":"List results.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/results","required":true,"multiple":false},"page":{"name":"page","type":"option","description":"The number of page returns.","required":false,"multiple":false},"per-page":{"name":"per-page","type":"option","description":"The number of items returns. Default number is 30 and up to a maximum of 100","required":false,"multiple":false},"test-plan-id":{"name":"test-plan-id","type":"option","description":"Test plan ID used to filter results.","required":false,"multiple":false}},"args":[],"_globalFlags":{}},"web:api:list-scenarios":{"id":"web:api:list-scenarios","description":"List scenarios.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/scenarios","required":true,"multiple":false},"page":{"name":"page","type":"option","description":"The number of page returns.","required":false,"multiple":false}},"args":[],"_globalFlags":{}},"web:api:list-url-replacements":{"id":"web:api:list-url-replacements","description":"List url replacements for the test plan","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"test-plan-id":{"name":"test-plan-id","type":"option","description":"For example, 15 for the following URL: https://app.autify.com/projects/1/test_plans/15","required":true,"multiple":false}},"args":[],"_globalFlags":{}},"web:api:update-url-replacement":{"id":"web:api:update-url-replacement","description":"Update a url replacement for the test plan","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"test-plan-id":{"name":"test-plan-id","type":"option","description":"For example, 15 for the following URL: https://app.autify.com/projects/1/test_plans/15","required":true,"multiple":false},"url-replacement-id":{"name":"url-replacement-id","type":"option","description":"url_replacement id","required":true,"multiple":false},"update-url-replacement-request":{"name":"update-url-replacement-request","type":"option","description":"The url to replace. Either pattern_url or replacement_url is required.","required":true,"multiple":false}},"args":[],"_globalFlags":{}},"web:auth:login":{"id":"web:auth:login","description":"Login to Autify for Web","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["Start interactive setup:\n<%= config.bin %> <%= command.id %>","Reading the token from file:\n<%= config.bin %> <%= command.id %> < token.txt"],"flags":{},"args":[]},"web:test:run":{"id":"web:test:run","description":"Run a scenario or test plan.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["Run a test scenario (Default capability):\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000","Run a test plan:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/test_plans/0000","Run and wait a test scenario:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 --wait --timeout 600","Run a test scenario with a specific capability:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 --os \"Windows Server\" --browser Edge","With URL replacements:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 -r http://example.com=http://example.net -r http://example.org=http://example.net","Run a test with specifying the execution name:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 --name \"Sample execution\""],"flags":{"name":{"name":"name","type":"option","char":"n","description":"Name of the test execution. (Only for test scenario execution.)","multiple":false},"url-replacements":{"name":"url-replacements","type":"option","char":"r","description":"URL replacements. Example: http://example.com=http://example.net","multiple":true},"os":{"name":"os","type":"option","description":"OS to run the test","multiple":false},"os-version":{"name":"os-version","type":"option","description":"OS version to run the test","multiple":false},"browser":{"name":"browser","type":"option","description":"Browser to run the test","multiple":false},"device":{"name":"device","type":"option","description":"Device to run the test","multiple":false},"device-type":{"name":"device-type","type":"option","description":"Device type to run the test","multiple":false},"wait":{"name":"wait","type":"boolean","char":"w","description":"Wait until the test finishes.","allowNo":false},"timeout":{"name":"timeout","type":"option","char":"t","description":"Timeout seconds when waiting for the finish of the test execution.","multiple":false,"default":300},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose output","allowNo":false}},"args":[{"name":"scenario-or-test-plan-url","description":"Scenario URL or Test plan URL e.g. https://app.autify.com/projects/<ID>/(scenarios|test_plans)/<ID>","required":true}],"_globalFlags":{}},"web:test:wait":{"id":"web:test:wait","description":"Wait a test result until it finishes.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/results/0000"],"flags":{"timeout":{"name":"timeout","type":"option","char":"t","description":"Timeout seconds when waiting for the finish of the test execution.","multiple":false,"default":300},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose output","allowNo":false}},"args":[{"name":"test-result-url","description":"Test result URL e.g. https://app.autify.com/projects/<ID>/results/<ID>","required":true}],"_globalFlags":{}}}}
1
+ {"version":"0.6.0","commands":{"mobile:api:describe-test-result":{"id":"mobile:api:describe-test-result","description":"Get a test result.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"ID of the project from which the test results will be obtained.","required":true,"multiple":false},"id":{"name":"id","type":"option","description":"Test Result ID.","required":true,"multiple":false}},"args":[]},"mobile:api:list-test-results":{"id":"mobile:api:list-test-results","description":"List test results.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"ID of the project from which the list of test results will be retrieved.","required":true,"multiple":false},"page":{"name":"page","type":"option","description":"Page number to be retrieved.","required":false,"multiple":false},"per-page":{"name":"per-page","type":"option","description":"Number of test results per page.","required":false,"multiple":false},"test-plan-id":{"name":"test-plan-id","type":"option","description":"ID of the test plan.","required":false,"multiple":false}},"args":[]},"mobile:api:run-test-plan":{"id":"mobile:api:run-test-plan","description":"Run a test plan","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"test-plan-id":{"name":"test-plan-id","type":"option","description":"The ID of the test plan to run.","required":true,"multiple":false},"run-test-plan-request":{"name":"run-test-plan-request","type":"option","description":"The build_id to execute the test plan.","required":true,"multiple":false}},"args":[]},"mobile:api:upload-build":{"id":"mobile:api:upload-build","description":"Upload the build file.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"The ID of the project to upload the build file to.","required":true,"multiple":false},"file":{"name":"file","type":"option","description":"Build file.","required":true,"multiple":false}},"args":[]},"mobile:auth:login":{"id":"mobile:auth:login","description":"Login to Autify for Mobile","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["Start interactive setup:\n<%= config.bin %> <%= command.id %>","Reading the token from file:\n<%= config.bin %> <%= command.id %> < token.txt"],"flags":{},"args":[]},"mobile:build:upload":{"id":"mobile:build:upload","description":"Upload a build file","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>","Upload build file\n<%= config.bin %> <%= command.id %> --workspace-id AAA ./my.app","Upload build file (JSON output)\n<%= config.bin %> <%= command.id %> --workspace-id AAA ./my.app --json"],"flags":{"json":{"name":"json","type":"boolean","description":"Format output as json.","helpGroup":"GLOBAL","allowNo":false},"workspace-id":{"name":"workspace-id","type":"option","char":"w","description":"Workspace ID to upload the build file","required":true,"multiple":false}},"args":[{"name":"build-path","description":"File path to the iOS app (*.app) or Android app (*.apk).","required":true}],"_enableJsonFlag":true,"_globalFlags":{"json":{"description":"Format output as json.","helpGroup":"GLOBAL","allowNo":false,"type":"boolean"}}},"mobile:test:run":{"id":"mobile:test:run","description":"Run a test plan.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["Run a test plan with a build ID:\n<%= config.bin %> <%= command.id %> --build-id CCC https://mobile-app.autify.com/projects/AAA/test_plans/BBB","Run a test plan with a new build file:\n<%= config.bin %> <%= command.id %> --build-path ./my.[app|apk] https://mobile-app.autify.com/projects/AAA/test_plans/BBB","Run and wait a test plan:\n<%= config.bin %> <%= command.id %> --build-id CCC https://mobile-app.autify.com/projects/AAA/test_plans/BBB --wait --timeout 600"],"flags":{"build-id":{"name":"build-id","type":"option","description":"ID of the already uploaded build.","multiple":false,"exclusive":["build-path"]},"build-path":{"name":"build-path","type":"option","description":"File path to the iOS app (*.app) or Android app (*.apk).","multiple":false,"exclusive":["build-id"]},"wait":{"name":"wait","type":"boolean","char":"w","description":"Wait until the test finishes.","allowNo":false},"timeout":{"name":"timeout","type":"option","char":"t","description":"Timeout seconds when waiting for the finish of the test execution.","multiple":false,"default":300},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose output","allowNo":false}},"args":[{"name":"test-plan-url","description":"Test plan URL e.g. https://mobile-app.autify.com/projects/<ID>/test_plans/<ID>","required":true}]},"mobile:test:wait":{"id":"mobile:test:wait","description":"Wait a test result until it finishes.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %> https://mobile-app.autify.com/projects/AAA/results/BBB"],"flags":{"timeout":{"name":"timeout","type":"option","char":"t","description":"Timeout seconds when waiting for the finish of the test execution.","multiple":false,"default":300},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose output","allowNo":false}},"args":[{"name":"test-result-url","description":"Test result URL e.g. https://mobile-app.autify.com/projects/<ID>/results/<ID>","required":true}]},"web:api:create-url-replacement":{"id":"web:api:create-url-replacement","description":"Create a new url replacement for the test plan","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"test-plan-id":{"name":"test-plan-id","type":"option","description":"For example, 15 for the following URL: https://app.autify.com/projects/1/test_plans/15","required":true,"multiple":false},"create-url-replacement-request":{"name":"create-url-replacement-request","type":"option","description":"The url to replace","required":true,"multiple":false}},"args":[]},"web:api:delete-url-replacement":{"id":"web:api:delete-url-replacement","description":"Delete a url replacement for the test plan","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"test-plan-id":{"name":"test-plan-id","type":"option","description":"For example, 15 for the following URL: https://app.autify.com/projects/1/test_plans/15","required":true,"multiple":false},"url-replacement-id":{"name":"url-replacement-id","type":"option","description":"url_replacement id","required":true,"multiple":false}},"args":[]},"web:api:describe-result":{"id":"web:api:describe-result","description":"Get a result.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/results/4","required":true,"multiple":false},"result-id":{"name":"result-id","type":"option","description":"For example, 4 for the following URL: https://app.autify.com/projects/1/results/4","required":true,"multiple":false}},"args":[]},"web:api:describe-scenario":{"id":"web:api:describe-scenario","description":"Get a scenario.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/scenarios/2","required":true,"multiple":false},"scenario-id":{"name":"scenario-id","type":"option","description":"For example, 2 for the following URL: https://app.autify.com/projects/1/scenarios/2","required":true,"multiple":false}},"args":[]},"web:api:execute-scenarios":{"id":"web:api:execute-scenarios","description":"You can execute any scenarios in your workspace using any execution environments (which is called \"capabilities\" here).","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/scenarios","required":true,"multiple":false},"execute-scenarios-request":{"name":"execute-scenarios-request","type":"option","description":"The scenarios and settings to execute","required":true,"multiple":false}},"args":[]},"web:api:execute-schedule":{"id":"web:api:execute-schedule","description":"Run a test plan. (Note: \"Schedule\" is called as \"TestPlan\" now.)","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"schedule-id":{"name":"schedule-id","type":"option","description":"For example, 3 for the following URL: https://app.autify.com/projects/1/test_plans/3","required":true,"multiple":false}},"args":[]},"web:api:list-capabilities":{"id":"web:api:list-capabilities","description":"List available Capabilities.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/capabilities","required":true,"multiple":false},"os":{"name":"os","type":"option","description":"os name to filter","required":false,"multiple":false},"browser":{"name":"browser","type":"option","description":"browser name to filter","required":false,"multiple":false},"device-type":{"name":"device-type","type":"option","description":"device_type name to filter","required":false,"multiple":false}},"args":[]},"web:api:list-results":{"id":"web:api:list-results","description":"List results.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/results","required":true,"multiple":false},"page":{"name":"page","type":"option","description":"The number of page returns.","required":false,"multiple":false},"per-page":{"name":"per-page","type":"option","description":"The number of items returns. Default number is 30 and up to a maximum of 100","required":false,"multiple":false},"test-plan-id":{"name":"test-plan-id","type":"option","description":"Test plan ID used to filter results.","required":false,"multiple":false}},"args":[]},"web:api:list-scenarios":{"id":"web:api:list-scenarios","description":"List scenarios.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"project-id":{"name":"project-id","type":"option","description":"For example, 1 for the following URL: https://app.autify.com/projects/1/scenarios","required":true,"multiple":false},"page":{"name":"page","type":"option","description":"The number of page returns.","required":false,"multiple":false}},"args":[]},"web:api:list-url-replacements":{"id":"web:api:list-url-replacements","description":"List url replacements for the test plan","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"test-plan-id":{"name":"test-plan-id","type":"option","description":"For example, 15 for the following URL: https://app.autify.com/projects/1/test_plans/15","required":true,"multiple":false}},"args":[]},"web:api:update-url-replacement":{"id":"web:api:update-url-replacement","description":"Update a url replacement for the test plan","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %>"],"flags":{"test-plan-id":{"name":"test-plan-id","type":"option","description":"For example, 15 for the following URL: https://app.autify.com/projects/1/test_plans/15","required":true,"multiple":false},"url-replacement-id":{"name":"url-replacement-id","type":"option","description":"url_replacement id","required":true,"multiple":false},"update-url-replacement-request":{"name":"update-url-replacement-request","type":"option","description":"The url to replace. Either pattern_url or replacement_url is required.","required":true,"multiple":false}},"args":[]},"web:auth:login":{"id":"web:auth:login","description":"Login to Autify for Web","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["Start interactive setup:\n<%= config.bin %> <%= command.id %>","Reading the token from file:\n<%= config.bin %> <%= command.id %> < token.txt"],"flags":{},"args":[]},"web:test:run":{"id":"web:test:run","description":"Run a scenario or test plan.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["Run a test scenario (Default capability):\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000","Run a test plan:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/test_plans/0000","Run and wait a test scenario:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 --wait --timeout 600","Run a test scenario with a specific capability:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 --os \"Windows Server\" --browser Edge","With URL replacements:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 -r http://example.com=http://example.net -r http://example.org=http://example.net","Run a test with specifying the execution name:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 --name \"Sample execution\"","Run a test scenario with Autify Connect:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 --autify-connect-key KEY_NAME"],"flags":{"name":{"name":"name","type":"option","char":"n","description":"Name of the test execution. (Only for test scenario execution.)","multiple":false},"url-replacements":{"name":"url-replacements","type":"option","char":"r","description":"URL replacements. Example: http://example.com=http://example.net","multiple":true},"autify-connect-key":{"name":"autify-connect-key","type":"option","description":"Name of the Autify Connect Key (Only for test scenario execution.)","multiple":false},"os":{"name":"os","type":"option","description":"OS to run the test","multiple":false},"os-version":{"name":"os-version","type":"option","description":"OS version to run the test","multiple":false},"browser":{"name":"browser","type":"option","description":"Browser to run the test","multiple":false},"device":{"name":"device","type":"option","description":"Device to run the test","multiple":false},"device-type":{"name":"device-type","type":"option","description":"Device type to run the test","multiple":false},"wait":{"name":"wait","type":"boolean","char":"w","description":"Wait until the test finishes.","allowNo":false},"timeout":{"name":"timeout","type":"option","char":"t","description":"Timeout seconds when waiting for the finish of the test execution.","multiple":false,"default":300},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose output","allowNo":false}},"args":[{"name":"scenario-or-test-plan-url","description":"Scenario URL or Test plan URL e.g. https://app.autify.com/projects/<ID>/(scenarios|test_plans)/<ID>","required":true}]},"web:test:wait":{"id":"web:test:wait","description":"Wait a test result until it finishes.","strict":true,"pluginName":"@autifyhq/autify-cli","pluginAlias":"@autifyhq/autify-cli","pluginType":"core","aliases":[],"examples":["<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/results/0000"],"flags":{"timeout":{"name":"timeout","type":"option","char":"t","description":"Timeout seconds when waiting for the finish of the test execution.","multiple":false,"default":300},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose output","allowNo":false}},"args":[{"name":"test-result-url","description":"Test result URL e.g. https://app.autify.com/projects/<ID>/results/<ID>","required":true}]}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autifyhq/autify-cli",
3
- "version": "0.3.1",
3
+ "version": "0.6.0",
4
4
  "description": "Autify Command Line Interface (CLI)",
5
5
  "author": "Autify",
6
6
  "bin": {
@@ -17,7 +17,7 @@
17
17
  "/oclif.manifest.json"
18
18
  ],
19
19
  "dependencies": {
20
- "@autifyhq/autify-sdk": "^0.1.0",
20
+ "@autifyhq/autify-sdk": "^0.3.0",
21
21
  "@oclif/core": "^1",
22
22
  "@oclif/errors": "^1.3.5",
23
23
  "@oclif/plugin-help": "^5",
@@ -28,7 +28,10 @@
28
28
  "inquirer": "^8.2.4",
29
29
  "listr": "^0.14.3",
30
30
  "node-emoji": "^1.11.0",
31
- "per-env": "^1.0.2"
31
+ "per-env": "^1.0.2",
32
+ "tempy": "^3.0.0",
33
+ "tsimportlib": "^0.0.3",
34
+ "which": "^2.0.2"
32
35
  },
33
36
  "devDependencies": {
34
37
  "@autifyhq/autify-cli-integration-test": "*",
@@ -37,7 +40,7 @@
37
40
  "@types/inquirer": "^8.2.1",
38
41
  "@types/listr": "^0.14.4",
39
42
  "@types/mocha": "^9.1.1",
40
- "@types/node": "^16.11.39",
43
+ "@types/node": "^16.11.52",
41
44
  "@types/node-emoji": "^1.8.1",
42
45
  "chai": "^4",
43
46
  "eslint": "^7.32.0",
@@ -45,16 +48,16 @@
45
48
  "eslint-config-oclif-typescript": "^1.0.2",
46
49
  "eslint-config-prettier": "^8.5.0",
47
50
  "husky": "^8.0.1",
48
- "lint-staged": "^13.0.1",
51
+ "lint-staged": "^13.0.3",
49
52
  "mocha": "^9",
50
53
  "oclif": "^3",
51
54
  "patch-package": "^6.4.7",
52
- "prettier": "^2.6.2",
55
+ "prettier": "^2.7.1",
53
56
  "shx": "^0.3.4",
54
57
  "ts-morph": "^14.0.0",
55
- "ts-node": "^10.8.1",
58
+ "ts-node": "^10.9.1",
56
59
  "tslib": "^2.4.0",
57
- "typescript": "^4.7.3"
60
+ "typescript": "^4.7.4"
58
61
  },
59
62
  "oclif": {
60
63
  "bin": "autify",
@@ -105,10 +108,13 @@
105
108
  "postinstall:development": "patch-package",
106
109
  "postinstall:production": "true",
107
110
  "generate:api-commands": "ts-node scripts/generate-api-commands.ts",
108
- "generate": "npm run generate:api-commands web && npm run generate:api-commands mobile",
111
+ "generate": "npm run generate:api-commands web && npm run generate:api-commands mobile && npm run format-lint-api-commands",
109
112
  "build": "shx rm -rf dist && tsc -b",
110
113
  "lint": "eslint . --ext .ts --config .eslintrc",
111
114
  "format": "prettier . --write",
115
+ "format-api-commands": "prettier --write src/commands/web/api src/commands/mobile/api",
116
+ "lint-api-commands": "eslint --fix src/commands/web/api src/commands/mobile/api",
117
+ "format-lint-api-commands": "npm run format-api-commands && npm run lint-api-commands",
112
118
  "postpack": "shx rm -f oclif.manifest.json",
113
119
  "posttest": "npm run lint",
114
120
  "prepack": "npm run build && oclif manifest && oclif readme",