@mablhq/mabl-cli 1.29.19 → 1.32.2
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/Globals.js +45 -0
- package/api/basicApiClient.js +2 -0
- package/api/featureSet.js +4 -0
- package/api/mablApiClient.js +9 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +20 -3
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +1 -5
- package/commands/tests/testsUtil.js +14 -39
- package/commands/tests/tests_cmds/run-cloud.js +14 -10
- package/commands/tests/tests_cmds/run.js +11 -2
- package/core/messaging/logLineMessaging.js +3 -1
- package/execution/index.js +1 -1
- package/mablscript/steps/VisitUrlStep.js +9 -18
- package/package.json +4 -3
- package/popupDismissal/index.js +13 -3
- package/resources/pdf-viewer/EmbeddedPdfHandler.js +1 -0
- package/resources/pdf-viewer/index.js +1 -1
- package/resources/pdf-viewer/libEmbeddedPdfHandler.js +4 -4
- package/resources/pdf-viewer/libmablPdfViewer.js +9416 -7480
- package/resources/pdf-viewer/pdf.worker.5953c23fa7251d236190.js +2 -0
- package/resources/pdf-viewer/pdf.worker.5f2736435a8b46d97859.js +81 -0
- package/resources/popupDismissal.js +1 -1
- package/util/actionabilityUtil.js +3 -1
- package/util/fileUploadUtil.js +109 -0
- package/resources/pdf-viewer/pdf.worker.js +0 -81
package/Globals.js
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.Globals = void 0;
|
|
27
|
+
const os = __importStar(require("os"));
|
|
4
28
|
class Globals {
|
|
5
29
|
static getFindOverallTimeoutMs() {
|
|
6
30
|
return Globals.findOverallTimeoutMs;
|
|
@@ -14,7 +38,28 @@ class Globals {
|
|
|
14
38
|
static setPlaywrightInteractionWarningMs(timeout) {
|
|
15
39
|
Globals.playwrightInteractionWarningMs = timeout;
|
|
16
40
|
}
|
|
41
|
+
static getUploadDirectory() {
|
|
42
|
+
return Globals.uploadDirectory;
|
|
43
|
+
}
|
|
44
|
+
static setUploadDirectory(dir) {
|
|
45
|
+
Globals.uploadDirectory = dir;
|
|
46
|
+
}
|
|
47
|
+
static getUploadDirectoryPrefix() {
|
|
48
|
+
return Globals.uploadDirectoryPrefix;
|
|
49
|
+
}
|
|
50
|
+
static setUploadDirectoryPrefix(prefix) {
|
|
51
|
+
Globals.uploadDirectoryPrefix = prefix;
|
|
52
|
+
}
|
|
53
|
+
static getTestMaxAgeMs() {
|
|
54
|
+
return Globals.testMaxAgeMs;
|
|
55
|
+
}
|
|
56
|
+
static setTestMaxAgeMs(age) {
|
|
57
|
+
Globals.testMaxAgeMs = age;
|
|
58
|
+
}
|
|
17
59
|
}
|
|
18
60
|
exports.Globals = Globals;
|
|
19
61
|
Globals.findOverallTimeoutMs = 18.5 * 60 * 1000;
|
|
20
62
|
Globals.playwrightInteractionWarningMs = 30 * 1000;
|
|
63
|
+
Globals.uploadDirectory = os.tmpdir();
|
|
64
|
+
Globals.uploadDirectoryPrefix = `mablTestRunUploads-`;
|
|
65
|
+
Globals.testMaxAgeMs = 1000 * 60 * 60 * 24;
|
package/api/basicApiClient.js
CHANGED
|
@@ -65,6 +65,8 @@ class BasicApiClient {
|
|
|
65
65
|
}
|
|
66
66
|
config.timeout =
|
|
67
67
|
(_d = (_b = options.requestTimeoutMillis) !== null && _b !== void 0 ? _b : (_c = options.retryConfig) === null || _c === void 0 ? void 0 : _c.requestTimeoutMillis) !== null && _d !== void 0 ? _d : DEFAULT_RETRYABLE_REQUEST_TIMEOUT_MILLISECONDS;
|
|
68
|
+
config.maxBodyLength = Infinity;
|
|
69
|
+
config.maxContentLength = Infinity;
|
|
68
70
|
switch (options.authType) {
|
|
69
71
|
case types_1.AuthType.ApiKey:
|
|
70
72
|
config.auth = {
|
package/api/featureSet.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.FeatureSet = exports.FindImplementationVersion = void 0;
|
|
|
4
4
|
const types_1 = require("../browserLauncher/types");
|
|
5
5
|
const ACCESSIBILITY_CHECK_FEATURE_FLAG = 'accessibility_checks';
|
|
6
6
|
const SMARTER_WAIT_FEATURE_FLAG = 'smarter_wait';
|
|
7
|
+
const EXECUTION_SCREENCAST_MODE = 'execution_screencast_mode';
|
|
7
8
|
var FindImplementationVersion;
|
|
8
9
|
(function (FindImplementationVersion) {
|
|
9
10
|
FindImplementationVersion[FindImplementationVersion["V1"] = 0] = "V1";
|
|
@@ -24,5 +25,8 @@ class FeatureSet {
|
|
|
24
25
|
hasAccessibilityChecksEnabled() {
|
|
25
26
|
return this.featureFlags.has(ACCESSIBILITY_CHECK_FEATURE_FLAG);
|
|
26
27
|
}
|
|
28
|
+
isExecutionScreencastModeEnabled() {
|
|
29
|
+
return this.featureFlags.has(EXECUTION_SCREENCAST_MODE);
|
|
30
|
+
}
|
|
27
31
|
}
|
|
28
32
|
exports.FeatureSet = FeatureSet;
|
package/api/mablApiClient.js
CHANGED
|
@@ -453,7 +453,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
453
453
|
throw toApiError(`Failed to get Branches`, error);
|
|
454
454
|
}
|
|
455
455
|
}
|
|
456
|
-
async
|
|
456
|
+
async getFileUploadUrl(fileId) {
|
|
457
457
|
try {
|
|
458
458
|
return await this.makeGetRequest(`${this.baseApiUrl}/files/fileUpload/url/${fileId}`);
|
|
459
459
|
}
|
|
@@ -609,6 +609,14 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
609
609
|
requestBody.actions = actions;
|
|
610
610
|
return requestBody;
|
|
611
611
|
}
|
|
612
|
+
async getTestRunsForPlan(planRunId) {
|
|
613
|
+
try {
|
|
614
|
+
return this.makeGetRequest(`${this.baseApiUrl}/journeyRuns/planRun/${planRunId}`);
|
|
615
|
+
}
|
|
616
|
+
catch (error) {
|
|
617
|
+
throw toApiError(`Failed to retrieve tests for plan`, error);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
612
620
|
async postPlanRun(organizationId, testId, branchName, browserTypes, appUrl, apiUrl, deploymentId, credentialsId, deploymentIds, basicAuthCredentialsId) {
|
|
613
621
|
try {
|
|
614
622
|
const requestBody = this.buildAdHocPlanRunRequestBody(organizationId, testId, browserTypes, branchName, appUrl, apiUrl, deploymentId, credentialsId, deploymentIds, basicAuthCredentialsId);
|
|
@@ -34,8 +34,9 @@ const playwrightPage_1 = require("./playwrightPage");
|
|
|
34
34
|
const types_1 = require("../types");
|
|
35
35
|
const path_1 = __importDefault(require("path"));
|
|
36
36
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
37
|
+
const loggingProvider_1 = require("../../providers/logging/loggingProvider");
|
|
37
38
|
class PlaywrightBrowser extends events_1.default {
|
|
38
|
-
constructor(defaultContext, downloadDirectory, browserWSEndpoint, disableFocusEmulation) {
|
|
39
|
+
constructor(defaultContext, downloadDirectory, browserWSEndpoint, enableScreencastMode, disableFocusEmulation) {
|
|
39
40
|
super();
|
|
40
41
|
this.defaultContext = defaultContext;
|
|
41
42
|
this.downloadDirectory = downloadDirectory;
|
|
@@ -54,9 +55,16 @@ class PlaywrightBrowser extends events_1.default {
|
|
|
54
55
|
if (!fs_extra_1.default.existsSync(path_1.default.join(this.downloadDirectory))) {
|
|
55
56
|
fs_extra_1.default.mkdirSync(path_1.default.join(this.downloadDirectory));
|
|
56
57
|
}
|
|
58
|
+
loggingProvider_1.logger.debug(`Screencast mode is ${enableScreencastMode ? 'enabled' : 'disabled'}`);
|
|
59
|
+
if (enableScreencastMode) {
|
|
60
|
+
this.defaultContext.on('page', async (page) => this.enableScreencastMode(page));
|
|
61
|
+
this.defaultContext.pages().forEach(async (page) => {
|
|
62
|
+
await this.enableScreencastMode(page);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
57
65
|
}
|
|
58
|
-
static async create(defaultContext, downloadDirectory, browserWSEndpoint, disableFocusEmulation) {
|
|
59
|
-
const browser = new PlaywrightBrowser(defaultContext, downloadDirectory, browserWSEndpoint, disableFocusEmulation);
|
|
66
|
+
static async create(defaultContext, downloadDirectory, browserWSEndpoint, enableScreencastMode, disableFocusEmulation) {
|
|
67
|
+
const browser = new PlaywrightBrowser(defaultContext, downloadDirectory, browserWSEndpoint, enableScreencastMode, disableFocusEmulation);
|
|
60
68
|
await browser.setDownloadBehavior();
|
|
61
69
|
return browser;
|
|
62
70
|
}
|
|
@@ -127,6 +135,15 @@ class PlaywrightBrowser extends events_1.default {
|
|
|
127
135
|
eventsEnabled: true,
|
|
128
136
|
});
|
|
129
137
|
}
|
|
138
|
+
async enableScreencastMode(page) {
|
|
139
|
+
const cdp = await this.defaultContext.newCDPSession(page);
|
|
140
|
+
cdp.on('Page.screencastFrame', async (params) => {
|
|
141
|
+
await cdp
|
|
142
|
+
.send('Page.screencastFrameAck', { sessionId: params.sessionId })
|
|
143
|
+
.catch(() => { });
|
|
144
|
+
});
|
|
145
|
+
await cdp.send('Page.startScreencast', {});
|
|
146
|
+
}
|
|
130
147
|
onPageClose(page) {
|
|
131
148
|
this.playwrightPages.delete(page.getPageId());
|
|
132
149
|
this.emit(browserLauncher_1.BrowserEvent.PageDestroyed, page);
|
|
@@ -8,10 +8,6 @@ const playwrightBrowser_1 = require("./playwrightBrowser");
|
|
|
8
8
|
const simplePlaywrightLogger_1 = require("./simplePlaywrightLogger");
|
|
9
9
|
const BROWSER_LAUNCH_TIMEOUT_MS = 60000;
|
|
10
10
|
class PlaywrightBrowserLauncher {
|
|
11
|
-
async connect(options, currentDownloadPath) {
|
|
12
|
-
const browser = await test_1.chromium.connect(options.browserWSEndpoint);
|
|
13
|
-
return playwrightBrowser_1.PlaywrightBrowser.create(browser.contexts()[0], currentDownloadPath, options.browserWSEndpoint);
|
|
14
|
-
}
|
|
15
11
|
async launch(options) {
|
|
16
12
|
var _a, _b, _c, _d;
|
|
17
13
|
const viewport = options.defaultDeviceDescriptor
|
|
@@ -54,7 +50,7 @@ class PlaywrightBrowserLauncher {
|
|
|
54
50
|
userAgent: (_d = options.userAgent) !== null && _d !== void 0 ? _d : options.defaultUserAgent,
|
|
55
51
|
viewport,
|
|
56
52
|
});
|
|
57
|
-
return playwrightBrowser_1.PlaywrightBrowser.create(defaultContext, options.downloadPath, '', options.disableFocusEmulation);
|
|
53
|
+
return playwrightBrowser_1.PlaywrightBrowser.create(defaultContext, options.downloadPath, '', options.enableScreencastModeForScreenshotTimeouts, options.disableFocusEmulation);
|
|
58
54
|
}
|
|
59
55
|
}
|
|
60
56
|
exports.PlaywrightBrowserLauncher = PlaywrightBrowserLauncher;
|
|
@@ -26,14 +26,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.toBasicHttpAuthenticationCredentials = exports.generateChromiumPreferencesFile = exports.logTestInfoIfPresent = exports.milliSecondsToSeconds = exports.calculateTotalTimeSeconds = exports.extractTestRunConfig = exports.pullDownTestRunConfig = exports.validateRunCommandWithLabels = exports.validateRunEditCommand = exports.
|
|
29
|
+
exports.toBasicHttpAuthenticationCredentials = exports.generateChromiumPreferencesFile = exports.logTestInfoIfPresent = exports.milliSecondsToSeconds = exports.calculateTotalTimeSeconds = exports.extractTestRunConfig = exports.pullDownTestRunConfig = exports.validateRunCommandWithLabels = exports.validateRunEditCommand = exports.cleanupTestResources = exports.sleep = exports.editTheTest = exports.runTheTest = exports.prepareTrainerForSplitPlayback = exports.createTrainingSession = exports.cleanUpInitialPages = exports.getExtensionBackgroundPageWithCliTool = exports.createBrowserForExecutionEngine = exports.addExecutionEngineLaunchArgs = exports.createBrowser = exports.prepareChromePreferencesDirectory = exports.findChrome = exports.searchForChrome = exports.getFinalUrl = exports.getTempChromePrefDirectory = void 0;
|
|
30
30
|
const async_retry_1 = __importDefault(require("async-retry"));
|
|
31
|
-
const axios_1 = __importDefault(require("axios"));
|
|
32
31
|
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
33
32
|
const fs = __importStar(require("fs-extra"));
|
|
34
33
|
const os = __importStar(require("os"));
|
|
35
34
|
const path = __importStar(require("path"));
|
|
36
|
-
const stream_1 = require("stream");
|
|
37
35
|
const browserLauncher_1 = require("../../browserLauncher/browserLauncher");
|
|
38
36
|
const trainingSessionActions_1 = require("../../core/messaging/actions/trainingSessionActions");
|
|
39
37
|
const logLineMessaging_1 = require("../../core/messaging/logLineMessaging");
|
|
@@ -41,12 +39,13 @@ const messaging_1 = require("../../core/messaging/messaging");
|
|
|
41
39
|
const env_1 = require("../../env/env");
|
|
42
40
|
const cliConfigProvider_1 = require("../../providers/cliConfigProvider");
|
|
43
41
|
const loggingProvider_1 = require("../../providers/logging/loggingProvider");
|
|
44
|
-
const httpUtil_1 = require("../../util/httpUtil");
|
|
45
42
|
const resourceUtil_1 = require("../../util/resourceUtil");
|
|
46
43
|
const configKeys_1 = require("../config/config_cmds/configKeys");
|
|
47
44
|
const constants_1 = require("../constants");
|
|
48
45
|
const mobileEmulationUtil_1 = require("./mobileEmulationUtil");
|
|
49
46
|
const trainerUtil_1 = require("./tests_cmds/trainerUtil");
|
|
47
|
+
const logUtils_1 = require("../../util/logUtils");
|
|
48
|
+
const fileUploadUtil_1 = require("../../util/fileUploadUtil");
|
|
50
49
|
const chalk = require('chalk');
|
|
51
50
|
const chromeFinder = require('chrome-launcher/dist/chrome-finder');
|
|
52
51
|
const launchUtils = require('chrome-launcher/dist/utils');
|
|
@@ -212,6 +211,7 @@ async function createBrowser(browserWidth, browserHeight, headless, containerTes
|
|
|
212
211
|
ignoreDefaultArgs,
|
|
213
212
|
userAgent: (_a = options === null || options === void 0 ? void 0 : options.userAgent) !== null && _a !== void 0 ? _a : emulationConfig === null || emulationConfig === void 0 ? void 0 : emulationConfig.device_config.user_agent,
|
|
214
213
|
defaultUserAgent: options === null || options === void 0 ? void 0 : options.defaultUserAgent,
|
|
214
|
+
enableScreencastModeForScreenshotTimeouts: false,
|
|
215
215
|
});
|
|
216
216
|
if (!maybeBrowser) {
|
|
217
217
|
throw new Error('Unable to start Chrome session');
|
|
@@ -496,46 +496,19 @@ function handleExtensionMessage(message, trainingBrowser) {
|
|
|
496
496
|
break;
|
|
497
497
|
}
|
|
498
498
|
}
|
|
499
|
-
|
|
500
|
-
let client;
|
|
501
|
-
if (mablApiClient) {
|
|
502
|
-
client = mablApiClient.httpClient;
|
|
503
|
-
}
|
|
504
|
-
else {
|
|
505
|
-
client = axios_1.default.create(await (0, httpUtil_1.currentProxyConfig)());
|
|
506
|
-
}
|
|
499
|
+
function cleanupTestResources(testContext) {
|
|
507
500
|
try {
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
}
|
|
512
|
-
catch (error) {
|
|
513
|
-
if (!error.message.includes('file already exists')) {
|
|
514
|
-
throw error;
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
const finalPath = path.normalize(`${finalDirectory}/${fileUpload.name}`);
|
|
518
|
-
const writer = fs.createWriteStream(finalPath);
|
|
519
|
-
const response = await client.get(fileUploadUrl, {
|
|
520
|
-
responseType: 'stream',
|
|
521
|
-
});
|
|
522
|
-
if (response.data.pipe) {
|
|
523
|
-
response.data.pipe(writer);
|
|
501
|
+
if (testContext) {
|
|
502
|
+
testContext.getFileUploadDirs().forEach((dir) => (0, fileUploadUtil_1.removeUploadDirs)(dir));
|
|
503
|
+
testContext.clearFileUploadDirs();
|
|
524
504
|
}
|
|
525
|
-
else if (!(response.status >= 400)) {
|
|
526
|
-
stream_1.Readable.from(response.data).pipe(writer);
|
|
527
|
-
}
|
|
528
|
-
return new Promise((resolve, reject) => {
|
|
529
|
-
writer.on('finish', () => resolve(finalPath));
|
|
530
|
-
writer.on('error', reject);
|
|
531
|
-
});
|
|
532
505
|
}
|
|
533
|
-
catch (
|
|
534
|
-
|
|
535
|
-
|
|
506
|
+
catch (e) {
|
|
507
|
+
const msg = `WARNING: error received when cleaning up after tests: ${e.message}`;
|
|
508
|
+
(0, logUtils_1.logCliOutput)(loggingProvider_1.LogLevel.Warn, msg);
|
|
536
509
|
}
|
|
537
510
|
}
|
|
538
|
-
exports.
|
|
511
|
+
exports.cleanupTestResources = cleanupTestResources;
|
|
539
512
|
function validateRunEditCommand(idArg, testRunIdArg) {
|
|
540
513
|
if (!idArg && !testRunIdArg) {
|
|
541
514
|
throw new Error(chalk.red(`Please specify a test ID (--${constants_1.CommandArgId}) or test run ID (--${constants_1.CommandArgTestRunId})\n`));
|
|
@@ -599,6 +572,7 @@ async function pullDownTestRunConfig(testRunId, apiClient) {
|
|
|
599
572
|
filterHttpRequests: false,
|
|
600
573
|
importedVariables: (_k = journeyRun.journey_parameters) === null || _k === void 0 ? void 0 : _k.imported_variables,
|
|
601
574
|
pageLoadWait: (_l = journeyRun.journey_parameters) === null || _l === void 0 ? void 0 : _l.page_load_wait,
|
|
575
|
+
runId: journeyRun.id,
|
|
602
576
|
testId: (_m = journeyRun.journey) === null || _m === void 0 ? void 0 : _m.invariant_id,
|
|
603
577
|
url: (_p = (_o = journeyRun.journey_parameters) === null || _o === void 0 ? void 0 : _o.deployment) === null || _p === void 0 ? void 0 : _p.uri,
|
|
604
578
|
};
|
|
@@ -623,6 +597,7 @@ async function extractTestRunConfig(executionMessage, apiClient) {
|
|
|
623
597
|
filterHttpRequests: true,
|
|
624
598
|
importedVariables: (_l = journeyRun.journey_parameters) === null || _l === void 0 ? void 0 : _l.imported_variables,
|
|
625
599
|
pageLoadWait: (_m = journeyRun.journey_parameters) === null || _m === void 0 ? void 0 : _m.page_load_wait,
|
|
600
|
+
runId: journeyRun.id,
|
|
626
601
|
runnerType: maybeRunnerType,
|
|
627
602
|
testId: (_o = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey) === null || _o === void 0 ? void 0 : _o.invariant_id,
|
|
628
603
|
url: (_q = (_p = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _p === void 0 ? void 0 : _p.deployment) === null || _q === void 0 ? void 0 : _q.uri,
|
|
@@ -180,22 +180,27 @@ async function runInCloud(parsed) {
|
|
|
180
180
|
loggingProvider_1.logger.info(chalk.white('---'));
|
|
181
181
|
const resultUrls = [];
|
|
182
182
|
for (const test of tests) {
|
|
183
|
-
const
|
|
184
|
-
resultUrls.push(
|
|
183
|
+
const testRuns = await executeRunCloudTest(test, browsers, branchName, apiClient, maybeDeploymentId, maybeUrlApp, maybeUrlApi, credentialsId, applicationId, environmentId, basicAuthCredentialsId);
|
|
184
|
+
testRuns.forEach((testRun) => resultUrls.push(`${env_1.BASE_APP_URL}/workspaces/${testRun.organization_id}/test/journey-runs/${testRun.id}`));
|
|
185
185
|
loggingProvider_1.logger.info(chalk.white('---'));
|
|
186
186
|
}
|
|
187
187
|
let outputUrl;
|
|
188
|
-
if (resultUrls.length
|
|
189
|
-
outputUrl = `${env_1.BASE_APP_URL}/workspaces/${workspaceId}/output`;
|
|
190
|
-
loggingProvider_1.logger.info(`See mabl results page to view tests [${chalk.magenta(outputUrl)}]`);
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
188
|
+
if (resultUrls.length === 1) {
|
|
193
189
|
outputUrl = resultUrls[0];
|
|
194
190
|
loggingProvider_1.logger.info(`See mabl test output page for results [${chalk.magenta(outputUrl)}]`);
|
|
195
191
|
}
|
|
192
|
+
else {
|
|
193
|
+
let filter = '';
|
|
194
|
+
if (labelsInclude.length === 1) {
|
|
195
|
+
filter = `?labels=${labelsInclude[0]}`;
|
|
196
|
+
}
|
|
197
|
+
outputUrl = `${env_1.BASE_APP_URL}/workspaces/${workspaceId}/output${filter}`;
|
|
198
|
+
loggingProvider_1.logger.info(`See mabl results page to view tests [${chalk.magenta(outputUrl)}]`);
|
|
199
|
+
}
|
|
196
200
|
return outputUrl;
|
|
197
201
|
}
|
|
198
202
|
async function executeRunCloudTest(test, browsers, branchName, apiClient, maybeDeploymentId, appUrl, apiUrl, credentialsId, applicationId, environmentId, basicAuthCredentialsId) {
|
|
203
|
+
var _a;
|
|
199
204
|
const effectiveAppUrl = appUrl !== null && appUrl !== void 0 ? appUrl : test === null || test === void 0 ? void 0 : test.url;
|
|
200
205
|
const workspaceId = test.organization_id;
|
|
201
206
|
const testId = test.invariant_id;
|
|
@@ -222,9 +227,8 @@ async function executeRunCloudTest(test, browsers, branchName, apiClient, maybeD
|
|
|
222
227
|
deploymentIds = foundDeployments.map((deployment) => deployment.id);
|
|
223
228
|
}
|
|
224
229
|
const planRun = await apiClient.postPlanRun(workspaceId, testId, branchName, browsers, effectiveAppUrl, apiUrl, maybeDeploymentId, credentialsId, deploymentIds, basicAuthCredentialsId);
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
: [];
|
|
230
|
+
const testRunsQueryResult = await apiClient.getTestRunsForPlan(planRun.id);
|
|
231
|
+
return (_a = testRunsQueryResult.test_script_executions) !== null && _a !== void 0 ? _a : [];
|
|
228
232
|
}
|
|
229
233
|
async function getJourneysForLabels(workspaceId, branchName, branchChangesOnly, labelsInclude, labelsExclude, limit, prompt, apiClient) {
|
|
230
234
|
var _a;
|
|
@@ -8,6 +8,7 @@ const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
|
|
|
8
8
|
const mablApi_1 = require("../../../mablApi");
|
|
9
9
|
const reporter_1 = require("../../../reporters/reporter");
|
|
10
10
|
const browserTypes_1 = require("../../browserTypes");
|
|
11
|
+
const execution_1 = require("../../../execution");
|
|
11
12
|
const chalk = require('chalk');
|
|
12
13
|
const execution = require('../../../execution/index');
|
|
13
14
|
exports.command = `run`;
|
|
@@ -236,8 +237,16 @@ async function run(parsed) {
|
|
|
236
237
|
workspaceId,
|
|
237
238
|
};
|
|
238
239
|
loggingProvider_1.logger.info('Warming up test runner...');
|
|
239
|
-
const
|
|
240
|
-
const results = await
|
|
240
|
+
const mablTestsRunner = await execution.createMablTestRunner(testRunnerConfig);
|
|
241
|
+
const results = await mablTestsRunner.run();
|
|
242
|
+
if ((mablTestsRunner === null || mablTestsRunner === void 0 ? void 0 : mablTestsRunner.mablTestRunners) !== undefined) {
|
|
243
|
+
mablTestsRunner.mablTestRunners
|
|
244
|
+
.filter((tr) => tr instanceof execution_1.MablTestRunner)
|
|
245
|
+
.forEach((tr) => {
|
|
246
|
+
const testContext = tr.testContext;
|
|
247
|
+
(0, testsUtil_1.cleanupTestResources)(testContext);
|
|
248
|
+
});
|
|
249
|
+
}
|
|
241
250
|
loggingProvider_1.logger.logNewLine();
|
|
242
251
|
loggingProvider_1.logger.info(`Test count: ${results.numTotalTests}`);
|
|
243
252
|
loggingProvider_1.logger.info(`Passed: ${results.numPassedTests}`);
|
|
@@ -21,6 +21,7 @@ function registerConsoleLoggerForOutput(eventEmitter) {
|
|
|
21
21
|
eventEmitter
|
|
22
22
|
.getOutputEventChannel()
|
|
23
23
|
.on(messaging_1.EventChannelMessageType.outputLogLine, (line, timestamp, color, metadata) => {
|
|
24
|
+
var _a;
|
|
24
25
|
const formatted = color ? chalk_1.default[color](line) : line;
|
|
25
26
|
if ((metadata === null || metadata === void 0 ? void 0 : metadata.shouldOutputInConsole) === false) {
|
|
26
27
|
return;
|
|
@@ -30,7 +31,8 @@ function registerConsoleLoggerForOutput(eventEmitter) {
|
|
|
30
31
|
formattedTimestamp = `${moment
|
|
31
32
|
.unix(timestamp / 1000)
|
|
32
33
|
.format('LTS')} - `;
|
|
33
|
-
|
|
34
|
+
const stepNumberPrefix = (_a = metadata === null || metadata === void 0 ? void 0 : metadata.stepNumberPrefix) !== null && _a !== void 0 ? _a : '';
|
|
35
|
+
loggingProvider_1.logger.info(`${chalk_1.default.yellow(formattedTimestamp)}${stepNumberPrefix}${formatted}`);
|
|
34
36
|
}
|
|
35
37
|
else {
|
|
36
38
|
loggingProvider_1.logger.info(formatted);
|