@mablhq/mabl-cli 1.58.25 → 1.58.28
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/basicApiClient.js +15 -21
- package/api/mablApiClient.js +48 -40
- package/api/mablApiClientFactory.js +1 -1
- package/auth/OktaClient.js +2 -1
- package/browserEngines/chromiumBrowserEngine.js +2 -1
- package/browserEngines/firefoxBrowserEngine.js +2 -2
- package/browserEngines/webkitBrowerEngine.js +2 -2
- package/browserLauncher/browserLauncherFactory.js +3 -2
- package/browserLauncher/elementHandle.js +2 -1
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumElementHandleDelegate.js +20 -12
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumFrameDelegate.js +1 -1
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumPageDelegate.js +10 -7
- package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxFrameDelegate.js +4 -3
- package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractElementHandleDelegate.js +5 -4
- package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractPageDelegate.js +7 -4
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +1 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +7 -6
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +37 -31
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +9 -8
- package/browserLauncher/playwrightBrowserLauncher/playwrightHttpRequest.js +8 -4
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +5 -3
- package/browserLauncher/playwrightBrowserLauncher/webkit/webkitElementHandleDelegate.js +2 -1
- package/browserLauncher/playwrightBrowserLauncher/webkit/webkitFrameDelegate.js +1 -1
- package/browserTestMonitoring/metricsRecorder.js +6 -6
- package/commands/commandUtil/branches.js +3 -2
- package/commands/commandUtil/codeInsights.js +16 -13
- package/commands/commandUtil/fileUtil.js +1 -1
- package/commands/commandUtil/util.js +5 -3
- package/commands/commandUtil/versionUtil.js +5 -4
- package/commands/config/config_cmds/list.js +2 -2
- package/commands/datatables/datatables_cmds/create.js +3 -2
- package/commands/datatables/datatables_cmds/export.js +5 -3
- package/commands/datatables/datatables_cmds/list.js +2 -1
- package/commands/datatables/datatables_cmds/scenarios.js +2 -1
- package/commands/datatables/datatables_cmds/update.js +11 -11
- package/commands/datatables/utils.js +9 -9
- package/commands/deploy/deploy_cmds/awaitDeploymentCompletion.js +8 -6
- package/commands/deploy/deploy_cmds/create.js +13 -11
- package/commands/deploy/deploy_cmds/executionResultPresenter.js +11 -8
- package/commands/deploy/deploy_cmds/list.js +4 -3
- package/commands/deploy/deploy_cmds/watch.js +2 -1
- package/commands/environments/environments_cmds/create.js +2 -1
- package/commands/environments/environments_cmds/delete.js +2 -1
- package/commands/environments/environments_cmds/update.js +2 -1
- package/commands/environments/environments_cmds/urls_cmds/list.js +2 -1
- package/commands/flows/flows_cmds/export.js +2 -1
- package/commands/plans/plans_cmds/describe.js +2 -1
- package/commands/tests/mobileEmulationUtil.js +7 -5
- package/commands/tests/testsUtil.js +42 -40
- package/commands/tests/tests_cmds/export.js +2 -1
- package/commands/tests/tests_cmds/import.js +5 -4
- package/commands/tests/tests_cmds/run-cloud.js +13 -12
- package/commands/tests/tests_cmds/run.js +11 -9
- package/commands/users/users_cmds/list.js +2 -2
- package/commands/workspaces/workspace_cmds/copy.js +2 -1
- package/core/execution/ApiTestUtils.js +94 -82
- package/core/messaging/logLineMessaging.js +3 -2
- package/core/messaging/messaging.js +7 -6
- package/core/trainer/trainingSessions.js +15 -15
- package/coreWebVitals/index.js +18 -14
- package/execution/index.js +1 -1
- package/functions/apiTest/utils.js +5 -4
- package/http/MablHttpAgent.js +6 -4
- package/http/RequestSecurityError.js +1 -1
- package/http/axiosProxyConfig.js +5 -3
- package/http/httpUtil.js +3 -2
- package/http/requestInterceptor.js +15 -11
- package/mablscript/MablAction.js +3 -2
- package/mablscript/MablStep.js +4 -2
- package/mablscript/MablSymbol.js +1 -1
- package/mablscript/actions/ConditionAction.js +4 -2
- package/mablscript/actions/FindAction.js +4 -2
- package/mablscript/diffing/diffingUtil.js +7 -8
- package/mablscript/importer.js +2 -1
- package/mablscript/steps/AccessibilityCheck.js +9 -7
- package/mablscript/steps/AssertStep.js +16 -11
- package/mablscript/steps/ClickAndHoldStep.js +2 -1
- package/mablscript/steps/CreateVariableStep.js +2 -1
- package/mablscript/steps/DownloadStep.js +2 -1
- package/mablscript/steps/EnterTextStep.js +2 -1
- package/mablscript/steps/EvaluateFlowStep.js +1 -1
- package/mablscript/steps/IfConditionStep.js +6 -4
- package/mablscript/steps/ReleaseStep.js +2 -1
- package/mablscript/steps/SendHttpRequestStep.js +4 -2
- package/mablscript/steps/SendKeyStep.js +1 -1
- package/mablscript/steps/SetCookieStep.js +8 -7
- package/mablscript/steps/SetViewportStep.js +1 -1
- package/mablscript/steps/SwitchContextStep.js +6 -3
- package/mablscript/steps/SyntheticStep.js +2 -1
- package/middleware.js +2 -1
- package/package.json +1 -1
- package/popupDismissal/index.js +5 -4
- package/providers/authenticationProvider.js +6 -5
- package/providers/cliConfigProvider.js +12 -10
- package/providers/exportRequestProvider.js +5 -3
- package/providers/logging/loggingProvider.js +1 -1
- package/reporters/mochAwesome/mochAwesomeReporter.js +14 -12
- package/util/TestOutputWriter.js +12 -8
- package/util/actionabilityUtil.js +1 -1
- package/util/analytics.js +9 -6
- package/util/browserTestUtils.js +2 -1
- package/util/markdownUtil.js +11 -9
|
@@ -27,9 +27,10 @@ class SendHttpRequestStep extends MablStep_1.MablStep {
|
|
|
27
27
|
return formatted;
|
|
28
28
|
}
|
|
29
29
|
static fromYaml(_stepName, stepArgs) {
|
|
30
|
+
var _a;
|
|
30
31
|
const formatted = stepArgs;
|
|
31
32
|
if (formatted.assertions) {
|
|
32
|
-
formatted.assertions = formatted.assertions
|
|
33
|
+
formatted.assertions = (_a = formatted.assertions) === null || _a === void 0 ? void 0 : _a.map((assertion) => ({
|
|
33
34
|
...assertion,
|
|
34
35
|
assertion: AssertStep_1.assertionStepToField[`Assert${assertion.assertion}`],
|
|
35
36
|
}));
|
|
@@ -46,7 +47,8 @@ class SendHttpRequestStep extends MablStep_1.MablStep {
|
|
|
46
47
|
return MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.sendRequest);
|
|
47
48
|
}
|
|
48
49
|
getOutputVariables() {
|
|
49
|
-
|
|
50
|
+
var _a, _b;
|
|
51
|
+
return (_b = (_a = this.sendRequest.variables) === null || _a === void 0 ? void 0 : _a.map((variable) => variable.name)) !== null && _b !== void 0 ? _b : [];
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
54
|
exports.SendHttpRequestStep = SendHttpRequestStep;
|
|
@@ -19,7 +19,7 @@ class SendKeyStep extends MablStep_1.MablStep {
|
|
|
19
19
|
throw new Error(`Unexpected find action for ${name} step: ${JSON.stringify(this.actions[0])}`);
|
|
20
20
|
}
|
|
21
21
|
const keys = this.getActionArgs();
|
|
22
|
-
if (!keys
|
|
22
|
+
if (!(keys === null || keys === void 0 ? void 0 : keys.length)) {
|
|
23
23
|
throw new Error(`${name} step expects at least one key`);
|
|
24
24
|
}
|
|
25
25
|
if (keys.every(SendKeyStepDescriptor_1.isCrossPlatformKeyPress)) {
|
|
@@ -38,16 +38,17 @@ class SetCookieStep extends MablStep_1.MablStep {
|
|
|
38
38
|
return new SetCookieStep('set_cookie', [stepArgs], []);
|
|
39
39
|
}
|
|
40
40
|
toMablscript() {
|
|
41
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
41
42
|
const cookieSelector = {
|
|
42
43
|
name: this.cookieName,
|
|
43
44
|
value: this.cookieValue,
|
|
44
|
-
domain: this.cookieOptions
|
|
45
|
-
path: this.cookieOptions
|
|
46
|
-
expiry: this.cookieOptions
|
|
47
|
-
http_only: this.cookieOptions
|
|
48
|
-
secure: this.cookieOptions
|
|
49
|
-
same_site: this.cookieOptions
|
|
50
|
-
url: this.cookieOptions
|
|
45
|
+
domain: (_a = this.cookieOptions) === null || _a === void 0 ? void 0 : _a.domain,
|
|
46
|
+
path: (_b = this.cookieOptions) === null || _b === void 0 ? void 0 : _b.path,
|
|
47
|
+
expiry: (_c = this.cookieOptions) === null || _c === void 0 ? void 0 : _c.expires,
|
|
48
|
+
http_only: (_d = this.cookieOptions) === null || _d === void 0 ? void 0 : _d.httpOnly,
|
|
49
|
+
secure: (_e = this.cookieOptions) === null || _e === void 0 ? void 0 : _e.secure,
|
|
50
|
+
same_site: (_f = this.cookieOptions) === null || _f === void 0 ? void 0 : _f.sameSite,
|
|
51
|
+
url: (_g = this.cookieOptions) === null || _g === void 0 ? void 0 : _g.url,
|
|
51
52
|
};
|
|
52
53
|
return `set_cookie(${(0, domUtil_1.buildStepArgumentString)({
|
|
53
54
|
params: cookieSelector,
|
|
@@ -6,7 +6,7 @@ class SetViewportStep extends MablStep_1.MablStep {
|
|
|
6
6
|
constructor(name, args, actions) {
|
|
7
7
|
super(name, args, actions);
|
|
8
8
|
const viewportArg = this.getActionArgs()[0];
|
|
9
|
-
this.size = viewportArg
|
|
9
|
+
this.size = viewportArg === null || viewportArg === void 0 ? void 0 : viewportArg.size;
|
|
10
10
|
}
|
|
11
11
|
getStepName() {
|
|
12
12
|
return 'SetViewport';
|
|
@@ -60,6 +60,7 @@ class SwitchContextStep extends MablStep_1.MablStep {
|
|
|
60
60
|
return this.switch;
|
|
61
61
|
}
|
|
62
62
|
getFormattedStep() {
|
|
63
|
+
var _a;
|
|
63
64
|
const step = this.toStepDescriptor();
|
|
64
65
|
const stepName = this.getStepName();
|
|
65
66
|
const formatted = {
|
|
@@ -77,7 +78,7 @@ class SwitchContextStep extends MablStep_1.MablStep {
|
|
|
77
78
|
}
|
|
78
79
|
if ((0, SwitchContextStepDescriptor_1.isSwitchFrame)(step)) {
|
|
79
80
|
formatted[stepName].selector = step.frame.findTarget.selector;
|
|
80
|
-
if (step.frame.findTarget.auxiliaryDescriptors
|
|
81
|
+
if ((_a = step.frame.findTarget.auxiliaryDescriptors) === null || _a === void 0 ? void 0 : _a.length) {
|
|
81
82
|
formatted[stepName].selectorAncestors =
|
|
82
83
|
step.frame.findTarget.auxiliaryDescriptors.map((descriptor) => descriptor.selector);
|
|
83
84
|
}
|
|
@@ -94,13 +95,15 @@ class SwitchContextStep extends MablStep_1.MablStep {
|
|
|
94
95
|
return new SwitchContextStep('switch_context_to', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
|
|
95
96
|
}
|
|
96
97
|
toMablscript() {
|
|
98
|
+
var _a;
|
|
97
99
|
if ((0, SwitchContextStepDescriptor_1.isSwitchRoot)(this.switch) && this.switch.frame === 'root') {
|
|
98
100
|
return 'switch_context_to("root")';
|
|
99
101
|
}
|
|
100
|
-
return `${this.findAction
|
|
102
|
+
return `${(_a = this.findAction) === null || _a === void 0 ? void 0 : _a.toMablscript()}.switch_context_to()`;
|
|
101
103
|
}
|
|
102
104
|
getInputVariables() {
|
|
103
|
-
|
|
105
|
+
var _a, _b;
|
|
106
|
+
return (_b = (_a = this.findAction) === null || _a === void 0 ? void 0 : _a.getInputVariables()) !== null && _b !== void 0 ? _b : [];
|
|
104
107
|
}
|
|
105
108
|
}
|
|
106
109
|
exports.SwitchContextStep = SwitchContextStep;
|
|
@@ -10,7 +10,8 @@ class SyntheticStep extends MablStep_1.MablStep {
|
|
|
10
10
|
this.actionSourceIndexInStep = 0;
|
|
11
11
|
}
|
|
12
12
|
getStepName() {
|
|
13
|
-
|
|
13
|
+
var _a;
|
|
14
|
+
return (_a = this.stepName) !== null && _a !== void 0 ? _a : 'Synthetic Step';
|
|
14
15
|
}
|
|
15
16
|
setStepName(stepName) {
|
|
16
17
|
this.stepName = stepName;
|
package/middleware.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
+
var _a;
|
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
7
|
exports.CLI_MIDDLEWARE = void 0;
|
|
7
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
@@ -14,7 +15,7 @@ const pureUtil_1 = require("./util/pureUtil");
|
|
|
14
15
|
const simple_update_notifier_1 = __importDefault(require("simple-update-notifier"));
|
|
15
16
|
const cliPackage = require('./package.json');
|
|
16
17
|
const UPDATE_CHECK_INTERVAL_MILLISECONDS = 24 * 60 * 60 * 1000;
|
|
17
|
-
const MIN_SUPPORTED_NODE_VERSION = (0, versionUtil_1.extractNodeVersionTuple)(cliPackage
|
|
18
|
+
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);
|
|
18
19
|
exports.CLI_MIDDLEWARE = [
|
|
19
20
|
() => {
|
|
20
21
|
(0, logLineMessaging_1.registerConsoleLoggerForOutput)(messaging_1.mablEventEmitter);
|
package/package.json
CHANGED
package/popupDismissal/index.js
CHANGED
|
@@ -44,7 +44,7 @@ function getEffectiveZIndex(element) {
|
|
|
44
44
|
if (zIndex && zIndex !== ZINDEX_AUTO) {
|
|
45
45
|
return parseInt(zIndex, 10);
|
|
46
46
|
}
|
|
47
|
-
current = current
|
|
47
|
+
current = (current === null || current === void 0 ? void 0 : current.parentElement) ? current.parentElement : undefined;
|
|
48
48
|
}
|
|
49
49
|
return 0;
|
|
50
50
|
}
|
|
@@ -91,8 +91,9 @@ function developCloseCandidates(candidates) {
|
|
|
91
91
|
const domCovering = [];
|
|
92
92
|
const actionableElements = [];
|
|
93
93
|
candidate.elements.forEach((element) => {
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
var _a;
|
|
95
|
+
if (element === null || element === void 0 ? void 0 : element.offsetParent) {
|
|
96
|
+
if (['BUTTON', 'A', 'DIV'].includes((_a = element.tagName) === null || _a === void 0 ? void 0 : _a.toUpperCase()) &&
|
|
96
97
|
checkElementAttributes(element) &&
|
|
97
98
|
!actionableElements.includes(element)) {
|
|
98
99
|
actionableElements.push(element);
|
|
@@ -170,7 +171,7 @@ function getAllElementsAbove(targetElement, elements) {
|
|
|
170
171
|
return [];
|
|
171
172
|
}
|
|
172
173
|
const targetZindex = getEffectiveZIndex(targetElement);
|
|
173
|
-
const zIndexAboveTarget = Math.min(...elements
|
|
174
|
+
const zIndexAboveTarget = Math.min(...elements === null || elements === void 0 ? void 0 : elements.map((el) => getEffectiveZIndex(el)));
|
|
174
175
|
if (zIndexAboveTarget <= targetZindex) {
|
|
175
176
|
return [];
|
|
176
177
|
}
|
|
@@ -106,6 +106,7 @@ class AuthenticationProvider {
|
|
|
106
106
|
return config.authentication.authType;
|
|
107
107
|
}
|
|
108
108
|
async displayInfo() {
|
|
109
|
+
var _a;
|
|
109
110
|
try {
|
|
110
111
|
const config = await cliConfigProvider_1.CliConfigProvider.getCliConfig();
|
|
111
112
|
if (config.authentication.authType === types_1.AuthType.ApiKey) {
|
|
@@ -117,8 +118,7 @@ class AuthenticationProvider {
|
|
|
117
118
|
return;
|
|
118
119
|
}
|
|
119
120
|
loggingProvider_1.logger.info(`Logged in as user [${chalk.magenta.bold(config.email)}]`);
|
|
120
|
-
const expirationMilliseconds = (config.authentication.refreshTokenExpirationTimeMilliseconds
|
|
121
|
-
config.authentication.accessTokenExpirationTimeMilliseconds) -
|
|
121
|
+
const expirationMilliseconds = ((_a = config.authentication.refreshTokenExpirationTimeMilliseconds) !== null && _a !== void 0 ? _a : config.authentication.accessTokenExpirationTimeMilliseconds) -
|
|
122
122
|
Date.now();
|
|
123
123
|
if (expirationMilliseconds > 0) {
|
|
124
124
|
loggingProvider_1.logger.info(`Login expires in [${chalk.magenta.bold(humanizeExpirationTime(expirationMilliseconds))}]`);
|
|
@@ -218,12 +218,13 @@ ${authUrl}
|
|
|
218
218
|
}
|
|
219
219
|
exports.AuthenticationProvider = AuthenticationProvider;
|
|
220
220
|
function processAuthorizationError(error, isTokenRefresh) {
|
|
221
|
+
var _a;
|
|
221
222
|
const mainErrorMessage = isTokenRefresh ? 'Token refresh' : 'Authorization';
|
|
222
223
|
loggingProvider_1.logger.error(chalk.red.bold(`${mainErrorMessage} failed.`));
|
|
223
224
|
loggingProvider_1.logger.error(chalk.red.bold(error.toString()));
|
|
224
225
|
let hasResponseData = false;
|
|
225
226
|
if (axios_1.default.isAxiosError(error)) {
|
|
226
|
-
const data = error.response
|
|
227
|
+
const data = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data;
|
|
227
228
|
if (isOidcError(data)) {
|
|
228
229
|
loggingProvider_1.logger.error(chalk.red.bold(`${mainErrorMessage} failed: ${data.error_description} [${data.error}]`));
|
|
229
230
|
hasResponseData = true;
|
|
@@ -247,7 +248,7 @@ function humanizeExpirationTime(milliseconds) {
|
|
|
247
248
|
});
|
|
248
249
|
}
|
|
249
250
|
function isOidcError(err) {
|
|
250
|
-
return ((0, pureUtil_1.isString)(err
|
|
251
|
-
(0, pureUtil_1.isString)(err
|
|
251
|
+
return ((0, pureUtil_1.isString)(err === null || err === void 0 ? void 0 : err.error) &&
|
|
252
|
+
(0, pureUtil_1.isString)(err === null || err === void 0 ? void 0 : err.error_description));
|
|
252
253
|
}
|
|
253
254
|
exports.isOidcError = isOidcError;
|
|
@@ -60,6 +60,7 @@ exports.AUTH_KEY_NAMES = [
|
|
|
60
60
|
];
|
|
61
61
|
let isKeytarAvailable = true;
|
|
62
62
|
async function getEncryptionKey() {
|
|
63
|
+
var _a;
|
|
63
64
|
if ((0, utilities_1.areWeTestingInJest)()) {
|
|
64
65
|
return;
|
|
65
66
|
}
|
|
@@ -68,7 +69,7 @@ async function getEncryptionKey() {
|
|
|
68
69
|
try {
|
|
69
70
|
const keytar = require('keytar');
|
|
70
71
|
maybeEncryptionKey =
|
|
71
|
-
(await keytar.getPassword(env_1.CONF_FILE_PROJECT_NAME, env_1.ENV))
|
|
72
|
+
(_a = (await keytar.getPassword(env_1.CONF_FILE_PROJECT_NAME, env_1.ENV))) !== null && _a !== void 0 ? _a : undefined;
|
|
72
73
|
if (!maybeEncryptionKey) {
|
|
73
74
|
maybeEncryptionKey = crypto
|
|
74
75
|
.randomFillSync(Buffer.alloc(48))
|
|
@@ -211,26 +212,27 @@ class CliConfigProvider {
|
|
|
211
212
|
return this.getCliConfig();
|
|
212
213
|
}
|
|
213
214
|
static async setCliConfig(config) {
|
|
214
|
-
|
|
215
|
-
await setValue(
|
|
216
|
-
await setValue(
|
|
217
|
-
await setValue(
|
|
218
|
-
await setValue(
|
|
219
|
-
await setValue(
|
|
215
|
+
var _a, _b, _c, _d, _e, _f;
|
|
216
|
+
await setValue(AUTH_PROVIDER, (_a = config === null || config === void 0 ? void 0 : config.authentication) === null || _a === void 0 ? void 0 : _a.authProvider);
|
|
217
|
+
await setValue(AUTH_TYPE, (_b = config === null || config === void 0 ? void 0 : config.authentication) === null || _b === void 0 ? void 0 : _b.authType);
|
|
218
|
+
await setValue(ACCESS_TOKEN_NAME, (_c = config === null || config === void 0 ? void 0 : config.authentication) === null || _c === void 0 ? void 0 : _c.accessToken);
|
|
219
|
+
await setValue(REFRESH_TOKEN_NAME, (_d = config === null || config === void 0 ? void 0 : config.authentication) === null || _d === void 0 ? void 0 : _d.refreshToken);
|
|
220
|
+
await setValue(ACCESS_TOKEN_EXPIRATION_MILLISECONDS_NAME, (_e = config === null || config === void 0 ? void 0 : config.authentication) === null || _e === void 0 ? void 0 : _e.accessTokenExpirationTimeMilliseconds);
|
|
221
|
+
await setValue(REFRESH_TOKEN_EXPIRATION_MILLISECONDS_NAME, (_f = config === null || config === void 0 ? void 0 : config.authentication) === null || _f === void 0 ? void 0 : _f.refreshTokenExpirationTimeMilliseconds);
|
|
220
222
|
await setValue(USER_ID_NAME, config.userId);
|
|
221
223
|
await setValue(EMAIL_NAME, config.email);
|
|
222
224
|
await setValue(USER_FULL_NAME_NAME, config.userFullName);
|
|
223
225
|
return config;
|
|
224
226
|
}
|
|
225
227
|
static async setCliAuthInfo(authInfo, updateMilliseconds) {
|
|
226
|
-
await setValue(AUTH_TYPE, authInfo
|
|
228
|
+
await setValue(AUTH_TYPE, authInfo === null || authInfo === void 0 ? void 0 : authInfo.auth_type);
|
|
227
229
|
switch (authInfo.auth_type) {
|
|
228
230
|
case types_2.AuthType.Bearer:
|
|
229
231
|
const bearerAuthInfo = authInfo;
|
|
230
232
|
const expirationTimeMilliseconds = updateMilliseconds + bearerAuthInfo.expires_in * 1000;
|
|
231
233
|
await setValue(AUTH_PROVIDER, bearerAuthInfo.auth_provider);
|
|
232
|
-
await setValue(ACCESS_TOKEN_NAME, bearerAuthInfo
|
|
233
|
-
await setValue(REFRESH_TOKEN_NAME, bearerAuthInfo
|
|
234
|
+
await setValue(ACCESS_TOKEN_NAME, bearerAuthInfo === null || bearerAuthInfo === void 0 ? void 0 : bearerAuthInfo.access_token);
|
|
235
|
+
await setValue(REFRESH_TOKEN_NAME, bearerAuthInfo === null || bearerAuthInfo === void 0 ? void 0 : bearerAuthInfo.refresh_token);
|
|
234
236
|
await setValue(ACCESS_TOKEN_EXPIRATION_MILLISECONDS_NAME, expirationTimeMilliseconds);
|
|
235
237
|
if (bearerAuthInfo.refresh_token_expires_at) {
|
|
236
238
|
await setValue(REFRESH_TOKEN_EXPIRATION_MILLISECONDS_NAME, bearerAuthInfo.refresh_token_expires_at * 1000);
|
|
@@ -23,7 +23,8 @@ class ExportRequestProvider {
|
|
|
23
23
|
this.outputFilepath = outputFilepath;
|
|
24
24
|
}
|
|
25
25
|
isExportIncomplete() {
|
|
26
|
-
|
|
26
|
+
var _a;
|
|
27
|
+
if ((_a = this.latestRequest) === null || _a === void 0 ? void 0 : _a.status) {
|
|
27
28
|
return this.continuationStatuses.includes(this.latestRequest.status);
|
|
28
29
|
}
|
|
29
30
|
return false;
|
|
@@ -57,7 +58,8 @@ class ExportRequestProvider {
|
|
|
57
58
|
return this.latestRequest;
|
|
58
59
|
}
|
|
59
60
|
async awaitCompletion() {
|
|
60
|
-
|
|
61
|
+
var _a;
|
|
62
|
+
if (!((_a = this.latestRequest) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
61
63
|
throw new Error('CreateExportRequest is undefined');
|
|
62
64
|
}
|
|
63
65
|
await this.pollForStatusUpdate(this.latestRequest.id);
|
|
@@ -151,7 +153,7 @@ class ExportRequestProvider {
|
|
|
151
153
|
this.exportDownloadSpinner,
|
|
152
154
|
]
|
|
153
155
|
.forEach((spinner) => {
|
|
154
|
-
if (spinner
|
|
156
|
+
if (spinner === null || spinner === void 0 ? void 0 : spinner.isSpinning) {
|
|
155
157
|
spinner.fail();
|
|
156
158
|
}
|
|
157
159
|
});
|
|
@@ -68,7 +68,7 @@ exports.logger = winston.createLogger({
|
|
|
68
68
|
defaultMeta: { service: 'mabl-cli' },
|
|
69
69
|
transports: [
|
|
70
70
|
new CliTransport({
|
|
71
|
-
format: winston.format.printf((info) => `${info.message
|
|
71
|
+
format: winston.format.printf((info) => { var _a; return `${(_a = info.message) !== null && _a !== void 0 ? _a : info[MESSAGE]}`; }),
|
|
72
72
|
}),
|
|
73
73
|
],
|
|
74
74
|
});
|
|
@@ -102,7 +102,7 @@ function generatePlainSuiteFromTestResults(testResults) {
|
|
|
102
102
|
const command = constructTestRunCommand();
|
|
103
103
|
return {
|
|
104
104
|
uuid: parentId,
|
|
105
|
-
title: command
|
|
105
|
+
title: command !== null && command !== void 0 ? command : `mabl CLI tests`,
|
|
106
106
|
fullFile: '',
|
|
107
107
|
file: '',
|
|
108
108
|
beforeHooks: [],
|
|
@@ -121,8 +121,9 @@ function generatePlainSuiteFromTestResults(testResults) {
|
|
|
121
121
|
}
|
|
122
122
|
exports.generatePlainSuiteFromTestResults = generatePlainSuiteFromTestResults;
|
|
123
123
|
function generatePlainTestForTestRun(parentUuid, testResult) {
|
|
124
|
+
var _a;
|
|
124
125
|
return {
|
|
125
|
-
title: testResult.testName
|
|
126
|
+
title: (_a = testResult.testName) !== null && _a !== void 0 ? _a : '',
|
|
126
127
|
fullTitle: `${testResult.testName} - ${testResult.testId}`,
|
|
127
128
|
timedOut: false,
|
|
128
129
|
code: getCodeForResult(testResult),
|
|
@@ -199,6 +200,7 @@ function generateHoldingTestSuiteObj(suite) {
|
|
|
199
200
|
};
|
|
200
201
|
}
|
|
201
202
|
function generateReportOptions(supplied) {
|
|
203
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
202
204
|
if (supplied.json) {
|
|
203
205
|
supplied.saveJson = supplied.json;
|
|
204
206
|
supplied.saveHtml = !supplied.saveJson;
|
|
@@ -208,16 +210,16 @@ function generateReportOptions(supplied) {
|
|
|
208
210
|
supplied.saveJson = !supplied.saveHtml;
|
|
209
211
|
}
|
|
210
212
|
return {
|
|
211
|
-
reportFilename: supplied.reportFilename
|
|
212
|
-
reportDir: supplied.reportDir
|
|
213
|
-
overwrite: supplied.overwrite
|
|
214
|
-
reportTitle: supplied.reportTitle
|
|
215
|
-
reportPageTitle: supplied.reportPageTitle
|
|
216
|
-
autoOpen: supplied.autoOpen
|
|
217
|
-
showPassed: supplied.showPassed
|
|
218
|
-
showFailed: supplied.showFailed
|
|
219
|
-
showPending: supplied.showPending
|
|
220
|
-
showSkipped: supplied.showSkipped
|
|
213
|
+
reportFilename: (_a = supplied.reportFilename) !== null && _a !== void 0 ? _a : `mabl-mochawesomeReport`,
|
|
214
|
+
reportDir: (_b = supplied.reportDir) !== null && _b !== void 0 ? _b : path.normalize(`./mablReports`),
|
|
215
|
+
overwrite: (_c = supplied.overwrite) !== null && _c !== void 0 ? _c : true,
|
|
216
|
+
reportTitle: (_d = supplied.reportTitle) !== null && _d !== void 0 ? _d : `mabl mochawesome report`,
|
|
217
|
+
reportPageTitle: (_e = supplied.reportPageTitle) !== null && _e !== void 0 ? _e : `mabl mochawesome report`,
|
|
218
|
+
autoOpen: (_f = supplied.autoOpen) !== null && _f !== void 0 ? _f : !supplied.saveJson,
|
|
219
|
+
showPassed: (_g = supplied.showPassed) !== null && _g !== void 0 ? _g : true,
|
|
220
|
+
showFailed: (_h = supplied.showFailed) !== null && _h !== void 0 ? _h : true,
|
|
221
|
+
showPending: (_j = supplied.showPending) !== null && _j !== void 0 ? _j : true,
|
|
222
|
+
showSkipped: (_k = supplied.showSkipped) !== null && _k !== void 0 ? _k : true,
|
|
221
223
|
saveJson: supplied.saveJson,
|
|
222
224
|
saveHtml: supplied.saveHtml,
|
|
223
225
|
};
|
package/util/TestOutputWriter.js
CHANGED
|
@@ -29,10 +29,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.LocalTestOutputWriter = void 0;
|
|
30
30
|
const fs = __importStar(require("fs"));
|
|
31
31
|
const CloudStorageWriter_1 = __importDefault(require("./CloudStorageWriter"));
|
|
32
|
-
const murmurhash = __importStar(require("murmurhash"));
|
|
33
32
|
const loggingProvider_1 = require("../providers/logging/loggingProvider");
|
|
33
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
34
34
|
const path_1 = __importDefault(require("path"));
|
|
35
|
-
const HASH_PREFIX_LENGTH = 4;
|
|
36
35
|
const EXECUTION_OUTPUT_PATH_PREFIX = 'execution-output';
|
|
37
36
|
const MAX_PATH_LENGTH = 1024;
|
|
38
37
|
class LocalTestOutputWriter {
|
|
@@ -75,20 +74,25 @@ class CloudOutputWriter {
|
|
|
75
74
|
await this.storageWriter.write(path, contentType, data);
|
|
76
75
|
return `${this.storageWriter.bucketName()}/${path}`;
|
|
77
76
|
}
|
|
77
|
+
randomPathComponent() {
|
|
78
|
+
return (crypto_1.default
|
|
79
|
+
.randomBytes(3)
|
|
80
|
+
.toString('base64url')
|
|
81
|
+
.replace(/-/g, 'm')
|
|
82
|
+
.replace(/_/g, 'a')
|
|
83
|
+
.toLowerCase());
|
|
84
|
+
}
|
|
78
85
|
nameToFullPath(name) {
|
|
79
86
|
const directoryPath = `${this.applicationId}/${this.planId}/${this.planRunId}/${this.testRunId}`;
|
|
80
|
-
const
|
|
81
|
-
const fullPath = `${EXECUTION_OUTPUT_PATH_PREFIX}/${
|
|
87
|
+
const randomComponent = this.randomPathComponent();
|
|
88
|
+
const fullPath = `${EXECUTION_OUTPUT_PATH_PREFIX}/${randomComponent}/${directoryPath}/${name}`;
|
|
82
89
|
if (fullPath.length <= MAX_PATH_LENGTH) {
|
|
83
90
|
return fullPath;
|
|
84
91
|
}
|
|
85
92
|
loggingProvider_1.logger.info(`WARNING: Truncating path longer than ${MAX_PATH_LENGTH}: ${fullPath}`);
|
|
86
93
|
const overage = fullPath.length - MAX_PATH_LENGTH;
|
|
87
94
|
const truncatedName = name.substring(overage);
|
|
88
|
-
return `${EXECUTION_OUTPUT_PATH_PREFIX}/${
|
|
89
|
-
}
|
|
90
|
-
generateHash(value) {
|
|
91
|
-
return murmurhash.v3(value).toString(36).substring(0, HASH_PREFIX_LENGTH);
|
|
95
|
+
return `${EXECUTION_OUTPUT_PATH_PREFIX}/${randomComponent}/${directoryPath}/${truncatedName}`;
|
|
92
96
|
}
|
|
93
97
|
}
|
|
94
98
|
exports.default = CloudOutputWriter;
|
|
@@ -67,7 +67,7 @@ async function checkActionabilityAt(elementHandle, executionContext, recheckOnFa
|
|
|
67
67
|
throw new Error(NO_CLICKABLE_POINT_ERROR);
|
|
68
68
|
}
|
|
69
69
|
const frame = await elementHandle.frame();
|
|
70
|
-
if (frame
|
|
70
|
+
if (frame === null || frame === void 0 ? void 0 : frame.parentFrame()) {
|
|
71
71
|
const element = await frame.getFrameOwnerElement();
|
|
72
72
|
if (element !== undefined) {
|
|
73
73
|
const box = await element.boundingBox();
|
package/util/analytics.js
CHANGED
|
@@ -36,20 +36,21 @@ const analytics = new Analytics('ghbAXZbk8fqWROgMscPdkQMoqEjwsKRa', {
|
|
|
36
36
|
flushInterval: 1,
|
|
37
37
|
});
|
|
38
38
|
async function getTrackingInfo() {
|
|
39
|
+
var _a, _b, _c;
|
|
39
40
|
const config = await cliConfigProvider_1.CliConfigProvider.getCliConfig();
|
|
40
41
|
if (config.authentication.authType === undefined) {
|
|
41
42
|
return {};
|
|
42
43
|
}
|
|
43
44
|
let userId;
|
|
44
45
|
if (config.authentication.authType === types_1.AuthType.ApiKey) {
|
|
45
|
-
userId = `cliKey-${config.workspace
|
|
46
|
+
userId = `cliKey-${(_b = (_a = config.workspace) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : 'unknown'}`;
|
|
46
47
|
}
|
|
47
48
|
else {
|
|
48
49
|
userId = config.userId;
|
|
49
50
|
}
|
|
50
51
|
return {
|
|
51
52
|
userId,
|
|
52
|
-
workspaceId: config.workspace
|
|
53
|
+
workspaceId: (_c = config.workspace) === null || _c === void 0 ? void 0 : _c.id,
|
|
53
54
|
};
|
|
54
55
|
}
|
|
55
56
|
async function trackCliEvent(commands, argumentCountMap) {
|
|
@@ -94,7 +95,8 @@ async function trackMablTestsRunnerEvent(eventName, resultsMap) {
|
|
|
94
95
|
}
|
|
95
96
|
exports.trackMablTestsRunnerEvent = trackMablTestsRunnerEvent;
|
|
96
97
|
function trackEvent(event, userId, properties) {
|
|
97
|
-
|
|
98
|
+
var _a, _b, _c;
|
|
99
|
+
const cpuInfo = (_a = os.cpus()) !== null && _a !== void 0 ? _a : [];
|
|
98
100
|
analytics.track({
|
|
99
101
|
userId,
|
|
100
102
|
event,
|
|
@@ -112,8 +114,8 @@ function trackEvent(event, userId, properties) {
|
|
|
112
114
|
userAgent: getUserAgent(),
|
|
113
115
|
userAgentData: {
|
|
114
116
|
cpuCount: cpuInfo.length,
|
|
115
|
-
cpuType: cpuInfo
|
|
116
|
-
cpuSpeed: cpuInfo
|
|
117
|
+
cpuType: (_b = cpuInfo === null || cpuInfo === void 0 ? void 0 : cpuInfo[0]) === null || _b === void 0 ? void 0 : _b.model,
|
|
118
|
+
cpuSpeed: (_c = cpuInfo === null || cpuInfo === void 0 ? void 0 : cpuInfo[0]) === null || _c === void 0 ? void 0 : _c.speed,
|
|
117
119
|
osArch: os.arch(),
|
|
118
120
|
memFree: os.freemem(),
|
|
119
121
|
memTotal: os.totalmem(),
|
|
@@ -123,6 +125,7 @@ function trackEvent(event, userId, properties) {
|
|
|
123
125
|
});
|
|
124
126
|
}
|
|
125
127
|
function getUserAgent() {
|
|
126
|
-
|
|
128
|
+
var _a, _b;
|
|
129
|
+
const nodeName = (_b = (_a = process === null || process === void 0 ? void 0 : process.release) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : 'node';
|
|
127
130
|
return `${nodeName}_${process.arch}@${process.version}`;
|
|
128
131
|
}
|
package/util/browserTestUtils.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var _a, _b;
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.IS_TEST_BROWSER_WEBKIT = exports.IS_TEST_BROWSER_FIREFOX = exports.IS_TEST_BROWSER_CHROMIUM = exports.TEST_BROWSER_ENGINE = exports.TEST_BROWSER_TYPE = void 0;
|
|
4
5
|
const browserEngines_1 = require("../browserEngines/browserEngines");
|
|
5
6
|
const browserTypes_1 = require("../commands/browserTypes");
|
|
6
7
|
const VALID_TEST_BROWSER_TYPES = ['chrome', 'firefox', 'webkit'];
|
|
7
|
-
const browserTypeEnvironmentVariable = process.env.TEST_BROWSER_TYPE
|
|
8
|
+
const browserTypeEnvironmentVariable = (_b = (_a = process.env.TEST_BROWSER_TYPE) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : 'chrome';
|
|
8
9
|
if (browserTypeEnvironmentVariable &&
|
|
9
10
|
!VALID_TEST_BROWSER_TYPES.includes(browserTypeEnvironmentVariable)) {
|
|
10
11
|
throw Error(`Test browser type cannot be ${browserTypeEnvironmentVariable}, it must be one of ${VALID_TEST_BROWSER_TYPES}`);
|
package/util/markdownUtil.js
CHANGED
|
@@ -14,19 +14,21 @@ var HumanizedMablStatuses;
|
|
|
14
14
|
HumanizedMablStatuses["Stopped"] = "Stopped";
|
|
15
15
|
})(HumanizedMablStatuses || (HumanizedMablStatuses = {}));
|
|
16
16
|
function formatResultsAsGithubMarkdown(results) {
|
|
17
|
+
var _a;
|
|
17
18
|
const tableRows = [];
|
|
18
19
|
tableRows.push(['Plan', 'Test', 'Browser', 'Status', 'Run Time']);
|
|
19
|
-
const finalExecutions = results
|
|
20
|
+
const finalExecutions = (_a = results === null || results === void 0 ? void 0 : results.executions) !== null && _a !== void 0 ? _a : [];
|
|
20
21
|
finalExecutions.forEach((summary) => {
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
const
|
|
22
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
23
|
+
const retryPrefix = ((_a = summary === null || summary === void 0 ? void 0 : summary.plan_execution) === null || _a === void 0 ? void 0 : _a.is_retry) ? '[Retry] ' : '';
|
|
24
|
+
const planName = retryPrefix + ((_c = (_b = summary.plan) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : '<plan name unavailable>');
|
|
25
|
+
const humanizedPlanRunStatus = humanizeMablStatus((_d = summary === null || summary === void 0 ? void 0 : summary.plan_execution) === null || _d === void 0 ? void 0 : _d.status);
|
|
24
26
|
const planRunStatus = humanizedMablStatusToGithubIcon(humanizedPlanRunStatus) +
|
|
25
27
|
' ' +
|
|
26
|
-
maybeCapitalize(humanizedPlanRunStatus
|
|
27
|
-
const planHref = summary.plan
|
|
28
|
+
maybeCapitalize(humanizedPlanRunStatus === null || humanizedPlanRunStatus === void 0 ? void 0 : humanizedPlanRunStatus.toString());
|
|
29
|
+
const planHref = (_e = summary.plan) === null || _e === void 0 ? void 0 : _e.app_href;
|
|
28
30
|
const journeyMap = new Map();
|
|
29
|
-
summary.journeys
|
|
31
|
+
(_f = summary.journeys) === null || _f === void 0 ? void 0 : _f.forEach((journeySummary) => journeyMap.set(journeySummary.id, journeySummary));
|
|
30
32
|
tableRows.push([
|
|
31
33
|
`[${planName}](${planHref})`,
|
|
32
34
|
'---',
|
|
@@ -34,11 +36,11 @@ function formatResultsAsGithubMarkdown(results) {
|
|
|
34
36
|
planRunStatus,
|
|
35
37
|
summaryToElapsedTime(summary),
|
|
36
38
|
]);
|
|
37
|
-
summary.journey_executions
|
|
39
|
+
(_g = summary.journey_executions) === null || _g === void 0 ? void 0 : _g.forEach((journeyRun) => {
|
|
38
40
|
const humanizedJourneyRunStatus = humanizeMablStatus(journeyRun.status);
|
|
39
41
|
const journeyStatus = humanizedMablStatusToGithubIcon(humanizedJourneyRunStatus) +
|
|
40
42
|
' ' +
|
|
41
|
-
maybeCapitalize(humanizedJourneyRunStatus
|
|
43
|
+
maybeCapitalize(humanizedJourneyRunStatus === null || humanizedJourneyRunStatus === void 0 ? void 0 : humanizedJourneyRunStatus.toString());
|
|
42
44
|
const journeyBrowser = maybeCapitalize(journeyRun.browser_type);
|
|
43
45
|
const journeySummary = journeyMap.get(journeyRun.journey_id);
|
|
44
46
|
let journeyLabel = '<test name unavailable>';
|