@autifyhq/autify-cli 0.11.0 → 0.13.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 (41) hide show
  1. package/README.md +75 -12
  2. package/dist/autify/connect/client-manager/ClientManager.js +2 -5
  3. package/dist/autify/connect/installClient.d.ts +8 -4
  4. package/dist/autify/connect/installClient.js +30 -20
  5. package/dist/autify/mobile/getMobileClient.d.ts +2 -0
  6. package/dist/autify/mobile/getMobileClient.js +17 -0
  7. package/dist/autify/web/getWebClient.d.ts +2 -0
  8. package/dist/autify/web/getWebClient.js +17 -0
  9. package/dist/autify/web/runTest.js +8 -3
  10. package/dist/commands/connect/access-point/create.js +2 -5
  11. package/dist/commands/connect/client/install.js +3 -2
  12. package/dist/commands/mobile/api/describe-test-result.js +2 -5
  13. package/dist/commands/mobile/api/list-test-results.js +2 -5
  14. package/dist/commands/mobile/api/run-test-plan.js +2 -5
  15. package/dist/commands/mobile/api/upload-build.js +2 -5
  16. package/dist/commands/mobile/build/upload.js +2 -5
  17. package/dist/commands/mobile/test/run.js +2 -5
  18. package/dist/commands/mobile/test/wait.js +2 -5
  19. package/dist/commands/web/api/create-access-point.d.ts +10 -0
  20. package/dist/commands/web/api/create-access-point.js +26 -0
  21. package/dist/commands/web/api/create-url-replacement.js +2 -5
  22. package/dist/commands/web/api/delete-access-point.d.ts +10 -0
  23. package/dist/commands/web/api/delete-access-point.js +26 -0
  24. package/dist/commands/web/api/delete-url-replacement.js +2 -5
  25. package/dist/commands/web/api/describe-result.js +2 -5
  26. package/dist/commands/web/api/describe-scenario.js +2 -5
  27. package/dist/commands/web/api/execute-scenarios.js +2 -5
  28. package/dist/commands/web/api/execute-schedule.d.ts +1 -0
  29. package/dist/commands/web/api/execute-schedule.js +9 -6
  30. package/dist/commands/web/api/list-access-points.d.ts +10 -0
  31. package/dist/commands/web/api/list-access-points.js +26 -0
  32. package/dist/commands/web/api/list-capabilities.js +2 -5
  33. package/dist/commands/web/api/list-results.js +2 -5
  34. package/dist/commands/web/api/list-scenarios.js +2 -5
  35. package/dist/commands/web/api/list-url-replacements.js +2 -5
  36. package/dist/commands/web/api/update-url-replacement.js +2 -5
  37. package/dist/commands/web/test/run.js +7 -10
  38. package/dist/commands/web/test/wait.js +2 -5
  39. package/dist/config.d.ts +1 -1
  40. package/oclif.manifest.json +1 -1
  41. package/package.json +15 -11
package/README.md CHANGED
@@ -33,12 +33,15 @@ See our official document: https://help.autify.com/docs/autify-command-line-inte
33
33
  * [`autify mobile test run TEST-PLAN-URL`](#autify-mobile-test-run-test-plan-url)
34
34
  * [`autify mobile test wait TEST-RESULT-URL`](#autify-mobile-test-wait-test-result-url)
35
35
  * [`autify update [CHANNEL]`](#autify-update-channel)
36
+ * [`autify web api create-access-point`](#autify-web-api-create-access-point)
36
37
  * [`autify web api create-url-replacement`](#autify-web-api-create-url-replacement)
38
+ * [`autify web api delete-access-point`](#autify-web-api-delete-access-point)
37
39
  * [`autify web api delete-url-replacement`](#autify-web-api-delete-url-replacement)
38
40
  * [`autify web api describe-result`](#autify-web-api-describe-result)
39
41
  * [`autify web api describe-scenario`](#autify-web-api-describe-scenario)
40
42
  * [`autify web api execute-scenarios`](#autify-web-api-execute-scenarios)
41
43
  * [`autify web api execute-schedule`](#autify-web-api-execute-schedule)
44
+ * [`autify web api list-access-points`](#autify-web-api-list-access-points)
42
45
  * [`autify web api list-capabilities`](#autify-web-api-list-capabilities)
43
46
  * [`autify web api list-results`](#autify-web-api-list-results)
44
47
  * [`autify web api list-scenarios`](#autify-web-api-list-scenarios)
@@ -100,7 +103,7 @@ USAGE
100
103
  $ autify connect client install [VERSION]
101
104
 
102
105
  ARGUMENTS
103
- VERSION [default: v0.6.3] Specify the target version of Autify Connect Client.
106
+ VERSION [default: v0.6.12] Specify the target version of Autify Connect Client.
104
107
 
105
108
  DESCRIPTION
106
109
  Install Autify Connect Client
@@ -166,7 +169,7 @@ DESCRIPTION
166
169
  Display help for autify.
167
170
  ```
168
171
 
169
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.1.12/src/commands/help.ts)_
172
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.1.14/src/commands/help.ts)_
170
173
 
171
174
  ## `autify mobile api describe-test-result`
172
175
 
@@ -395,7 +398,27 @@ EXAMPLES
395
398
  $ autify update --available
396
399
  ```
397
400
 
398
- _See code: [@oclif/plugin-update](https://github.com/oclif/plugin-update/blob/v3.0.0/src/commands/update.ts)_
401
+ _See code: [@oclif/plugin-update](https://github.com/oclif/plugin-update/blob/v3.0.2/src/commands/update.ts)_
402
+
403
+ ## `autify web api create-access-point`
404
+
405
+ You can generate a new access point by passing in its name.
406
+
407
+ ```
408
+ USAGE
409
+ $ autify web api create-access-point --project-id <value> --create-access-point-request <value>
410
+
411
+ FLAGS
412
+ --create-access-point-request=<value> (required) The name of the access point to be created
413
+ --project-id=<value> (required) For example, 1 for the following URL:
414
+ https://app.autify.com/projects/1/scenarios
415
+
416
+ DESCRIPTION
417
+ You can generate a new access point by passing in its name.
418
+
419
+ EXAMPLES
420
+ $ autify web api create-access-point
421
+ ```
399
422
 
400
423
  ## `autify web api create-url-replacement`
401
424
 
@@ -417,6 +440,26 @@ EXAMPLES
417
440
  $ autify web api create-url-replacement
418
441
  ```
419
442
 
443
+ ## `autify web api delete-access-point`
444
+
445
+ You can delete an access point by passing in its name.
446
+
447
+ ```
448
+ USAGE
449
+ $ autify web api delete-access-point --project-id <value> --delete-access-point-request <value>
450
+
451
+ FLAGS
452
+ --delete-access-point-request=<value> (required) The name of the access point to be deleted
453
+ --project-id=<value> (required) For example, 1 for the following URL:
454
+ https://app.autify.com/projects/1/scenarios
455
+
456
+ DESCRIPTION
457
+ You can delete an access point by passing in its name.
458
+
459
+ EXAMPLES
460
+ $ autify web api delete-access-point
461
+ ```
462
+
420
463
  ## `autify web api delete-url-replacement`
421
464
 
422
465
  Delete a url replacement for the test plan
@@ -502,10 +545,12 @@ Run a test plan. (Note: "Schedule" is called as "TestPlan" now.)
502
545
 
503
546
  ```
504
547
  USAGE
505
- $ autify web api execute-schedule --schedule-id <value>
548
+ $ autify web api execute-schedule --schedule-id <value> [--execute-schedule-request <value>]
506
549
 
507
550
  FLAGS
508
- --schedule-id=<value> (required) For example, 3 for the following URL: https://app.autify.com/projects/1/test_plans/3
551
+ --execute-schedule-request=<value> The options to execute a test plan.
552
+ --schedule-id=<value> (required) For example, 3 for the following URL:
553
+ https://app.autify.com/projects/1/test_plans/3
509
554
 
510
555
  DESCRIPTION
511
556
  Run a test plan. (Note: "Schedule" is called as "TestPlan" now.)
@@ -514,6 +559,25 @@ EXAMPLES
514
559
  $ autify web api execute-schedule
515
560
  ```
516
561
 
562
+ ## `autify web api list-access-points`
563
+
564
+ List access points for the project.
565
+
566
+ ```
567
+ USAGE
568
+ $ autify web api list-access-points --project-id <value> [--page <value>]
569
+
570
+ FLAGS
571
+ --page=<value> The number of page returns.
572
+ --project-id=<value> (required) For example, 1 for the following URL: https://app.autify.com/projects/1/scenarios
573
+
574
+ DESCRIPTION
575
+ List access points for the project.
576
+
577
+ EXAMPLES
578
+ $ autify web api list-access-points
579
+ ```
580
+
517
581
  ## `autify web api list-capabilities`
518
582
 
519
583
  List available Capabilities.
@@ -660,13 +724,12 @@ FLAGS
660
724
  test execution.
661
725
  -v, --verbose Verbose output
662
726
  -w, --wait Wait until the test finishes.
663
- --autify-connect=<value> [Only for test scenario] Name of the Autify Connect Access Point.
664
- --autify-connect-client [Only for test scenario] Start Autify Connect Client
665
- --autify-connect-client-debug-server-port=<value> [Only for test scenario] Port for Autify Connect Client debug
666
- server. A random port will be used if not specified.
667
- --autify-connect-client-file-logging [Only for test scenario] Logging Autify Connect Client log to a
668
- file instead of console.
669
- --autify-connect-client-verbose [Only for test scenario] Verbose output for Autify Connect Client.
727
+ --autify-connect=<value> Name of the Autify Connect Access Point.
728
+ --autify-connect-client Start Autify Connect Client
729
+ --autify-connect-client-debug-server-port=<value> Port for Autify Connect Client debug server. A random port will be
730
+ used if not specified.
731
+ --autify-connect-client-file-logging Logging Autify Connect Client log to a file instead of console.
732
+ --autify-connect-client-verbose Verbose output for Autify Connect Client.
670
733
  --browser=<value> [Only for test scenario] Browser to run the test
671
734
  --device=<value> [Only for test scenario] Device to run the test
672
735
  --device-type=<value> [Only for test scenario] Device type to run the test
@@ -2,8 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ClientManager = exports.StateMachineTimeoutError = void 0;
4
4
  const tslib_1 = require("tslib");
5
- /* eslint-disable unicorn/filename-case */
6
- const autify_sdk_1 = require("@autifyhq/autify-sdk");
7
5
  const errors_1 = require("@oclif/errors");
8
6
  const node_child_process_1 = require("node:child_process");
9
7
  const node_process_1 = require("node:process");
@@ -17,6 +15,7 @@ const StateMachine_1 = require("./StateMachine");
17
15
  const Logger_1 = require("./Logger");
18
16
  const node_path_1 = require("node:path");
19
17
  const get_port_1 = tslib_1.__importDefault(require("get-port"));
18
+ const getWebClient_1 = require("../../web/getWebClient");
20
19
  class StateMachineTimeoutError extends errors_1.CLIError {
21
20
  constructor(state) {
22
21
  super(`Autify Connect Manager faced timeout at ${state} state.`);
@@ -67,9 +66,7 @@ class ClientManager {
67
66
  static async create(options) {
68
67
  if (options.webWorkspaceId) {
69
68
  const { configDir, userAgent, webWorkspaceId } = options;
70
- const accessToken = (0, config_1.getOrThrow)(configDir, "AUTIFY_WEB_ACCESS_TOKEN");
71
- const basePath = (0, config_1.get)(configDir, "AUTIFY_WEB_BASE_PATH");
72
- const client = new autify_sdk_1.WebClient(accessToken, { basePath, userAgent });
69
+ const client = (0, getWebClient_1.getWebClient)(configDir, userAgent);
73
70
  return this.createWithEphemeralAccessPointForWeb(client, webWorkspaceId, options);
74
71
  }
75
72
  return this.createWithStaticAccessPoint(options);
@@ -1,15 +1,19 @@
1
+ /// <reference types="node" />
1
2
  import { CLIError } from "@oclif/errors";
2
- export declare const AUTIFY_CONNECT_CLIENT_SUPPORTED_VERSION = "v0.6.3";
3
- export declare type ClientMode = "fake" | "real";
3
+ export declare const AUTIFY_CONNECT_CLIENT_SUPPORTED_VERSION = "v0.6.12";
4
+ export declare const getConnectClientSourceUrl: (configDir: string, version: string) => {
5
+ url: URL;
6
+ expectedVersion: string | undefined;
7
+ };
4
8
  export declare class ConnectClientVersionMismatchError extends CLIError {
5
9
  readonly expected: string;
6
10
  readonly reality: string;
7
11
  constructor(expected: string, reality: string);
8
12
  }
9
- export declare const validateVersion: (versionString: string, version: string) => Promise<void>;
13
+ export declare const validateVersion: (versionString: string, version: string | undefined) => Promise<void>;
10
14
  export declare const getInstallPath: (configDir: string, cacheDir: string) => string;
11
15
  export declare const getInstallVersion: (path: string) => Promise<string>;
12
- export declare const installClient: (configDir: string, cacheDir: string, version: string) => Promise<{
16
+ export declare const installClient: (configDir: string, cacheDir: string, url: URL, version: string | undefined) => Promise<{
13
17
  version: string;
14
18
  path: string;
15
19
  }>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.installClient = exports.getInstallVersion = exports.getInstallPath = exports.validateVersion = exports.ConnectClientVersionMismatchError = exports.AUTIFY_CONNECT_CLIENT_SUPPORTED_VERSION = void 0;
3
+ exports.installClient = exports.getInstallVersion = exports.getInstallPath = exports.validateVersion = exports.ConnectClientVersionMismatchError = exports.getConnectClientSourceUrl = exports.AUTIFY_CONNECT_CLIENT_SUPPORTED_VERSION = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  /* eslint-disable unicorn/filename-case */
6
6
  const errors_1 = require("@oclif/errors");
@@ -15,7 +15,7 @@ const node_child_process_1 = require("node:child_process");
15
15
  const tar_1 = tslib_1.__importDefault(require("tar"));
16
16
  const config_1 = require("../../config");
17
17
  // Update whenever to bump supported version.
18
- exports.AUTIFY_CONNECT_CLIENT_SUPPORTED_VERSION = "v0.6.3";
18
+ exports.AUTIFY_CONNECT_CLIENT_SUPPORTED_VERSION = "v0.6.12";
19
19
  const getMode = (configDir) => {
20
20
  const mode = (0, config_1.get)(configDir, "AUTIFY_CONNECT_CLIENT_MODE");
21
21
  if (!mode)
@@ -46,16 +46,26 @@ const getArch = () => {
46
46
  const getExt = () => (getOs() === "windows" ? "zip" : "tar.gz");
47
47
  const realBaseUrl = "https://autifyconnect.s3.ap-northeast-1.amazonaws.com/autifyconnect/versions";
48
48
  const fakeBaseUrl = "https://autifyconnect.s3.ap-northeast-1.amazonaws.com/fake/versions";
49
- const getUrl = (mode, version) => {
49
+ const getConnectClientSourceUrl = (configDir, version) => {
50
+ const customUrl = (0, config_1.get)(configDir, "AUTIFY_CONNECT_CLIENT_SOURCE_URL");
51
+ if (customUrl)
52
+ return {
53
+ url: new URL(customUrl),
54
+ expectedVersion: undefined,
55
+ };
56
+ const mode = getMode(configDir);
50
57
  const baseUrl = mode === "fake" ? fakeBaseUrl : realBaseUrl;
51
58
  const prefix = mode === "fake" ? "autifyconnect-fake" : "autifyconnect";
52
59
  const os = getOs();
53
60
  const arch = getArch();
54
61
  const ext = getExt();
55
- return new URL(`${baseUrl}/${version}/${prefix}_${os}_${arch}.${ext}`);
62
+ return {
63
+ url: new URL(`${baseUrl}/${version}/${prefix}_${os}_${arch}.${ext}`),
64
+ expectedVersion: version,
65
+ };
56
66
  };
57
- const download = async (workspaceDir, mode, version) => {
58
- const url = getUrl(mode, version);
67
+ exports.getConnectClientSourceUrl = getConnectClientSourceUrl;
68
+ const download = async (workspaceDir, url) => {
59
69
  const downloadPath = (0, node_path_1.join)(workspaceDir, (0, node_path_1.basename)(url.pathname));
60
70
  const response = await (0, node_fetch_1.default)(url);
61
71
  if (!response.ok)
@@ -65,24 +75,25 @@ const download = async (workspaceDir, mode, version) => {
65
75
  return downloadPath;
66
76
  };
67
77
  const extract = async (downloadPath) => {
68
- const file = (0, node_path_1.basename)(downloadPath);
69
78
  const dir = (0, node_path_1.dirname)(downloadPath);
70
- const binaryName = file.startsWith("autifyconnect-fake")
71
- ? "autifyconnect-fake"
72
- : "autifyconnect";
73
- if (file.endsWith(".tar.gz")) {
79
+ if (downloadPath.endsWith(".tar.gz")) {
74
80
  const streamPipeline = (0, node_util_1.promisify)(node_stream_1.pipeline);
75
81
  await streamPipeline((0, node_fs_1.createReadStream)(downloadPath), tar_1.default.x({ cwd: dir }));
76
- return (0, node_path_1.join)(dir, binaryName);
77
82
  }
78
- if (file.endsWith(".zip")) {
83
+ else if (downloadPath.endsWith(".zip")) {
79
84
  const streamPipeline = (0, node_util_1.promisify)(node_stream_1.pipeline);
80
85
  await streamPipeline((0, node_fs_1.createReadStream)(downloadPath),
81
86
  // eslint-disable-next-line new-cap
82
87
  (0, unzip_stream_1.Extract)({ path: dir }));
83
- return (0, node_path_1.join)(dir, `${binaryName}.exe`);
84
88
  }
85
- throw new errors_1.CLIError(`Unsupported file format: ${downloadPath}`);
89
+ else {
90
+ throw new errors_1.CLIError(`Unsupported file format: ${downloadPath}`);
91
+ }
92
+ const files = (0, node_fs_1.readdirSync)(dir);
93
+ const binary = files.find((file) => file.startsWith("autifyconnect"));
94
+ if (!binary)
95
+ throw new errors_1.CLIError(`Cannot find any autifyconnect binary in ${dir}`);
96
+ return (0, node_path_1.join)(dir, binary);
86
97
  };
87
98
  class ConnectClientVersionMismatchError extends errors_1.CLIError {
88
99
  constructor(expected, reality) {
@@ -93,8 +104,8 @@ class ConnectClientVersionMismatchError extends errors_1.CLIError {
93
104
  }
94
105
  exports.ConnectClientVersionMismatchError = ConnectClientVersionMismatchError;
95
106
  const validateVersion = async (versionString, version) => {
96
- // No need to validate version if it's installed as "stable".
97
- if (version === "stable")
107
+ // No need to validate version if it's installed as "stable" or undefined.
108
+ if (!version || version === "stable")
98
109
  return;
99
110
  // Format example: Autify Connect version v0.6.1, build ca0972e
100
111
  if (!versionString.includes(version + ","))
@@ -123,14 +134,13 @@ const getInstallVersion = async (path) => {
123
134
  return version;
124
135
  };
125
136
  exports.getInstallVersion = getInstallVersion;
126
- const installClient = async (configDir, cacheDir, version) => {
127
- const mode = getMode(configDir);
137
+ const installClient = async (configDir, cacheDir, url, version) => {
128
138
  const workspaceDir = getWorkspaceDir(cacheDir);
129
139
  // Clean up workspace in case something is left by previous command.
130
140
  if ((0, node_fs_1.existsSync)(workspaceDir))
131
141
  (0, node_fs_1.rmSync)(workspaceDir, { recursive: true, force: true });
132
142
  (0, node_fs_1.mkdirSync)(workspaceDir);
133
- const downloadPath = await download(workspaceDir, mode, version);
143
+ const downloadPath = await download(workspaceDir, url);
134
144
  const extractPath = await extract(downloadPath);
135
145
  // Pre-install validation
136
146
  const preInstalledVersionString = await (0, exports.getInstallVersion)(extractPath);
@@ -0,0 +1,2 @@
1
+ import { MobileClient } from "@autifyhq/autify-sdk";
2
+ export declare const getMobileClient: (configDir: string, userAgent: string) => MobileClient;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMobileClient = 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 getMobileClient = (configDir, userAgent) => {
8
+ var _a;
9
+ const accessToken = (0, config_1.getOrThrow)(configDir, "AUTIFY_MOBILE_ACCESS_TOKEN");
10
+ const basePath = (0, config_1.get)(configDir, "AUTIFY_MOBILE_BASE_PATH");
11
+ const userAgentSuffix = (_a = (0, config_1.get)(configDir, "AUTIFY_CLI_USER_AGENT_SUFFIX")) !== null && _a !== void 0 ? _a : "";
12
+ return new autify_sdk_1.MobileClient(accessToken, {
13
+ basePath,
14
+ userAgent: `${userAgent} ${userAgentSuffix}`.trim(),
15
+ });
16
+ };
17
+ exports.getMobileClient = getMobileClient;
@@ -0,0 +1,2 @@
1
+ import { WebClient } from "@autifyhq/autify-sdk";
2
+ export declare const getWebClient: (configDir: string, userAgent: string) => WebClient;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getWebClient = 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 getWebClient = (configDir, userAgent) => {
8
+ var _a;
9
+ const accessToken = (0, config_1.getOrThrow)(configDir, "AUTIFY_WEB_ACCESS_TOKEN");
10
+ const basePath = (0, config_1.get)(configDir, "AUTIFY_WEB_BASE_PATH");
11
+ const userAgentSuffix = (_a = (0, config_1.get)(configDir, "AUTIFY_CLI_USER_AGENT_SUFFIX")) !== null && _a !== void 0 ? _a : "";
12
+ return new autify_sdk_1.WebClient(accessToken, {
13
+ basePath,
14
+ userAgent: `${userAgent} ${userAgentSuffix}`.trim(),
15
+ });
16
+ };
17
+ exports.getWebClient = getWebClient;
@@ -57,14 +57,19 @@ const runTest = async (client, parsedTest, { option, name, urlReplacements, auti
57
57
  throw new errors_1.CLIError(`Running TestPlan doesn't support capability override: ${JSON.stringify(option)}`);
58
58
  if (name)
59
59
  throw new errors_1.CLIError(`Running TestPlan doesn't support --name: ${name}`);
60
- if (autifyConnectAccessPoint)
61
- throw new errors_1.CLIError("Running TestPlan doesn't support Autify Connect Access Point");
62
60
  const urlReplacementIds = [];
63
61
  for await (const urlReplacement of urlReplacements !== null && urlReplacements !== void 0 ? urlReplacements : []) {
64
62
  const res = await client.createUrlReplacement(testPlanId, urlReplacement);
65
63
  urlReplacementIds.push(res.data.id);
66
64
  }
67
- const res = await client.executeSchedule(testPlanId);
65
+ const res = await client.executeSchedule(testPlanId, {
66
+ ...(autifyConnectAccessPoint && {
67
+ // eslint-disable-next-line camelcase
68
+ autify_connect: {
69
+ name: autifyConnectAccessPoint,
70
+ },
71
+ }),
72
+ });
68
73
  for await (const urlReplacementId of urlReplacementIds) {
69
74
  await client.deleteUrlReplacement(testPlanId, urlReplacementId);
70
75
  }
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const autify_sdk_1 = require("@autifyhq/autify-sdk");
4
3
  const core_1 = require("@oclif/core");
5
4
  const accessPointConfig_1 = require("../../../autify/connect/accessPointConfig");
6
- const config_1 = require("../../../config");
5
+ const getWebClient_1 = require("../../../autify/web/getWebClient");
7
6
  class ConnectAccessPointCreate extends core_1.Command {
8
7
  async run() {
9
8
  const { flags } = await this.parse(ConnectAccessPointCreate);
@@ -11,9 +10,7 @@ class ConnectAccessPointCreate extends core_1.Command {
11
10
  await (0, accessPointConfig_1.confirmOverwriteAccessPoint)(configDir);
12
11
  const { name, "web-workspace-id": webWorkspaceId } = flags;
13
12
  if (webWorkspaceId) {
14
- const accessToken = (0, config_1.getOrThrow)(configDir, "AUTIFY_WEB_ACCESS_TOKEN");
15
- const basePath = (0, config_1.get)(configDir, "AUTIFY_WEB_BASE_PATH");
16
- const client = new autify_sdk_1.WebClient(accessToken, { basePath, userAgent });
13
+ const client = (0, getWebClient_1.getWebClient)(configDir, userAgent);
17
14
  const response = await client.createAccessPoint(webWorkspaceId, {
18
15
  name,
19
16
  });
@@ -6,8 +6,9 @@ class ConnectClientInstall extends core_1.Command {
6
6
  async run() {
7
7
  const { args } = await this.parse(ConnectClientInstall);
8
8
  const { configDir, cacheDir } = this.config;
9
- core_1.CliUx.ux.action.start(`Installing Autify Connect Client (version: ${args.version})`, "installing", { stdout: true });
10
- const { version, path } = await (0, installClient_1.installClient)(configDir, cacheDir, args.version);
9
+ const { url, expectedVersion } = (0, installClient_1.getConnectClientSourceUrl)(configDir, args.version);
10
+ core_1.CliUx.ux.action.start(`Installing Autify Connect Client from ${url})`, "installing", { stdout: true });
11
+ const { version, path } = await (0, installClient_1.installClient)(configDir, cacheDir, url, expectedVersion);
11
12
  core_1.CliUx.ux.action.stop();
12
13
  this.log(`Successfully installed Autify Connect Client (path: ${path}, version: ${version})`);
13
14
  }
@@ -1,15 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
- const autify_sdk_1 = require("@autifyhq/autify-sdk");
5
- const config_1 = require("../../../config");
4
+ const getMobileClient_1 = require("../../../autify/mobile/getMobileClient");
6
5
  class MobileApiDescribeTestResult extends core_1.Command {
7
6
  async run() {
8
7
  const { flags } = await this.parse(MobileApiDescribeTestResult);
9
8
  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 });
9
+ const client = (0, getMobileClient_1.getMobileClient)(configDir, userAgent);
13
10
  const res = await client.describeTestResult(flags["project-id"], flags.id);
14
11
  console.log(JSON.stringify(res.data, null, 2));
15
12
  }
@@ -1,15 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
- const autify_sdk_1 = require("@autifyhq/autify-sdk");
5
- const config_1 = require("../../../config");
4
+ const getMobileClient_1 = require("../../../autify/mobile/getMobileClient");
6
5
  class MobileApiListTestResults extends core_1.Command {
7
6
  async run() {
8
7
  const { flags } = await this.parse(MobileApiListTestResults);
9
8
  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 });
9
+ const client = (0, getMobileClient_1.getMobileClient)(configDir, userAgent);
13
10
  const res = await client.listTestResults(flags["project-id"], flags.page, flags["per-page"], flags["test-plan-id"]);
14
11
  console.log(JSON.stringify(res.data, null, 2));
15
12
  }
@@ -1,15 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
- const autify_sdk_1 = require("@autifyhq/autify-sdk");
5
- const config_1 = require("../../../config");
4
+ const getMobileClient_1 = require("../../../autify/mobile/getMobileClient");
6
5
  class MobileApiRunTestPlan extends core_1.Command {
7
6
  async run() {
8
7
  const { flags } = await this.parse(MobileApiRunTestPlan);
9
8
  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 });
9
+ const client = (0, getMobileClient_1.getMobileClient)(configDir, userAgent);
13
10
  const res = await client.runTestPlan(flags["test-plan-id"], JSON.parse(flags["run-test-plan-request"]));
14
11
  console.log(JSON.stringify(res.data, null, 2));
15
12
  }
@@ -1,15 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
- const autify_sdk_1 = require("@autifyhq/autify-sdk");
5
- const config_1 = require("../../../config");
4
+ const getMobileClient_1 = require("../../../autify/mobile/getMobileClient");
6
5
  class MobileApiUploadBuild extends core_1.Command {
7
6
  async run() {
8
7
  const { flags } = await this.parse(MobileApiUploadBuild);
9
8
  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 });
9
+ const client = (0, getMobileClient_1.getMobileClient)(configDir, userAgent);
13
10
  const res = await client.uploadBuild(flags["project-id"], flags.file);
14
11
  console.log(JSON.stringify(res.data, null, 2));
15
12
  }
@@ -1,21 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const autify_sdk_1 = require("@autifyhq/autify-sdk");
5
4
  const core_1 = require("@oclif/core");
6
5
  const node_emoji_1 = tslib_1.__importDefault(require("node-emoji"));
7
6
  const getBuildDetailUrl_1 = require("../../../autify/mobile/getBuildDetailUrl");
7
+ const getMobileClient_1 = require("../../../autify/mobile/getMobileClient");
8
8
  const uploadBuild_1 = require("../../../autify/mobile/uploadBuild");
9
- const config_1 = require("../../../config");
10
9
  class MobileBuildUpload extends core_1.Command {
11
10
  async run() {
12
11
  const { args, flags } = await this.parse(MobileBuildUpload);
13
12
  const buildPath = args["build-path"];
14
13
  const workspaceId = flags["workspace-id"];
15
14
  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 });
15
+ const client = (0, getMobileClient_1.getMobileClient)(configDir, userAgent);
19
16
  const [buildId, os] = await (0, uploadBuild_1.uploadBuild)(client, workspaceId, buildPath);
20
17
  const buildDetailUrl = (0, getBuildDetailUrl_1.getBuildDetailUrl)(configDir, workspaceId, os, buildId);
21
18
  this.log(`${node_emoji_1.default.get("white_check_mark")} Successfully uploaded ${buildPath} (ID: ${buildId}). See ${buildDetailUrl}`);
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const autify_sdk_1 = require("@autifyhq/autify-sdk");
5
4
  const core_1 = require("@oclif/core");
6
5
  const errors_1 = require("@oclif/errors");
7
6
  const node_emoji_1 = tslib_1.__importDefault(require("node-emoji"));
7
+ const getMobileClient_1 = require("../../../autify/mobile/getMobileClient");
8
8
  const getTestResultUrl_1 = require("../../../autify/mobile/getTestResultUrl");
9
9
  const parseTestPlanUrl_1 = require("../../../autify/mobile/parseTestPlanUrl");
10
- const config_1 = require("../../../config");
11
10
  const upload_1 = tslib_1.__importDefault(require("../build/upload"));
12
11
  const wait_1 = tslib_1.__importDefault(require("./wait"));
13
12
  class MobileTestRun extends core_1.Command {
@@ -16,9 +15,7 @@ class MobileTestRun extends core_1.Command {
16
15
  let buildId = flags["build-id"];
17
16
  const buildPath = flags["build-path"];
18
17
  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 });
18
+ const client = (0, getMobileClient_1.getMobileClient)(configDir, userAgent);
22
19
  const { workspaceId, testPlanId } = (0, parseTestPlanUrl_1.parseTestPlanUrl)(args["test-plan-url"]);
23
20
  if (buildPath) {
24
21
  const uploadArgs = ["--workspace-id", workspaceId, buildPath];
@@ -1,22 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const autify_sdk_1 = require("@autifyhq/autify-sdk");
5
4
  const core_1 = require("@oclif/core");
6
5
  const node_emoji_1 = tslib_1.__importDefault(require("node-emoji"));
7
6
  const getWaitIntervalSecond_1 = require("../../../autify/getWaitIntervalSecond");
7
+ const getMobileClient_1 = require("../../../autify/mobile/getMobileClient");
8
8
  const getTestResultUrl_1 = require("../../../autify/mobile/getTestResultUrl");
9
9
  const parseTestResultUrl_1 = require("../../../autify/mobile/parseTestResultUrl");
10
10
  const waitTestResult_1 = require("../../../autify/mobile/waitTestResult");
11
- const config_1 = require("../../../config");
12
11
  class MobileTestWait extends core_1.Command {
13
12
  async run() {
14
13
  const { args, flags } = await this.parse(MobileTestWait);
15
14
  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
15
  const waitIntervalSecond = (0, getWaitIntervalSecond_1.getWaitIntervalSecond)(configDir);
19
- const client = new autify_sdk_1.MobileClient(accessToken, { basePath, userAgent });
16
+ const client = (0, getMobileClient_1.getMobileClient)(configDir, userAgent);
20
17
  const { workspaceId, resultId } = (0, parseTestResultUrl_1.parseTestResultUrl)(args["test-result-url"]);
21
18
  const testResultUrl = (0, getTestResultUrl_1.getMobileTestResultUrl)(configDir, workspaceId, resultId);
22
19
  this.log(`${node_emoji_1.default.get("clock1")} Waiting for the test result: ${testResultUrl}`);
@@ -0,0 +1,10 @@
1
+ import { Command } from "@oclif/core";
2
+ export default class WebApiCreateAccessPoint extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ "project-id": import("@oclif/core/lib/interfaces").OptionFlag<number>;
7
+ "create-access-point-request": 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 getWebClient_1 = require("../../../autify/web/getWebClient");
5
+ class WebApiCreateAccessPoint extends core_1.Command {
6
+ async run() {
7
+ const { flags } = await this.parse(WebApiCreateAccessPoint);
8
+ const { configDir, userAgent } = this.config;
9
+ const client = (0, getWebClient_1.getWebClient)(configDir, userAgent);
10
+ const res = await client.createAccessPoint(flags["project-id"], JSON.parse(flags["create-access-point-request"]));
11
+ console.log(JSON.stringify(res.data, null, 2));
12
+ }
13
+ }
14
+ exports.default = WebApiCreateAccessPoint;
15
+ WebApiCreateAccessPoint.description = "You can generate a new access point by passing in its name.";
16
+ WebApiCreateAccessPoint.examples = ["<%= config.bin %> <%= command.id %>"];
17
+ WebApiCreateAccessPoint.flags = {
18
+ "project-id": core_1.Flags.integer({
19
+ description: "For example, 1 for the following URL: https://app.autify.com/projects/1/scenarios",
20
+ required: true,
21
+ }),
22
+ "create-access-point-request": core_1.Flags.string({
23
+ description: "The name of the access point to be created",
24
+ required: true,
25
+ }),
26
+ };
@@ -1,15 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
- const autify_sdk_1 = require("@autifyhq/autify-sdk");
5
- const config_1 = require("../../../config");
4
+ const getWebClient_1 = require("../../../autify/web/getWebClient");
6
5
  class WebApiCreateUrlReplacement extends core_1.Command {
7
6
  async run() {
8
7
  const { flags } = await this.parse(WebApiCreateUrlReplacement);
9
8
  const { configDir, userAgent } = this.config;
10
- const accessToken = (0, config_1.getOrThrow)(configDir, "AUTIFY_WEB_ACCESS_TOKEN");
11
- const basePath = (0, config_1.get)(configDir, "AUTIFY_WEB_BASE_PATH");
12
- const client = new autify_sdk_1.WebClient(accessToken, { basePath, userAgent });
9
+ const client = (0, getWebClient_1.getWebClient)(configDir, userAgent);
13
10
  const res = await client.createUrlReplacement(flags["test-plan-id"], JSON.parse(flags["create-url-replacement-request"]));
14
11
  console.log(JSON.stringify(res.data, null, 2));
15
12
  }