@mablhq/mabl-cli 1.54.3 → 1.55.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/commands/commandUtil/util.js +3 -3
- package/commands/tests/testsUtil.js +2 -1
- package/commands/tests/tests_cmds/export.js +3 -0
- package/commands/tests/tests_cmds/run-cloud.js +15 -6
- package/core/execution/ApiTestUtils.js +781 -1
- package/core/messaging/pageMessaging.js +2 -1
- package/core/trainer/trainingSessions.js +2 -2
- package/coreWebVitals/index.js +85 -0
- package/execution/index.js +1 -1
- package/package.json +1 -1
- package/resources/coreWebVitals.js +1 -0
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.parseColinJoinedVariablePair = exports.validateValuePairInputs = exports.validateArrayInputs = exports.getWorkspaceIdFromAppOrEnv = exports.getJourneyFlowArray = exports.
|
|
6
|
+
exports.parseColinJoinedVariablePair = exports.validateValuePairInputs = exports.validateArrayInputs = exports.getWorkspaceIdFromAppOrEnv = exports.getJourneyFlowArray = exports.TEST_WITHOUT_FLOWS_MESSAGE = exports.getWorkspaceId = exports.failWrapper = exports.getDescribeDescriptions = void 0;
|
|
7
7
|
const cliConfigProvider_1 = require("../../providers/cliConfigProvider");
|
|
8
8
|
const constants_1 = require("../constants");
|
|
9
9
|
const loggingProvider_1 = require("../../providers/logging/loggingProvider");
|
|
@@ -36,10 +36,10 @@ async function getWorkspaceId(parsed) {
|
|
|
36
36
|
throw new Error('Please specify a workspace ID (--workspace-id) or configure a default in the CLI (mabl config set workspace <id>)');
|
|
37
37
|
}
|
|
38
38
|
exports.getWorkspaceId = getWorkspaceId;
|
|
39
|
-
exports.
|
|
39
|
+
exports.TEST_WITHOUT_FLOWS_MESSAGE = `Test does not have any flows. You may need to specify a branch [--${constants_1.CommandArgMablBranch}] if the test is not on master.`;
|
|
40
40
|
async function getJourneyFlowArray(journey, apiClient, branchName) {
|
|
41
41
|
if (!journey.flows || !journey.flows.length) {
|
|
42
|
-
throw new Error(exports.
|
|
42
|
+
throw new Error(exports.TEST_WITHOUT_FLOWS_MESSAGE);
|
|
43
43
|
}
|
|
44
44
|
const flows = {};
|
|
45
45
|
const requests = journey.flows.map((flowId) => apiClient
|
|
@@ -29,6 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.parseBrowserType = exports.toBasicHttpAuthenticationCredentials = 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.cleanUpInitialPages = exports.getExtensionBackgroundPageWithCliTool = exports.createBrowserForExecutionEngine = exports.createBrowser = exports.getFinalUrl = void 0;
|
|
30
30
|
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
31
31
|
const fs = __importStar(require("fs-extra"));
|
|
32
|
+
const mablApi_1 = require("../../mablApi");
|
|
32
33
|
const os = __importStar(require("os"));
|
|
33
34
|
const path = __importStar(require("path"));
|
|
34
35
|
const browserLauncher_1 = require("../../browserLauncher/browserLauncher");
|
|
@@ -47,7 +48,7 @@ const chalk = require('chalk');
|
|
|
47
48
|
let RUNNING_TEST = false;
|
|
48
49
|
function getFinalUrl(test, parsedUrl) {
|
|
49
50
|
const finalUrl = parsedUrl || test.url;
|
|
50
|
-
if (!finalUrl) {
|
|
51
|
+
if (!finalUrl && test.test_type !== mablApi_1.TestTypeEnum.Performance) {
|
|
51
52
|
throw new Error('No default URL found on test, please specify a URL using the -u or --url flag');
|
|
52
53
|
}
|
|
53
54
|
return finalUrl;
|
|
@@ -65,6 +65,9 @@ async function exportTest(parsed) {
|
|
|
65
65
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
66
66
|
const branchName = (_a = parsed['mabl-branch']) !== null && _a !== void 0 ? _a : constants_1.DefaultBranchName;
|
|
67
67
|
const journey = await apiClient.getJourney(testId, branchName, format);
|
|
68
|
+
if (journey.test_type === mablApi_1.TestTypeEnum.Performance) {
|
|
69
|
+
throw new Error('Export functionality is not yet available for performance tests.');
|
|
70
|
+
}
|
|
68
71
|
const flowArray = await (0, util_1.getJourneyFlowArray)(journey, apiClient, branchName);
|
|
69
72
|
if (flowArray
|
|
70
73
|
.map((flow) => flow.flow_type === mablApi_1.Flow.FlowTypeEnum.Mablscript ||
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
|
|
7
|
+
const mablApi_1 = require("../../../mablApi");
|
|
7
8
|
const constants_1 = require("../../constants");
|
|
8
9
|
const util_1 = require("../../commandUtil/util");
|
|
9
10
|
const branches_1 = require("../../commandUtil/branches");
|
|
@@ -200,19 +201,27 @@ async function runInCloud(parsed) {
|
|
|
200
201
|
}
|
|
201
202
|
async function executeRunCloudTest(test, browsers, branchName, apiClient, maybeDeploymentId, appUrl, apiUrl, credentialsId, applicationId, environmentId, basicAuthCredentialsId) {
|
|
202
203
|
var _a;
|
|
203
|
-
const effectiveAppUrl = appUrl !== null && appUrl !== void 0 ? appUrl : test ===
|
|
204
|
+
const effectiveAppUrl = appUrl !== null && appUrl !== void 0 ? appUrl : (test.test_type === undefined || test.test_type === mablApi_1.TestTypeEnum.Browser
|
|
205
|
+
? test === null || test === void 0 ? void 0 : test.url
|
|
206
|
+
: undefined);
|
|
207
|
+
const effectiveApiUrl = apiUrl !== null && apiUrl !== void 0 ? apiUrl : (test.test_type && test.test_type !== mablApi_1.TestTypeEnum.Browser
|
|
208
|
+
? test === null || test === void 0 ? void 0 : test.url
|
|
209
|
+
: undefined);
|
|
204
210
|
const workspaceId = test.organization_id;
|
|
205
211
|
const testId = test.invariant_id;
|
|
206
212
|
let deploymentIds;
|
|
207
|
-
if (!
|
|
208
|
-
|
|
213
|
+
if (!effectiveAppUrl && !effectiveApiUrl && !maybeDeploymentId) {
|
|
214
|
+
const urlCmdLineArg = test.test_type === mablApi_1.TestTypeEnum.Browser
|
|
215
|
+
? `--${constants_1.CommandArgUrl}, --${constants_1.CommandArgUrlApp}`
|
|
216
|
+
: `--${constants_1.CommandArgUrlApi}`;
|
|
217
|
+
throw new Error(`There is no default URL for test [${testId}]. Please specify ${urlCmdLineArg} or --${constants_1.CommandArgDeploymentId}`);
|
|
209
218
|
}
|
|
210
219
|
loggingProvider_1.logger.info(chalk.cyan(`Running test: `, chalk.magenta(`${test.name} - ${testId} - on branch - ${branchName}`)));
|
|
211
220
|
if (effectiveAppUrl) {
|
|
212
221
|
loggingProvider_1.logger.info(chalk.cyan(`App/web URL: `, chalk.magenta(effectiveAppUrl)));
|
|
213
222
|
}
|
|
214
|
-
if (
|
|
215
|
-
loggingProvider_1.logger.info(chalk.cyan(`API URL: `, chalk.magenta(
|
|
223
|
+
if (effectiveApiUrl) {
|
|
224
|
+
loggingProvider_1.logger.info(chalk.cyan(`API URL: `, chalk.magenta(effectiveApiUrl)));
|
|
216
225
|
}
|
|
217
226
|
if (applicationId || environmentId) {
|
|
218
227
|
const deploymentsResult = await apiClient.queryDeploymentEntities(workspaceId);
|
|
@@ -225,7 +234,7 @@ async function executeRunCloudTest(test, browsers, branchName, apiClient, maybeD
|
|
|
225
234
|
}
|
|
226
235
|
deploymentIds = foundDeployments.map((deployment) => deployment.id);
|
|
227
236
|
}
|
|
228
|
-
const planRun = await apiClient.postPlanRun(workspaceId, testId, branchName, browsers, effectiveAppUrl,
|
|
237
|
+
const planRun = await apiClient.postPlanRun(workspaceId, testId, branchName, browsers, effectiveAppUrl, effectiveApiUrl, maybeDeploymentId, credentialsId, deploymentIds, basicAuthCredentialsId);
|
|
229
238
|
const testRunsQueryResult = await apiClient.getTestRunsForPlan(planRun.id);
|
|
230
239
|
return (_a = testRunsQueryResult.test_script_executions) !== null && _a !== void 0 ? _a : [];
|
|
231
240
|
}
|