@autifyhq/autify-cli 0.10.0 → 0.11.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.
- package/README.md +39 -32
- package/dist/autify/connect/client-manager/AccessPoint.d.ts +16 -0
- package/dist/autify/connect/client-manager/AccessPoint.js +26 -0
- package/dist/autify/connect/client-manager/ClientManager.d.ts +57 -0
- package/dist/autify/connect/client-manager/ClientManager.js +245 -0
- package/dist/autify/connect/client-manager/DebugServerClient.d.ts +16 -0
- package/dist/autify/connect/client-manager/DebugServerClient.js +55 -0
- package/dist/autify/connect/client-manager/Logger.d.ts +11 -0
- package/dist/autify/connect/client-manager/Logger.js +43 -0
- package/dist/autify/connect/client-manager/StateMachine.d.ts +54 -0
- package/dist/autify/connect/client-manager/StateMachine.js +149 -0
- package/dist/autify/connect/installClient.d.ts +1 -1
- package/dist/autify/connect/installClient.js +4 -3
- package/dist/commands/connect/access-point/create.js +2 -2
- package/dist/commands/connect/access-point/set.js +1 -1
- package/dist/commands/connect/client/install.js +1 -1
- package/dist/commands/connect/client/start.js +26 -48
- package/dist/commands/web/test/run.js +39 -37
- package/oclif.manifest.json +1 -1
- package/package.json +11 -7
- package/dist/autify/connect/spawnClient.d.ts +0 -28
- package/dist/autify/connect/spawnClient.js +0 -192
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Interpreter } from "xstate";
|
|
2
|
+
import { ProcessExit } from "./ClientManager";
|
|
3
|
+
declare type ClientStateMachineContext = {
|
|
4
|
+
spawn: (debugServerPort: number) => void;
|
|
5
|
+
terminate: () => Promise<void>;
|
|
6
|
+
kill: () => void;
|
|
7
|
+
cleanup: () => Promise<void>;
|
|
8
|
+
processExit?: ProcessExit;
|
|
9
|
+
errors: Error[];
|
|
10
|
+
};
|
|
11
|
+
declare type ClientStateMachineEvent = {
|
|
12
|
+
type: "SPAWN";
|
|
13
|
+
debugServerPort: number;
|
|
14
|
+
} | {
|
|
15
|
+
type: "READY";
|
|
16
|
+
} | {
|
|
17
|
+
type: "TERMINATE";
|
|
18
|
+
} | {
|
|
19
|
+
type: "FAIL";
|
|
20
|
+
error: Error;
|
|
21
|
+
} | {
|
|
22
|
+
type: "EXIT";
|
|
23
|
+
processExit: ProcessExit;
|
|
24
|
+
};
|
|
25
|
+
declare type ClientStateMachineState = {
|
|
26
|
+
value: "init";
|
|
27
|
+
context: ClientStateMachineContext;
|
|
28
|
+
} | {
|
|
29
|
+
value: "starting";
|
|
30
|
+
context: ClientStateMachineContext;
|
|
31
|
+
} | {
|
|
32
|
+
value: "ready";
|
|
33
|
+
context: ClientStateMachineContext;
|
|
34
|
+
} | {
|
|
35
|
+
value: "terminating";
|
|
36
|
+
context: ClientStateMachineContext;
|
|
37
|
+
} | {
|
|
38
|
+
value: "killing";
|
|
39
|
+
context: ClientStateMachineContext;
|
|
40
|
+
} | {
|
|
41
|
+
value: "timeout";
|
|
42
|
+
context: ClientStateMachineContext;
|
|
43
|
+
} | {
|
|
44
|
+
value: "cleanup";
|
|
45
|
+
context: ClientStateMachineContext;
|
|
46
|
+
} | {
|
|
47
|
+
value: "done";
|
|
48
|
+
context: ClientStateMachineContext & {
|
|
49
|
+
processExit: ProcessExit;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export declare type ClientStateMachineService = Interpreter<ClientStateMachineContext, any, ClientStateMachineEvent, ClientStateMachineState, any>;
|
|
53
|
+
export declare const createService: (context: ClientStateMachineContext) => ClientStateMachineService;
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createService = void 0;
|
|
4
|
+
/* eslint-disable unicorn/filename-case */
|
|
5
|
+
const xstate_1 = require("xstate");
|
|
6
|
+
const ClientManager_1 = require("./ClientManager");
|
|
7
|
+
const createService = (context) => {
|
|
8
|
+
const machine = (0, xstate_1.createMachine)({
|
|
9
|
+
predictableActionArguments: true,
|
|
10
|
+
schema: {
|
|
11
|
+
context: {},
|
|
12
|
+
},
|
|
13
|
+
context,
|
|
14
|
+
initial: "init",
|
|
15
|
+
states: {
|
|
16
|
+
init: {
|
|
17
|
+
on: {
|
|
18
|
+
SPAWN: { target: "starting" },
|
|
19
|
+
FAIL: {
|
|
20
|
+
target: "cleanup",
|
|
21
|
+
actions: (0, xstate_1.assign)({
|
|
22
|
+
errors: (context, event) => {
|
|
23
|
+
context.errors.push(event.error);
|
|
24
|
+
return context.errors;
|
|
25
|
+
},
|
|
26
|
+
}),
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
starting: {
|
|
31
|
+
entry: (context, event) => {
|
|
32
|
+
if (event.type !== "SPAWN")
|
|
33
|
+
return;
|
|
34
|
+
context.spawn(event.debugServerPort);
|
|
35
|
+
},
|
|
36
|
+
on: {
|
|
37
|
+
READY: { target: "ready" },
|
|
38
|
+
TERMINATE: { target: "terminating" },
|
|
39
|
+
EXIT: {
|
|
40
|
+
target: "cleanup",
|
|
41
|
+
actions: (0, xstate_1.assign)({
|
|
42
|
+
processExit: (_, event) => event.processExit,
|
|
43
|
+
}),
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
after: {
|
|
47
|
+
3000: {
|
|
48
|
+
target: "terminating",
|
|
49
|
+
actions: (0, xstate_1.assign)({
|
|
50
|
+
errors: (context) => {
|
|
51
|
+
context.errors.push(new ClientManager_1.StateMachineTimeoutError("starting"));
|
|
52
|
+
return context.errors;
|
|
53
|
+
},
|
|
54
|
+
}),
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
ready: {
|
|
59
|
+
on: {
|
|
60
|
+
TERMINATE: { target: "terminating" },
|
|
61
|
+
EXIT: {
|
|
62
|
+
target: "cleanup",
|
|
63
|
+
actions: (0, xstate_1.assign)({
|
|
64
|
+
processExit: (_, event) => event.processExit,
|
|
65
|
+
}),
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
terminating: {
|
|
70
|
+
invoke: {
|
|
71
|
+
src: (context) => context.terminate(),
|
|
72
|
+
},
|
|
73
|
+
on: {
|
|
74
|
+
TERMINATE: { target: "killing" },
|
|
75
|
+
EXIT: {
|
|
76
|
+
target: "cleanup",
|
|
77
|
+
actions: (0, xstate_1.assign)({
|
|
78
|
+
processExit: (_, event) => event.processExit,
|
|
79
|
+
}),
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
after: {
|
|
83
|
+
3000: { target: "killing" },
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
killing: {
|
|
87
|
+
entry: (context) => context.kill(),
|
|
88
|
+
on: {
|
|
89
|
+
TERMINATE: { target: "cleanup" },
|
|
90
|
+
EXIT: {
|
|
91
|
+
target: "cleanup",
|
|
92
|
+
actions: (0, xstate_1.assign)({
|
|
93
|
+
processExit: (_, event) => event.processExit,
|
|
94
|
+
}),
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
after: {
|
|
98
|
+
2000: {
|
|
99
|
+
target: "failed",
|
|
100
|
+
actions: (0, xstate_1.assign)({
|
|
101
|
+
errors: (context) => {
|
|
102
|
+
context.errors.push(new ClientManager_1.StateMachineTimeoutError("killing"));
|
|
103
|
+
return context.errors;
|
|
104
|
+
},
|
|
105
|
+
}),
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
cleanup: {
|
|
110
|
+
invoke: {
|
|
111
|
+
src: (context) => context.cleanup(),
|
|
112
|
+
onDone: [
|
|
113
|
+
{ target: "failed", cond: (context) => context.errors.length > 0 },
|
|
114
|
+
{ target: "done" },
|
|
115
|
+
],
|
|
116
|
+
onError: {
|
|
117
|
+
target: "failed",
|
|
118
|
+
actions: (0, xstate_1.assign)({
|
|
119
|
+
errors: (context, event) => {
|
|
120
|
+
context.errors.push(event.data);
|
|
121
|
+
return context.errors;
|
|
122
|
+
},
|
|
123
|
+
}),
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
after: {
|
|
127
|
+
2000: {
|
|
128
|
+
target: "failed",
|
|
129
|
+
actions: (0, xstate_1.assign)({
|
|
130
|
+
errors: (context) => {
|
|
131
|
+
context.errors.push(new ClientManager_1.StateMachineTimeoutError("cleanup"));
|
|
132
|
+
return context.errors;
|
|
133
|
+
},
|
|
134
|
+
}),
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
done: {
|
|
139
|
+
type: "final",
|
|
140
|
+
},
|
|
141
|
+
failed: {
|
|
142
|
+
type: "final",
|
|
143
|
+
entry: (context) => context.kill(),
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
return (0, xstate_1.interpret)(machine).start();
|
|
148
|
+
};
|
|
149
|
+
exports.createService = createService;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CLIError } from "@oclif/errors";
|
|
2
|
-
export declare const AUTIFY_CONNECT_CLIENT_SUPPORTED_VERSION = "v0.6.
|
|
2
|
+
export declare const AUTIFY_CONNECT_CLIENT_SUPPORTED_VERSION = "v0.6.3";
|
|
3
3
|
export declare type ClientMode = "fake" | "real";
|
|
4
4
|
export declare class ConnectClientVersionMismatchError extends CLIError {
|
|
5
5
|
readonly expected: string;
|
|
@@ -12,9 +12,10 @@ const node_util_1 = require("node:util");
|
|
|
12
12
|
const node_path_1 = require("node:path");
|
|
13
13
|
const unzip_stream_1 = require("unzip-stream");
|
|
14
14
|
const node_child_process_1 = require("node:child_process");
|
|
15
|
+
const tar_1 = tslib_1.__importDefault(require("tar"));
|
|
15
16
|
const config_1 = require("../../config");
|
|
16
17
|
// Update whenever to bump supported version.
|
|
17
|
-
exports.AUTIFY_CONNECT_CLIENT_SUPPORTED_VERSION = "v0.6.
|
|
18
|
+
exports.AUTIFY_CONNECT_CLIENT_SUPPORTED_VERSION = "v0.6.3";
|
|
18
19
|
const getMode = (configDir) => {
|
|
19
20
|
const mode = (0, config_1.get)(configDir, "AUTIFY_CONNECT_CLIENT_MODE");
|
|
20
21
|
if (!mode)
|
|
@@ -70,8 +71,8 @@ const extract = async (downloadPath) => {
|
|
|
70
71
|
? "autifyconnect-fake"
|
|
71
72
|
: "autifyconnect";
|
|
72
73
|
if (file.endsWith(".tar.gz")) {
|
|
73
|
-
|
|
74
|
-
await (0,
|
|
74
|
+
const streamPipeline = (0, node_util_1.promisify)(node_stream_1.pipeline);
|
|
75
|
+
await streamPipeline((0, node_fs_1.createReadStream)(downloadPath), tar_1.default.x({ cwd: dir }));
|
|
75
76
|
return (0, node_path_1.join)(dir, binaryName);
|
|
76
77
|
}
|
|
77
78
|
if (file.endsWith(".zip")) {
|
|
@@ -24,7 +24,7 @@ class ConnectAccessPointCreate extends core_1.Command {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
exports.default = ConnectAccessPointCreate;
|
|
27
|
-
ConnectAccessPointCreate.description = "
|
|
27
|
+
ConnectAccessPointCreate.description = "Create an Autify Connect Access Point";
|
|
28
28
|
ConnectAccessPointCreate.examples = [
|
|
29
29
|
"<%= config.bin %> <%= command.id %> --name NAME --web-workspace-id ID",
|
|
30
30
|
];
|
|
@@ -34,7 +34,7 @@ ConnectAccessPointCreate.flags = {
|
|
|
34
34
|
required: true,
|
|
35
35
|
}),
|
|
36
36
|
"web-workspace-id": core_1.Flags.integer({
|
|
37
|
-
description: "Workspace ID of Autify for Web to which the Access Point belong",
|
|
37
|
+
description: "Workspace ID of Autify for Web to which the Access Point will belong",
|
|
38
38
|
exactlyOne: ["web-workspace-id"],
|
|
39
39
|
}),
|
|
40
40
|
};
|
|
@@ -26,7 +26,7 @@ class ConnectAccessPointSet extends core_1.Command {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
exports.default = ConnectAccessPointSet;
|
|
29
|
-
ConnectAccessPointSet.description = "
|
|
29
|
+
ConnectAccessPointSet.description = "Set Autify Connect Access Point";
|
|
30
30
|
ConnectAccessPointSet.examples = [
|
|
31
31
|
"Start interactive setup:\n<%= config.bin %> <%= command.id %> --name=NAME",
|
|
32
32
|
"Reading the key from file:\n<%= config.bin %> <%= command.id %> --name=NAME < key.txt",
|
|
@@ -13,7 +13,7 @@ class ConnectClientInstall extends core_1.Command {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
exports.default = ConnectClientInstall;
|
|
16
|
-
ConnectClientInstall.description = "
|
|
16
|
+
ConnectClientInstall.description = "Install Autify Connect Client";
|
|
17
17
|
ConnectClientInstall.examples = [
|
|
18
18
|
"(Recommended) Install the supported version:\n<%= config.bin %> <%= command.id %>",
|
|
19
19
|
"Install a specific version:\n<%= config.bin %> <%= command.id %> v0.6.1",
|
|
@@ -1,61 +1,39 @@
|
|
|
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
|
-
const
|
|
6
|
-
const config_1 = require("../../../config");
|
|
7
|
-
const createEphemeralAccessPointIfNeeded = (configDir, userAgent, workspaceId) => {
|
|
8
|
-
if (!workspaceId)
|
|
9
|
-
return;
|
|
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 webClient = new autify_sdk_1.WebClient(accessToken, { basePath, userAgent });
|
|
13
|
-
return {
|
|
14
|
-
webClient,
|
|
15
|
-
workspaceId,
|
|
16
|
-
};
|
|
17
|
-
};
|
|
4
|
+
const ClientManager_1 = require("../../../autify/connect/client-manager/ClientManager");
|
|
18
5
|
class ConnectClientStart extends core_1.Command {
|
|
19
6
|
async run() {
|
|
7
|
+
var _a;
|
|
20
8
|
const { flags } = await this.parse(ConnectClientStart);
|
|
21
9
|
const { configDir, cacheDir, userAgent } = this.config;
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
fileLogging,
|
|
31
|
-
debugServerPort,
|
|
32
|
-
ephemeralAccessPoint,
|
|
10
|
+
const clientManager = await ClientManager_1.ClientManager.create({
|
|
11
|
+
configDir,
|
|
12
|
+
cacheDir,
|
|
13
|
+
userAgent,
|
|
14
|
+
verbose: flags.verbose,
|
|
15
|
+
fileLogging: flags["file-logging"],
|
|
16
|
+
debugServerPort: flags["debug-server-port"],
|
|
17
|
+
webWorkspaceId: flags["web-workspace-id"],
|
|
33
18
|
});
|
|
34
|
-
this.log(
|
|
35
|
-
|
|
36
|
-
this.warn(versionMismatchWarning);
|
|
37
|
-
if (logFile)
|
|
38
|
-
this.log(`Log file is located at ${logFile}`);
|
|
19
|
+
this.log("Starting Autify Connect Client...");
|
|
20
|
+
await clientManager.start();
|
|
39
21
|
this.log("Waiting until Autify Connect Client is ready...");
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
finally {
|
|
48
|
-
const [code, signal, deletedAccessPointName] = await waitExit();
|
|
49
|
-
if (deletedAccessPointName)
|
|
50
|
-
this.log(`Autify Connect Access Point was deleted: "${deletedAccessPointName}"`);
|
|
51
|
-
this.log(`Autify Connect Client exited (code: ${code}, signal: ${signal})`);
|
|
52
|
-
this.exit(code !== null && code !== void 0 ? code : 1);
|
|
53
|
-
}
|
|
22
|
+
await clientManager.onceReady();
|
|
23
|
+
this.log("Waiting for terminating (forever)...");
|
|
24
|
+
await clientManager.onceTerminating();
|
|
25
|
+
this.log("Waiting until Autify Connect Client exits...");
|
|
26
|
+
const exitCode = (_a = (await clientManager.onceDone())) !== null && _a !== void 0 ? _a : 1;
|
|
27
|
+
this.log(`Exiting this command with the same exit code(${exitCode})...`);
|
|
28
|
+
this.exit(exitCode);
|
|
54
29
|
}
|
|
55
30
|
}
|
|
56
31
|
exports.default = ConnectClientStart;
|
|
57
|
-
ConnectClientStart.description = "
|
|
58
|
-
ConnectClientStart.examples = [
|
|
32
|
+
ConnectClientStart.description = "Start Autify Connect Client";
|
|
33
|
+
ConnectClientStart.examples = [
|
|
34
|
+
"With pre-created Access Point:\n<%= config.bin %> <%= command.id %>",
|
|
35
|
+
"With ephemeral Access Point of Autify for Web:\n<%= config.bin %> <%= command.id %> --web-workspace-id 000",
|
|
36
|
+
];
|
|
59
37
|
ConnectClientStart.flags = {
|
|
60
38
|
verbose: core_1.Flags.boolean({
|
|
61
39
|
description: "Make the operation more talkative.",
|
|
@@ -66,9 +44,9 @@ ConnectClientStart.flags = {
|
|
|
66
44
|
default: false,
|
|
67
45
|
}),
|
|
68
46
|
"debug-server-port": core_1.Flags.integer({
|
|
69
|
-
description: `
|
|
47
|
+
description: `The server for debugging and monitoring launches on your local machine on the given port. It will use a radom port if not specified.`,
|
|
70
48
|
}),
|
|
71
49
|
"web-workspace-id": core_1.Flags.integer({
|
|
72
|
-
description: "Workspace ID of Autify for Web to create an ephemeral Access Point. If not specified, it will use the one configured by `autify connect access-point set`, instead.",
|
|
50
|
+
description: "Workspace ID of Autify for Web to create an ephemeral Access Point. If not specified, it will use the one configured by `autify connect access-point create/set`, instead.",
|
|
73
51
|
}),
|
|
74
52
|
};
|
|
@@ -8,9 +8,9 @@ const config_1 = require("../../../config");
|
|
|
8
8
|
const runTest_1 = require("../../../autify/web/runTest");
|
|
9
9
|
const getTestResultUrl_1 = require("../../../autify/web/getTestResultUrl");
|
|
10
10
|
const wait_1 = tslib_1.__importDefault(require("./wait"));
|
|
11
|
-
const spawnClient_1 = require("../../../autify/connect/spawnClient");
|
|
12
11
|
const errors_1 = require("@oclif/errors");
|
|
13
12
|
const parseAutifyTestUrl_1 = require("../../../autify/web/parseAutifyTestUrl");
|
|
13
|
+
const ClientManager_1 = require("../../../autify/connect/client-manager/ClientManager");
|
|
14
14
|
const parseUrlReplacements = (urlReplacements) => {
|
|
15
15
|
return urlReplacements.map((s) => {
|
|
16
16
|
// eslint-disable-next-line camelcase
|
|
@@ -51,7 +51,7 @@ class WebTestRun extends core_1.Command {
|
|
|
51
51
|
const parsedTest = (0, parseAutifyTestUrl_1.parseAutifyTestUrl)(args["scenario-or-test-plan-url"]);
|
|
52
52
|
const { workspaceId } = parsedTest;
|
|
53
53
|
let autifyConnectAccessPoint = flags["autify-connect"];
|
|
54
|
-
let
|
|
54
|
+
let autifyConnectClientManager;
|
|
55
55
|
const runTestOnce = async () => {
|
|
56
56
|
const { resultId, capability } = await (0, runTest_1.runTest)(client, parsedTest, {
|
|
57
57
|
option: capabilityOption,
|
|
@@ -65,28 +65,20 @@ class WebTestRun extends core_1.Command {
|
|
|
65
65
|
};
|
|
66
66
|
try {
|
|
67
67
|
if (flags["autify-connect-client"]) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
autifyConnectClient = await (0, spawnClient_1.spawnClient)(configDir, cacheDir, errorHandler, {
|
|
68
|
+
autifyConnectClientManager = await ClientManager_1.ClientManager.create({
|
|
69
|
+
configDir,
|
|
70
|
+
cacheDir,
|
|
71
|
+
userAgent,
|
|
73
72
|
verbose: flags["autify-connect-client-verbose"],
|
|
74
73
|
fileLogging: flags["autify-connect-client-file-logging"],
|
|
75
74
|
debugServerPort: flags["autify-connect-client-debug-server-port"],
|
|
76
|
-
|
|
77
|
-
webClient: client,
|
|
78
|
-
workspaceId,
|
|
79
|
-
},
|
|
75
|
+
webWorkspaceId: workspaceId,
|
|
80
76
|
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (versionMismatchWarning)
|
|
85
|
-
this.warn(versionMismatchWarning);
|
|
86
|
-
if (logFile)
|
|
87
|
-
this.log(`Autify Connect Client log file is located at ${logFile}`);
|
|
77
|
+
autifyConnectAccessPoint = autifyConnectClientManager.accessPointName;
|
|
78
|
+
this.log("Starting Autify Connect Client...");
|
|
79
|
+
await autifyConnectClientManager.start();
|
|
88
80
|
this.log("Waiting until Autify Connect Client is ready...");
|
|
89
|
-
await
|
|
81
|
+
await autifyConnectClientManager.onceReady();
|
|
90
82
|
this.log("Autify Connect Client is ready!");
|
|
91
83
|
}
|
|
92
84
|
let testResultUrl = await runTestOnce();
|
|
@@ -127,13 +119,12 @@ class WebTestRun extends core_1.Command {
|
|
|
127
119
|
}
|
|
128
120
|
}
|
|
129
121
|
catch (error) {
|
|
130
|
-
if (
|
|
122
|
+
if (autifyConnectClientManager) {
|
|
131
123
|
this.log("Waiting until Autify Connect Client exits...");
|
|
132
|
-
await
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
this.log(`Autify Connect Client exited (code: ${code}, signal: ${signal})`);
|
|
124
|
+
await autifyConnectClientManager.exit({
|
|
125
|
+
ignoreError: true,
|
|
126
|
+
});
|
|
127
|
+
this.log("Autify Connect Client exited.");
|
|
137
128
|
}
|
|
138
129
|
throw error;
|
|
139
130
|
}
|
|
@@ -149,11 +140,12 @@ WebTestRun.examples = [
|
|
|
149
140
|
"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",
|
|
150
141
|
'Run a test with specifying the execution name:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 --name "Sample execution"',
|
|
151
142
|
"Run a test scenario with Autify Connect:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 --autify-connect NAME",
|
|
143
|
+
"Run a test scenario with Autify Connect Client:\n<%= config.bin %> <%= command.id %> https://app.autify.com/projects/0000/scenarios/0000 --wait --autify-connect-client",
|
|
152
144
|
];
|
|
153
145
|
WebTestRun.flags = {
|
|
154
146
|
name: core_1.Flags.string({
|
|
155
147
|
char: "n",
|
|
156
|
-
description: "
|
|
148
|
+
description: "[Only for test scenario] Name of the test execution.",
|
|
157
149
|
}),
|
|
158
150
|
"url-replacements": core_1.Flags.string({
|
|
159
151
|
char: "r",
|
|
@@ -161,31 +153,41 @@ WebTestRun.flags = {
|
|
|
161
153
|
multiple: true,
|
|
162
154
|
}),
|
|
163
155
|
"autify-connect": core_1.Flags.string({
|
|
164
|
-
description: "Name of the Autify Connect Access Point
|
|
156
|
+
description: "[Only for test scenario] Name of the Autify Connect Access Point.",
|
|
165
157
|
exclusive: ["autify-connect-client"],
|
|
166
158
|
}),
|
|
167
159
|
"autify-connect-client": core_1.Flags.boolean({
|
|
168
|
-
description: "[
|
|
160
|
+
description: "[Only for test scenario] Start Autify Connect Client",
|
|
169
161
|
exclusive: ["autify-connect"],
|
|
170
162
|
dependsOn: ["wait"],
|
|
171
163
|
}),
|
|
172
164
|
"autify-connect-client-verbose": core_1.Flags.boolean({
|
|
173
|
-
description: "[
|
|
165
|
+
description: "[Only for test scenario] Verbose output for Autify Connect Client.",
|
|
174
166
|
dependsOn: ["autify-connect-client"],
|
|
175
167
|
}),
|
|
176
168
|
"autify-connect-client-file-logging": core_1.Flags.boolean({
|
|
177
|
-
description: "[
|
|
169
|
+
description: "[Only for test scenario] Logging Autify Connect Client log to a file instead of console.",
|
|
178
170
|
dependsOn: ["autify-connect-client"],
|
|
179
171
|
}),
|
|
180
172
|
"autify-connect-client-debug-server-port": core_1.Flags.integer({
|
|
181
|
-
description:
|
|
173
|
+
description: "[Only for test scenario] Port for Autify Connect Client debug server. A random port will be used if not specified.",
|
|
182
174
|
dependsOn: ["autify-connect-client"],
|
|
183
175
|
}),
|
|
184
|
-
os: core_1.Flags.string({
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
176
|
+
os: core_1.Flags.string({
|
|
177
|
+
description: "[Only for test scenario] OS to run the test",
|
|
178
|
+
}),
|
|
179
|
+
"os-version": core_1.Flags.string({
|
|
180
|
+
description: "[Only for test scenario] OS version to run the test",
|
|
181
|
+
}),
|
|
182
|
+
browser: core_1.Flags.string({
|
|
183
|
+
description: "[Only for test scenario] Browser to run the test",
|
|
184
|
+
}),
|
|
185
|
+
device: core_1.Flags.string({
|
|
186
|
+
description: "[Only for test scenario] Device to run the test",
|
|
187
|
+
}),
|
|
188
|
+
"device-type": core_1.Flags.string({
|
|
189
|
+
description: "[Only for test scenario] Device type to run the test",
|
|
190
|
+
}),
|
|
189
191
|
wait: core_1.Flags.boolean({
|
|
190
192
|
char: "w",
|
|
191
193
|
description: "Wait until the test finishes.",
|
|
@@ -202,7 +204,7 @@ WebTestRun.flags = {
|
|
|
202
204
|
default: false,
|
|
203
205
|
}),
|
|
204
206
|
"max-retry-count": core_1.Flags.integer({
|
|
205
|
-
description: "Maximum retry count. The command can take up to timeout * (max-retry-count + 1)
|
|
207
|
+
description: "Maximum retry count while waiting. The command can take up to `timeout * (max-retry-count + 1)`. Only effective with `--wait`.",
|
|
206
208
|
default: 0,
|
|
207
209
|
}),
|
|
208
210
|
};
|