@mablhq/mabl-cli 1.21.7 → 1.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/mablApiClient.js +72 -53
- package/api/mablApiClientFactory.js +3 -3
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +1 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +77 -39
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +4 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +1 -1
- package/cli.js +2 -0
- package/commands/config/config_cmds/configKeys.js +12 -1
- package/commands/config/config_cmds/set.js +6 -0
- package/commands/constants.js +3 -2
- package/commands/flows/flows_cmds/export.js +1 -1
- package/commands/internal/internal.js +6 -0
- package/commands/link-agents/link-agents_cmds/list.js +131 -0
- package/commands/link-agents/link-agents_cmds/terminate.js +31 -0
- package/commands/tests/testsUtil.js +18 -2
- package/commands/tests/tests_cmds/export.js +1 -1
- package/core/messaging/messaging.js +11 -1
- package/domUtil/index.js +1 -1
- package/domUtil/index.js.LICENSE.txt +2 -2
- package/env/defaultEnv.js +2 -1
- package/env/dev.js +2 -1
- package/env/env.js +3 -1
- package/env/local.js +2 -1
- package/env/prod.js +2 -1
- package/execution/index.js +1 -1
- package/execution/index.js.LICENSE.txt +2 -2
- package/mablscript/steps/SyntheticStep.js +20 -0
- package/mablscriptFind/index.js +1 -1
- package/mablscriptFind/index.js.LICENSE.txt +2 -2
- package/package.json +1 -1
- package/providers/authenticationProvider.js +1 -1
- package/providers/cliConfigProvider.js +20 -8
- package/resources/mablFind.js +1 -1
- package/util/httpUtil.js +3 -2
|
@@ -131,40 +131,56 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
|
|
|
131
131
|
async boundingBox() {
|
|
132
132
|
return (0, utils_1.mapIfNotNull)(await this.element.boundingBox(), (boundingBox) => boundingBox);
|
|
133
133
|
}
|
|
134
|
-
async
|
|
135
|
-
|
|
136
|
-
const trial = (_a = options === null || options === void 0 ? void 0 : options.trial) !== null && _a !== void 0 ? _a : false;
|
|
134
|
+
async overwriteScrollIntoViewDuringAction(action) {
|
|
135
|
+
await this.overwriteScrollIntoViewFunction();
|
|
137
136
|
try {
|
|
138
|
-
await
|
|
139
|
-
clickCount: (_b = options === null || options === void 0 ? void 0 : options.clickCount) !== null && _b !== void 0 ? _b : 1,
|
|
140
|
-
force: (_c = options === null || options === void 0 ? void 0 : options.force) !== null && _c !== void 0 ? _c : !trial,
|
|
141
|
-
timeout: this.getActionTimeout(options),
|
|
142
|
-
trial,
|
|
143
|
-
});
|
|
137
|
+
return await action();
|
|
144
138
|
}
|
|
145
|
-
catch (
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
throw error;
|
|
139
|
+
catch (e) {
|
|
140
|
+
throw e;
|
|
141
|
+
}
|
|
142
|
+
finally {
|
|
143
|
+
await this.resetScrollIntoViewFunction();
|
|
151
144
|
}
|
|
152
145
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
146
|
+
click(options) {
|
|
147
|
+
return this.overwriteScrollIntoViewDuringAction(async () => {
|
|
148
|
+
var _a, _b, _c;
|
|
156
149
|
const trial = (_a = options === null || options === void 0 ? void 0 : options.trial) !== null && _a !== void 0 ? _a : false;
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if (error.message.includes(exports.NAVIGATION_ERROR_MESSAGE)) {
|
|
165
|
-
(0, logUtils_1.logInternal)(`Action timed out due to navigation timeout. ${error.toString()}`);
|
|
150
|
+
try {
|
|
151
|
+
await this.element.click({
|
|
152
|
+
clickCount: (_b = options === null || options === void 0 ? void 0 : options.clickCount) !== null && _b !== void 0 ? _b : 1,
|
|
153
|
+
force: (_c = options === null || options === void 0 ? void 0 : options.force) !== null && _c !== void 0 ? _c : !trial,
|
|
154
|
+
timeout: this.getActionTimeout(options),
|
|
155
|
+
trial,
|
|
156
|
+
});
|
|
166
157
|
}
|
|
167
|
-
|
|
158
|
+
catch (error) {
|
|
159
|
+
if (error.message.includes(exports.NAVIGATION_ERROR_MESSAGE)) {
|
|
160
|
+
(0, logUtils_1.logInternal)(`Action timed out due to navigation timeout. ${error.toString()}`);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
throw error;
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
async doubleClick(options) {
|
|
168
|
+
return this.overwriteScrollIntoViewDuringAction(async () => {
|
|
169
|
+
var _a, _b;
|
|
170
|
+
try {
|
|
171
|
+
const trial = (_a = options === null || options === void 0 ? void 0 : options.trial) !== null && _a !== void 0 ? _a : false;
|
|
172
|
+
return this.element.dblclick({
|
|
173
|
+
force: (_b = options === null || options === void 0 ? void 0 : options.force) !== null && _b !== void 0 ? _b : !trial,
|
|
174
|
+
timeout: this.getActionTimeout(options),
|
|
175
|
+
trial,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
if (error.message.includes(exports.NAVIGATION_ERROR_MESSAGE)) {
|
|
180
|
+
(0, logUtils_1.logInternal)(`Action timed out due to navigation timeout. ${error.toString()}`);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
});
|
|
168
184
|
}
|
|
169
185
|
async clickablePoint() {
|
|
170
186
|
var _a;
|
|
@@ -190,22 +206,24 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
|
|
|
190
206
|
scrollIntoViewIfNeeded() {
|
|
191
207
|
return this.element.scrollIntoViewIfNeeded();
|
|
192
208
|
}
|
|
193
|
-
select(value) {
|
|
194
|
-
return this.element.selectOption(value);
|
|
209
|
+
async select(value) {
|
|
210
|
+
return this.overwriteScrollIntoViewDuringAction(async () => this.element.selectOption(value));
|
|
195
211
|
}
|
|
196
212
|
async type(text, options) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
213
|
+
return this.overwriteScrollIntoViewDuringAction(async () => {
|
|
214
|
+
var _a;
|
|
215
|
+
const selectText = (_a = options === null || options === void 0 ? void 0 : options.selectText) !== null && _a !== void 0 ? _a : true;
|
|
216
|
+
if (selectText) {
|
|
217
|
+
await this.element.selectText({ force: true });
|
|
218
|
+
}
|
|
219
|
+
await this.element.type(text, {
|
|
220
|
+
delay: options === null || options === void 0 ? void 0 : options.delay,
|
|
221
|
+
timeout: 0,
|
|
222
|
+
});
|
|
205
223
|
});
|
|
206
224
|
}
|
|
207
225
|
press(key) {
|
|
208
|
-
return this.element.press(key);
|
|
226
|
+
return this.overwriteScrollIntoViewDuringAction(async () => this.element.press(key));
|
|
209
227
|
}
|
|
210
228
|
getRemoteObjectId() {
|
|
211
229
|
var _a, _b, _c;
|
|
@@ -283,5 +301,25 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
|
|
|
283
301
|
: types_1.DefaultTimeouts.defaultActionTimeoutMs;
|
|
284
302
|
return (_a = options === null || options === void 0 ? void 0 : options.timeout) !== null && _a !== void 0 ? _a : defaultTimeout;
|
|
285
303
|
}
|
|
304
|
+
async overwriteScrollIntoViewFunction() {
|
|
305
|
+
var _a;
|
|
306
|
+
await ((_a = this.elementImpl) === null || _a === void 0 ? void 0 : _a.evaluateInUtility(([, node]) => {
|
|
307
|
+
const element = node;
|
|
308
|
+
if (!element.__mablOriginalScrollIntoView) {
|
|
309
|
+
element.__mablOriginalScrollIntoView = element.scrollIntoView;
|
|
310
|
+
}
|
|
311
|
+
element.scrollIntoView = () => element.scrollIntoViewIfNeeded();
|
|
312
|
+
}, []));
|
|
313
|
+
}
|
|
314
|
+
async resetScrollIntoViewFunction() {
|
|
315
|
+
var _a;
|
|
316
|
+
await ((_a = this.elementImpl) === null || _a === void 0 ? void 0 : _a.evaluateInUtility(([, node]) => {
|
|
317
|
+
const element = node;
|
|
318
|
+
const originalFunction = element.__mablOriginalScrollIntoView;
|
|
319
|
+
if (originalFunction) {
|
|
320
|
+
element.scrollIntoView = originalFunction;
|
|
321
|
+
}
|
|
322
|
+
}, []));
|
|
323
|
+
}
|
|
286
324
|
}
|
|
287
325
|
exports.PlaywrightElementHandle = PlaywrightElementHandle;
|
|
@@ -196,5 +196,9 @@ class PlaywrightFrame extends browserLauncher_1.Frame {
|
|
|
196
196
|
}
|
|
197
197
|
return true;
|
|
198
198
|
}
|
|
199
|
+
async getInjectedScriptInSecondaryWorld() {
|
|
200
|
+
const context = await this.getFrameImpl()._utilityContext();
|
|
201
|
+
return new playwrightDom_1.PlaywrightJsHandle(await context.injectedScript(), this.page());
|
|
202
|
+
}
|
|
199
203
|
}
|
|
200
204
|
exports.PlaywrightFrame = PlaywrightFrame;
|
|
@@ -211,7 +211,7 @@ class PlaywrightPage extends events_1.default {
|
|
|
211
211
|
return this.page.bringToFront();
|
|
212
212
|
}
|
|
213
213
|
cookies() {
|
|
214
|
-
return this.page.context().cookies();
|
|
214
|
+
return this.page.context().cookies(this.page.url());
|
|
215
215
|
}
|
|
216
216
|
async deleteCookie(...cookies) {
|
|
217
217
|
const finalCookies = (await this.cookies()).filter((cookie) => !cookies.find((c) => c.name === cookie.name && c.domain === cookie.domain));
|
package/cli.js
CHANGED
|
@@ -44,6 +44,7 @@ const UPDATE_CHECK_INTERVAL_MILLISECONDS = 24 * 60 * 60 * 1000;
|
|
|
44
44
|
const MIN_SUPPORTED_NODE_VERSION = (0, versionUtil_1.extractNodeVersionTuple)((_a = cliPackage === null || cliPackage === void 0 ? void 0 : cliPackage.engines) === null || _a === void 0 ? void 0 : _a.node);
|
|
45
45
|
require('v8-compile-cache');
|
|
46
46
|
require('yargonaut').style('cyan').helpStyle('magenta').errorsStyle('red');
|
|
47
|
+
const excludeInternal = env_1.ENV === 'prod' ? { exclude: /.*/gm } : undefined;
|
|
47
48
|
yargs
|
|
48
49
|
.scriptName(env_1.SCRIPT_NAME)
|
|
49
50
|
.commandDir('./commands/applications')
|
|
@@ -54,6 +55,7 @@ yargs
|
|
|
54
55
|
.commandDir('./commands/deploy')
|
|
55
56
|
.commandDir('./commands/environments')
|
|
56
57
|
.commandDir('./commands/flows')
|
|
58
|
+
.commandDir('./commands/internal', excludeInternal)
|
|
57
59
|
.commandDir('./commands/link-agents')
|
|
58
60
|
.commandDir('./commands/plans')
|
|
59
61
|
.commandDir('./commands/tests')
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validConfigKeyChoices = exports.configKeys = void 0;
|
|
3
|
+
exports.isValidProxyMode = exports.proxyModes = exports.validConfigKeyChoices = exports.configKeys = void 0;
|
|
4
4
|
exports.configKeys = Object.freeze({
|
|
5
5
|
browserPath: 'browser.path',
|
|
6
6
|
enableSourceControlMetadataCollection: 'alpha.scm_metadata.enable',
|
|
7
7
|
defaultWorkspaceId: 'workspace',
|
|
8
8
|
proxy: 'http.proxy',
|
|
9
9
|
sslVerify: 'http.sslVerify',
|
|
10
|
+
proxyMode: 'http.proxyMode',
|
|
10
11
|
});
|
|
11
12
|
exports.validConfigKeyChoices = Object.values(exports.configKeys);
|
|
13
|
+
exports.proxyModes = [
|
|
14
|
+
'mabl',
|
|
15
|
+
'test',
|
|
16
|
+
'all',
|
|
17
|
+
'none',
|
|
18
|
+
];
|
|
19
|
+
function isValidProxyMode(value) {
|
|
20
|
+
return exports.proxyModes.indexOf(value) !== -1;
|
|
21
|
+
}
|
|
22
|
+
exports.isValidProxyMode = isValidProxyMode;
|
|
@@ -49,6 +49,12 @@ async function setConfig(parsed) {
|
|
|
49
49
|
}
|
|
50
50
|
await cliConfigProvider_1.CliConfigProvider.setConfigProperty(key, value);
|
|
51
51
|
break;
|
|
52
|
+
case configKeys_1.configKeys.proxyMode:
|
|
53
|
+
if (!(0, configKeys_1.isValidProxyMode)(value)) {
|
|
54
|
+
throw new Error(`Invalid proxy mode. The value must be one of ${JSON.stringify(configKeys_1.proxyModes)}`);
|
|
55
|
+
}
|
|
56
|
+
await cliConfigProvider_1.CliConfigProvider.setConfigProperty(key, value);
|
|
57
|
+
break;
|
|
52
58
|
default:
|
|
53
59
|
throw new Error(`<${exports.configKeyCommandArg}> value not one of supported types: ${JSON.stringify(configKeys_1.validConfigKeyChoices)}`);
|
|
54
60
|
}
|
package/commands/constants.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.BrowserTypeSelections = exports.DefaultBrowserType = exports.DefaultBranchName = exports.DefaultOutputFormatChoices = exports.DetailLevelFormats = exports.ReporterOptions = exports.OutputFormats = exports.CommandArgAliases = exports.CommandArgBrowserEnableExtensions = exports.CommandArgBrowserIgnoreCertificateErrors = exports.CommandArgBrowserDisableIsolation = exports.ListTimeFormat = exports.CommandArgReporterOptions = exports.CommandArgReporter = exports.CommandArgWorkspaceId = exports.CommandArgVersion = exports.CommandArgVariables = void 0;
|
|
3
|
+
exports.CommandArgUrlApp = exports.CommandArgUrl = exports.CommandArgTrainerVersion = exports.CommandArgTo = exports.CommandArgSilent = exports.CommandArgRevision = exports.CommandArgMaxHeartbeatAge = exports.CommandArgPlanId = exports.CommandArgContentTypes = exports.CommandArgPreview = exports.CommandArgOutputFilePath = exports.CommandArgOutput = exports.CommandArgNoPrompt = exports.CommandArgPrompt = exports.CommandArgPortNumber = exports.CommandArgName = exports.CommandArgMablBranchChangesOnly = exports.CommandArgMablBranch = exports.CommandArgMablAutoLogin = exports.CommandArgMablAutoBranch = exports.CommandArgLinkBypass = exports.CommandArgLinkLabel = exports.CommandArgLimitOutput = exports.CommandArgLabels = exports.CommandArgLabelsInclude = exports.CommandArgLabelsExclude = exports.CommandArgTestInteractionSpeed = exports.CommandArgTestRunId = exports.CommandArgTestFile = exports.CommandArgId = exports.CommandArgUserAgent = exports.CommandArgHttpHeaders = exports.CommandArgHelp = exports.CommandArgFromPlanId = exports.CommandArgFrom = exports.CommandArgFormat = exports.CommandArgFastFailure = exports.CommandArgOverrideEnvironmentId = exports.CommandArgEnvironmentId = exports.CommandArgEnableLink = exports.CommandArgDetailLevel = exports.CommandArgDescription = exports.CommandArgDeploymentId = exports.CommandArgDecrypt = exports.CommandArgDataTables = exports.CommandArgCredentials = exports.CommandArgBasicAuthCredentials = exports.CommandArgBrowsers = exports.CommandArgApplicationId = exports.CommandArgApiKey = void 0;
|
|
4
|
+
exports.BrowserTypeSelections = exports.DefaultBrowserType = exports.DefaultBranchName = exports.DefaultOutputFormatChoices = exports.DetailLevelFormats = exports.ReporterOptions = exports.OutputFormats = exports.CommandArgAliases = exports.CommandArgBrowserEnableExtensions = exports.CommandArgBrowserIgnoreCertificateErrors = exports.CommandArgBrowserDisableIsolation = exports.ListTimeFormat = exports.CommandArgReporterOptions = exports.CommandArgReporter = exports.CommandArgWorkspaceId = exports.CommandArgVersion = exports.CommandArgVariables = exports.CommandArgUrlApi = void 0;
|
|
5
5
|
const browserTypes_1 = require("./browserTypes");
|
|
6
6
|
exports.CommandArgApiKey = 'api-key';
|
|
7
7
|
exports.CommandArgApplicationId = 'application-id';
|
|
@@ -46,6 +46,7 @@ exports.CommandArgOutputFilePath = 'file';
|
|
|
46
46
|
exports.CommandArgPreview = 'preview';
|
|
47
47
|
exports.CommandArgContentTypes = 'types';
|
|
48
48
|
exports.CommandArgPlanId = 'plan-id';
|
|
49
|
+
exports.CommandArgMaxHeartbeatAge = 'max-heartbeat-age';
|
|
49
50
|
exports.CommandArgRevision = 'revision';
|
|
50
51
|
exports.CommandArgSilent = 'silent';
|
|
51
52
|
exports.CommandArgTo = 'to';
|
|
@@ -40,7 +40,7 @@ async function pullFlow(parsed) {
|
|
|
40
40
|
const flowId = parsed.id;
|
|
41
41
|
const format = parsed.format;
|
|
42
42
|
const detailLevel = parsed[constants_1.CommandArgDetailLevel];
|
|
43
|
-
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.
|
|
43
|
+
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
44
44
|
const branchName = (_a = parsed['mabl-branch']) !== null && _a !== void 0 ? _a : constants_1.DefaultBranchName;
|
|
45
45
|
const flow = await apiClient.getFlow(flowId, branchName);
|
|
46
46
|
switch (format) {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = 'internal <command>';
|
|
4
|
+
exports.describe =
|
|
5
|
+
'Internal commands for mabl developers and employees only. Not available in production';
|
|
6
|
+
exports.builder = (yargs) => yargs.commandDir('internal_cmds').demandCommand();
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
7
|
+
const moment = require("moment");
|
|
8
|
+
const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
|
|
9
|
+
const util_1 = require("../../commandUtil/util");
|
|
10
|
+
const constants_1 = require("../../constants");
|
|
11
|
+
const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
|
|
12
|
+
const js_yaml_1 = require("js-yaml");
|
|
13
|
+
exports.command = 'list';
|
|
14
|
+
exports.describe = 'List link agents';
|
|
15
|
+
exports.builder = (yargs) => {
|
|
16
|
+
yargs
|
|
17
|
+
.option(constants_1.CommandArgWorkspaceId, {
|
|
18
|
+
alias: constants_1.CommandArgAliases.WorkspaceId,
|
|
19
|
+
describe: 'Workspace for which to list link agents',
|
|
20
|
+
nargs: 1,
|
|
21
|
+
type: 'string',
|
|
22
|
+
})
|
|
23
|
+
.option(constants_1.CommandArgOutput, {
|
|
24
|
+
alias: constants_1.CommandArgAliases.OutputType,
|
|
25
|
+
default: constants_1.OutputFormats.Table,
|
|
26
|
+
describe: 'Specify result output format',
|
|
27
|
+
nargs: 1,
|
|
28
|
+
choices: [...constants_1.DefaultOutputFormatChoices, constants_1.OutputFormats.Table],
|
|
29
|
+
})
|
|
30
|
+
.option(constants_1.CommandArgLimitOutput, {
|
|
31
|
+
alias: constants_1.CommandArgAliases.LimitOutput,
|
|
32
|
+
describe: 'The number of link agents to return',
|
|
33
|
+
default: 10,
|
|
34
|
+
nargs: 1,
|
|
35
|
+
type: 'number',
|
|
36
|
+
})
|
|
37
|
+
.option(constants_1.CommandArgMaxHeartbeatAge, {
|
|
38
|
+
describe: 'Only returns link agents that have sent a heartbeat within this number of seconds',
|
|
39
|
+
default: 300,
|
|
40
|
+
nargs: 1,
|
|
41
|
+
type: 'number',
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
exports.handler = (0, util_1.failWrapper)(listLinkAgents);
|
|
45
|
+
async function listLinkAgents(parsed) {
|
|
46
|
+
const limit = parsed.limit;
|
|
47
|
+
const maxHeartbeatAgeSeconds = parsed[constants_1.CommandArgMaxHeartbeatAge];
|
|
48
|
+
const workspaceId = await (0, util_1.getWorkspaceId)(parsed);
|
|
49
|
+
const output = parsed[constants_1.CommandArgOutput];
|
|
50
|
+
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
51
|
+
const linkAgents = (await apiClient.getLinkAgentsWithRecentHeartbeats(workspaceId, limit, maxHeartbeatAgeSeconds)).map((linkAgent) => ({
|
|
52
|
+
address: linkAgent.address,
|
|
53
|
+
created_time: linkAgent.created_time,
|
|
54
|
+
hostname: linkAgent.hostname,
|
|
55
|
+
id: linkAgent.id,
|
|
56
|
+
is_connected: linkAgent.is_connected,
|
|
57
|
+
java_version: linkAgent.java_version,
|
|
58
|
+
last_heartbeat_time: linkAgent.last_heartbeat_time,
|
|
59
|
+
name: linkAgent.label,
|
|
60
|
+
operating_system_architecture: linkAgent.operating_system_architecture,
|
|
61
|
+
operating_system_name: linkAgent.operating_system_name,
|
|
62
|
+
operating_system_version: linkAgent.operating_system_version,
|
|
63
|
+
status: linkAgent.status,
|
|
64
|
+
version: linkAgent.version,
|
|
65
|
+
}));
|
|
66
|
+
switch (output) {
|
|
67
|
+
case constants_1.OutputFormats.Json:
|
|
68
|
+
loggingProvider_1.logger.info(JSON.stringify(linkAgents, null, 2));
|
|
69
|
+
break;
|
|
70
|
+
case constants_1.OutputFormats.Yaml:
|
|
71
|
+
loggingProvider_1.logger.info((0, js_yaml_1.dump)(linkAgents));
|
|
72
|
+
break;
|
|
73
|
+
case constants_1.OutputFormats.Table:
|
|
74
|
+
default:
|
|
75
|
+
printLinkAgentsAsTable(linkAgents);
|
|
76
|
+
loggingProvider_1.logger.info(`${linkAgents.length} link agents returned`);
|
|
77
|
+
if (linkAgents.length === limit) {
|
|
78
|
+
loggingProvider_1.logger.info(`... use the --limit flag to return a larger set`);
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
return linkAgents.length;
|
|
83
|
+
}
|
|
84
|
+
function printLinkAgentsAsTable(linkAgents) {
|
|
85
|
+
const table = new cli_table3_1.default({
|
|
86
|
+
head: [
|
|
87
|
+
'ID',
|
|
88
|
+
'Name',
|
|
89
|
+
'Connected',
|
|
90
|
+
'Status',
|
|
91
|
+
'Host',
|
|
92
|
+
'OS',
|
|
93
|
+
'Java',
|
|
94
|
+
'Created',
|
|
95
|
+
'Heartbeat',
|
|
96
|
+
'Version',
|
|
97
|
+
],
|
|
98
|
+
wordWrap: true,
|
|
99
|
+
});
|
|
100
|
+
linkAgents.forEach((agent) => {
|
|
101
|
+
table.push([
|
|
102
|
+
{ rowSpan: 1, content: agent.id, vAlign: 'center' },
|
|
103
|
+
{ rowSpan: 1, content: agent.name, vAlign: 'center' },
|
|
104
|
+
{ rowSpan: 1, content: agent.is_connected, vAlign: 'center' },
|
|
105
|
+
{ rowSpan: 1, content: agent.status, vAlign: 'center' },
|
|
106
|
+
{
|
|
107
|
+
rowSpan: 1,
|
|
108
|
+
content: `${agent.hostname} (${agent.address})`,
|
|
109
|
+
vAlign: 'center',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
rowSpan: 1,
|
|
113
|
+
content: `${agent.operating_system_name} ${agent.operating_system_version} (${agent.operating_system_architecture})`,
|
|
114
|
+
vAlign: 'center',
|
|
115
|
+
},
|
|
116
|
+
{ rowSpan: 1, content: agent.java_version, vAlign: 'center' },
|
|
117
|
+
{
|
|
118
|
+
rowSpan: 1,
|
|
119
|
+
content: moment.utc(agent.created_time).format(constants_1.ListTimeFormat),
|
|
120
|
+
vAlign: 'center',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
rowSpan: 1,
|
|
124
|
+
content: moment.utc(agent.last_heartbeat_time).format(constants_1.ListTimeFormat),
|
|
125
|
+
vAlign: 'center',
|
|
126
|
+
},
|
|
127
|
+
{ rowSpan: 1, content: agent.version, vAlign: 'center' },
|
|
128
|
+
]);
|
|
129
|
+
});
|
|
130
|
+
loggingProvider_1.logger.info(table.toString());
|
|
131
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
|
|
7
|
+
const constants_1 = require("../../constants");
|
|
8
|
+
const util_1 = require("../../commandUtil/util");
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
|
|
11
|
+
exports.command = `terminate <${constants_1.CommandArgId}>`;
|
|
12
|
+
exports.describe = 'Sends a shutdown signal to a specific Link Agent.';
|
|
13
|
+
exports.builder = (yargs) => {
|
|
14
|
+
yargs.positional(constants_1.CommandArgId, {
|
|
15
|
+
describe: 'id of the link agent to terminate',
|
|
16
|
+
type: 'string',
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
exports.handler = (0, util_1.failWrapper)(terminateLinkAgent);
|
|
20
|
+
async function terminateLinkAgent(parsed) {
|
|
21
|
+
try {
|
|
22
|
+
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
23
|
+
const linkAgentId = parsed[constants_1.CommandArgId];
|
|
24
|
+
await apiClient.terminateLinkAgent(linkAgentId);
|
|
25
|
+
loggingProvider_1.logger.info(chalk_1.default.green(`Link agent ${chalk_1.default.bold(linkAgentId)} terminated`));
|
|
26
|
+
return linkAgentId;
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
throw new Error(`Error terminating link agent: ${error}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -138,8 +138,17 @@ async function createBrowserWithAuthedExtension(accessToken, browserWidth, brows
|
|
|
138
138
|
}
|
|
139
139
|
exports.createBrowserWithAuthedExtension = createBrowserWithAuthedExtension;
|
|
140
140
|
async function launchBrowserInstance(chromePath, launchArgs, userDataDir, headless, credentials, options) {
|
|
141
|
+
var _a;
|
|
141
142
|
const { bypassContentSecurityPolicy, defaultDeviceDescriptor, disableFocusEmulation, extraHttpHeaders, ignoreDefaultArgs, runnerType, loggerFunc, userAgent, } = options || {};
|
|
142
143
|
let browser;
|
|
144
|
+
const proxyServer = (_a = (await cliConfigProvider_1.CliConfigProvider.getCliConfig()).http.test
|
|
145
|
+
.proxyHost) === null || _a === void 0 ? void 0 : _a.href;
|
|
146
|
+
let proxy;
|
|
147
|
+
if (proxyServer) {
|
|
148
|
+
proxy = {
|
|
149
|
+
server: proxyServer,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
143
152
|
try {
|
|
144
153
|
browser = await maybeLaunchBrowser(chromePath, launchArgs, userDataDir, headless, credentials, {
|
|
145
154
|
bypassContentSecurityPolicy,
|
|
@@ -149,6 +158,7 @@ async function launchBrowserInstance(chromePath, launchArgs, userDataDir, headle
|
|
|
149
158
|
ignoreDefaultArgs,
|
|
150
159
|
runnerType,
|
|
151
160
|
loggerFunc,
|
|
161
|
+
proxy,
|
|
152
162
|
userAgent,
|
|
153
163
|
});
|
|
154
164
|
}
|
|
@@ -160,6 +170,7 @@ async function launchBrowserInstance(chromePath, launchArgs, userDataDir, headle
|
|
|
160
170
|
bypassContentSecurityPolicy,
|
|
161
171
|
defaultDeviceDescriptor,
|
|
162
172
|
ignoreDefaultArgs,
|
|
173
|
+
proxy,
|
|
163
174
|
runnerType,
|
|
164
175
|
}).catch((error) => {
|
|
165
176
|
messaging_1.mablEventEmitter.log('Browser launch failed', Date.now(), logLineMessaging_1.LogLineColor.red);
|
|
@@ -172,7 +183,7 @@ async function launchBrowserInstance(chromePath, launchArgs, userDataDir, headle
|
|
|
172
183
|
return browser;
|
|
173
184
|
}
|
|
174
185
|
function maybeLaunchBrowser(chromePath, launchArgs, userDataDir, headless, credentials, options) {
|
|
175
|
-
const { bypassContentSecurityPolicy, defaultDeviceDescriptor, disableFocusEmulation, extraHttpHeaders, ignoreDefaultArgs, runnerType, loggerFunc, userAgent, } = options || {};
|
|
186
|
+
const { bypassContentSecurityPolicy, defaultDeviceDescriptor, disableFocusEmulation, extraHttpHeaders, ignoreDefaultArgs, runnerType, loggerFunc, proxy, userAgent, } = options || {};
|
|
176
187
|
return browserLauncher_1.BrowserLauncherFactory.createRunner(runnerType, loggerFunc).launch({
|
|
177
188
|
bypassContentSecurityPolicy,
|
|
178
189
|
defaultDeviceDescriptor,
|
|
@@ -185,6 +196,7 @@ function maybeLaunchBrowser(chromePath, launchArgs, userDataDir, headless, crede
|
|
|
185
196
|
userDataDir,
|
|
186
197
|
downloadPath: createDownloadDirectory(),
|
|
187
198
|
credentials,
|
|
199
|
+
proxy,
|
|
188
200
|
userAgent,
|
|
189
201
|
});
|
|
190
202
|
}
|
|
@@ -210,7 +222,7 @@ function removeTempBrowserPreferencesDirectory(tempDirPath) {
|
|
|
210
222
|
}
|
|
211
223
|
}
|
|
212
224
|
async function createBrowser(browserWidth, browserHeight, headless, containerTesting, tempBrowserPreferencesDirectory, options) {
|
|
213
|
-
const { bypassContentSecurityPolicy, credentials, browserPath, disableFocusEmulation, disableIsolation, extraHttpHeaders, ignoreCertificateErrors, emulationConfig, enableExtensions, runnerType, loggerFunc, resourcesDirectoryOverride, userAgent, } = options || {};
|
|
225
|
+
const { bypassContentSecurityPolicy, credentials, browserPath, disableFocusEmulation, disableIsolation, extraHttpHeaders, ignoreCertificateErrors, emulationConfig, enableExtensions, runnerType, loggerFunc, resourcesDirectoryOverride, proxy, userAgent, } = options || {};
|
|
214
226
|
const chromePath = browserPath !== null && browserPath !== void 0 ? browserPath : (await findChrome());
|
|
215
227
|
if (!chromePath.length) {
|
|
216
228
|
messaging_1.mablEventEmitter.log(chalk.yellow('Could not find a local install of Chrome to use, please ensure you have it installed and try again'));
|
|
@@ -226,6 +238,9 @@ async function createBrowser(browserWidth, browserHeight, headless, containerTes
|
|
|
226
238
|
}
|
|
227
239
|
disableFeaturesFlags.push('site-per-process');
|
|
228
240
|
launchArgs.push(`--disable-features=${disableFeaturesFlags.join(',')}`);
|
|
241
|
+
if (options === null || options === void 0 ? void 0 : options.autoOpenDevtoolsForTabs) {
|
|
242
|
+
launchArgs.push('--auto-open-devtools-for-tabs');
|
|
243
|
+
}
|
|
229
244
|
const fakeMicrophoneMedia = (0, resourceUtil_1.findResource)('media/mabl_test_audio.wav', resourcesDirectoryOverride);
|
|
230
245
|
const fakeWebcamMedia = (0, resourceUtil_1.findResource)('media/mabl_test_pattern.y4m', resourcesDirectoryOverride);
|
|
231
246
|
const defaultDeviceDescriptor = addLaunchArgs(launchArgs, browserWidth, browserHeight, fakeMicrophoneMedia, fakeWebcamMedia, ignoreCertificateErrors, emulationConfig);
|
|
@@ -241,6 +256,7 @@ async function createBrowser(browserWidth, browserHeight, headless, containerTes
|
|
|
241
256
|
ignoreDefaultArgs,
|
|
242
257
|
runnerType,
|
|
243
258
|
loggerFunc,
|
|
259
|
+
proxy,
|
|
244
260
|
userAgent: userAgent !== null && userAgent !== void 0 ? userAgent : emulationConfig === null || emulationConfig === void 0 ? void 0 : emulationConfig.device_config.user_agent,
|
|
245
261
|
});
|
|
246
262
|
if (!maybeBrowser) {
|
|
@@ -49,7 +49,7 @@ async function pullJourney(parsed) {
|
|
|
49
49
|
const testId = parsed.id;
|
|
50
50
|
const format = parsed.format;
|
|
51
51
|
const detailLevel = parsed[constants_1.CommandArgDetailLevel];
|
|
52
|
-
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.
|
|
52
|
+
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
53
53
|
const branchName = (_a = parsed['mabl-branch']) !== null && _a !== void 0 ? _a : constants_1.DefaultBranchName;
|
|
54
54
|
const journey = await apiClient.getJourney(testId, branchName, format);
|
|
55
55
|
const flowArray = await (0, util_1.getJourneyFlowArray)(journey, apiClient, branchName);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getDefaultLogMetadataForInfo = exports.MablCoreProcessAction = exports.MablCoreAction = exports.ExecutionPhase = exports.EventChannelMessageType = exports.getEmitter = exports.mablEventEmitter = exports.MablCoreEventEmitter = void 0;
|
|
4
|
+
exports.getDefaultLogMetadataForInfo = exports.MablCoreProcessAction = exports.MablCoreAction = exports.ObservationErrorSeverity = exports.ObservationErrorCode = exports.ExecutionPhase = exports.EventChannelMessageType = exports.getEmitter = exports.mablEventEmitter = exports.MablCoreEventEmitter = void 0;
|
|
5
5
|
const events_1 = require("events");
|
|
6
6
|
const loggingProvider_1 = require("../../providers/logging/loggingProvider");
|
|
7
7
|
const NO_ID_PLACEHOLDER = 'NO_ID_PROVIDED';
|
|
@@ -68,6 +68,16 @@ var ExecutionPhase;
|
|
|
68
68
|
ExecutionPhase["DURING_ACTION"] = "DURING_ACTION";
|
|
69
69
|
ExecutionPhase["SKIP_ACTION"] = "SKIP_ACTION";
|
|
70
70
|
})(ExecutionPhase = exports.ExecutionPhase || (exports.ExecutionPhase = {}));
|
|
71
|
+
var ObservationErrorCode;
|
|
72
|
+
(function (ObservationErrorCode) {
|
|
73
|
+
ObservationErrorCode["ILLEGAL_URL_ERROR"] = "ILLEGAL_URL_ERROR";
|
|
74
|
+
ObservationErrorCode["PAGE_LOAD_FAILURE"] = "PAGE_LOAD_FAILURE";
|
|
75
|
+
})(ObservationErrorCode = exports.ObservationErrorCode || (exports.ObservationErrorCode = {}));
|
|
76
|
+
var ObservationErrorSeverity;
|
|
77
|
+
(function (ObservationErrorSeverity) {
|
|
78
|
+
ObservationErrorSeverity["ERROR"] = "ERROR";
|
|
79
|
+
ObservationErrorSeverity["WARN"] = "WARN";
|
|
80
|
+
})(ObservationErrorSeverity = exports.ObservationErrorSeverity || (exports.ObservationErrorSeverity = {}));
|
|
71
81
|
class MablCoreAction {
|
|
72
82
|
constructor(type, payload, timestamp = Date.now()) {
|
|
73
83
|
this.type = type;
|