@mablhq/mabl-cli 1.57.0 → 1.57.3
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/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +2 -1
- package/commands/constants.js +2 -1
- package/commands/datatables/datatables_cmds/scenarios.js +35 -0
- package/commands/tests/tests_cmds/run.js +18 -0
- package/commands/tests/tests_cmds/runUtils.js +6 -3
- package/execution/index.js +1 -1
- package/mablApi/index.js +1 -1
- package/package.json +1 -1
- package/proxy/index.js +1 -1
|
@@ -142,6 +142,7 @@ class PlaywrightFrame extends browserLauncher_1.Frame {
|
|
|
142
142
|
return new playwrightDom_1.PlaywrightElementHandle(frameElement, this.parentPage, this.parentPage.delegate.createElementHandleDelegate(frameElement));
|
|
143
143
|
}
|
|
144
144
|
async goto(url, options) {
|
|
145
|
+
var _a;
|
|
145
146
|
const lifecycleEvent = this.delegate.getLifecycleEventStrategy(options === null || options === void 0 ? void 0 : options.waitUntil);
|
|
146
147
|
try {
|
|
147
148
|
const response = await this.frame.goto(url, {
|
|
@@ -150,7 +151,7 @@ class PlaywrightFrame extends browserLauncher_1.Frame {
|
|
|
150
151
|
});
|
|
151
152
|
if (lifecycleEvent.waitForNetworkIdle) {
|
|
152
153
|
await this.frame.waitForLoadState('networkidle', {
|
|
153
|
-
timeout: types_1.DefaultTimeouts.defaultWaitTimeoutMs,
|
|
154
|
+
timeout: (_a = options === null || options === void 0 ? void 0 : options.timeout) !== null && _a !== void 0 ? _a : types_1.DefaultTimeouts.defaultWaitTimeoutMs,
|
|
154
155
|
});
|
|
155
156
|
}
|
|
156
157
|
return (0, utils_1.mapIfNotNull)(response, (response) => new playwrightHttpResponse_1.PlaywrightHttpResponse(this.parentPage, response));
|
package/commands/constants.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
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.CommandArgInput = 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.CommandArgDataTableId = exports.CommandArgCredentials = exports.CommandArgBasicAuthCredentials = exports.CommandArgBrowsers = exports.CommandArgBrowser = exports.CommandArgApplicationId = exports.CommandArgApiKey = void 0;
|
|
4
|
-
exports.SCENARIO_ID_HEADER = exports.SCENARIO_NAME_HEADER = exports.ValidBrowserTypesForLocalRuns = 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 = exports.CommandArgUrlApp = exports.CommandArgUrl = exports.CommandArgTrainerVersion = void 0;
|
|
4
|
+
exports.SCENARIO_ID_HEADER = exports.SCENARIO_NAME_HEADER = exports.ValidBrowserTypesForLocalRuns = 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.CommandArgScenarioId = exports.CommandArgReporterOptions = exports.CommandArgReporter = exports.CommandArgWorkspaceId = exports.CommandArgVersion = exports.CommandArgVariables = exports.CommandArgUrlApi = exports.CommandArgUrlApp = exports.CommandArgUrl = exports.CommandArgTrainerVersion = void 0;
|
|
5
5
|
const browserTypes_1 = require("./browserTypes");
|
|
6
6
|
exports.CommandArgApiKey = 'api-key';
|
|
7
7
|
exports.CommandArgApplicationId = 'application-id';
|
|
@@ -62,6 +62,7 @@ exports.CommandArgVersion = 'version';
|
|
|
62
62
|
exports.CommandArgWorkspaceId = 'workspace-id';
|
|
63
63
|
exports.CommandArgReporter = 'reporter';
|
|
64
64
|
exports.CommandArgReporterOptions = 'reporter-options';
|
|
65
|
+
exports.CommandArgScenarioId = 'scenario-id';
|
|
65
66
|
exports.ListTimeFormat = 'MMM Do YYYY, HH:mm:ss';
|
|
66
67
|
exports.CommandArgBrowserDisableIsolation = 'browser-disable-isolation';
|
|
67
68
|
exports.CommandArgBrowserIgnoreCertificateErrors = 'browser-ignore-certificate-errors';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
|
|
4
|
+
const util_1 = require("../../commandUtil/util");
|
|
5
|
+
const interfaces_1 = require("../../commandUtil/interfaces");
|
|
6
|
+
const list_1 = require("../../commandUtil/list");
|
|
7
|
+
const constants_1 = require("../../constants");
|
|
8
|
+
exports.command = `scenarios <${constants_1.CommandArgId}>`;
|
|
9
|
+
exports.describe = 'List the scenarios of a datatable';
|
|
10
|
+
exports.builder = (yargs) => {
|
|
11
|
+
yargs
|
|
12
|
+
.option(constants_1.CommandArgLimitOutput, {
|
|
13
|
+
alias: constants_1.CommandArgAliases.LimitOutput,
|
|
14
|
+
describe: `The number of scenarios to return'`,
|
|
15
|
+
default: interfaces_1.DEFAULT_LISTING_RESULT_LIMIT,
|
|
16
|
+
nargs: 1,
|
|
17
|
+
type: 'string',
|
|
18
|
+
})
|
|
19
|
+
.option(constants_1.CommandArgOutput, {
|
|
20
|
+
alias: constants_1.CommandArgAliases.OutputType,
|
|
21
|
+
choices: constants_1.DefaultOutputFormatChoices,
|
|
22
|
+
describe: 'Specify result output format',
|
|
23
|
+
nargs: 1,
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
exports.handler = (0, util_1.failWrapper)(dataTableScenarios);
|
|
27
|
+
async function dataTableScenarios(parsed) {
|
|
28
|
+
var _a;
|
|
29
|
+
const output = parsed.output;
|
|
30
|
+
const dataTableId = parsed.id;
|
|
31
|
+
const limit = parsed.limit;
|
|
32
|
+
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
33
|
+
const queryResult = await apiClient.queryScenarios(dataTableId, limit);
|
|
34
|
+
(0, list_1.outputEntities)((_a = queryResult.scenarios) !== null && _a !== void 0 ? _a : [], output);
|
|
35
|
+
}
|
|
@@ -9,6 +9,7 @@ const mablApi_1 = require("../../../mablApi");
|
|
|
9
9
|
const execution_1 = require("../../../execution");
|
|
10
10
|
const defaultEnv_1 = require("../../../env/defaultEnv");
|
|
11
11
|
const runUtils_1 = require("./runUtils");
|
|
12
|
+
const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
|
|
12
13
|
const execution = require('../../../execution/index');
|
|
13
14
|
exports.command = `run`;
|
|
14
15
|
exports.describe =
|
|
@@ -100,6 +101,11 @@ exports.builder = (yargs) => {
|
|
|
100
101
|
describe: 'Run test using all the scenarios from the Data table ID',
|
|
101
102
|
nargs: 1,
|
|
102
103
|
type: 'string',
|
|
104
|
+
})
|
|
105
|
+
.option(constants_1.CommandArgScenarioId, {
|
|
106
|
+
describe: 'Run test using an specific scenario',
|
|
107
|
+
nargs: 1,
|
|
108
|
+
type: 'string',
|
|
103
109
|
})
|
|
104
110
|
.option(constants_1.CommandArgBasicAuthCredentials, {
|
|
105
111
|
alias: constants_1.CommandArgAliases.BasicAuthCredentials,
|
|
@@ -176,6 +182,9 @@ exports.builder = (yargs) => {
|
|
|
176
182
|
if (argv[constants_1.CommandArgDataTableId] && !argv[constants_1.CommandArgId]) {
|
|
177
183
|
throw new Error(`The ${constants_1.CommandArgDataTableId} option can only be used with the ${constants_1.CommandArgId} option`);
|
|
178
184
|
}
|
|
185
|
+
if (argv[constants_1.CommandArgDataTableId] && argv[constants_1.CommandArgScenarioId]) {
|
|
186
|
+
throw new Error(`The ${constants_1.CommandArgScenarioId} option cannot be used with the ${constants_1.CommandArgDataTableId} option`);
|
|
187
|
+
}
|
|
179
188
|
const httpHeaders = argv[constants_1.CommandArgHttpHeaders];
|
|
180
189
|
(0, util_1.validateArrayInputs)(httpHeaders, 'HTTP headers must be SPACE delimited, e.g. "--http-headers "foo:bar" "baz:qux"');
|
|
181
190
|
argv[constants_1.CommandArgHttpHeaders] = (0, util_1.validateValuePairInputs)('HTTP header', httpHeaders);
|
|
@@ -201,12 +210,21 @@ async function run(parsed) {
|
|
|
201
210
|
}
|
|
202
211
|
});
|
|
203
212
|
const browserType = (0, testsUtil_1.parseBrowserType)(parsed[constants_1.CommandArgBrowser]);
|
|
213
|
+
let scenario;
|
|
214
|
+
if (parsed[constants_1.CommandArgScenarioId]) {
|
|
215
|
+
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
216
|
+
scenario = await apiClient.getScenario(parsed[constants_1.CommandArgScenarioId]);
|
|
217
|
+
if (!scenario) {
|
|
218
|
+
throw new Error(`Scenario with ID ${parsed[constants_1.CommandArgScenarioId]} not found`);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
204
221
|
const testRunnerConfig = {
|
|
205
222
|
_cliCreated: true,
|
|
206
223
|
basicAuthCredentialsId: parsed[constants_1.CommandArgBasicAuthCredentials],
|
|
207
224
|
branchName: parsed['mabl-branch'],
|
|
208
225
|
browserType,
|
|
209
226
|
credentialsId: parsed['credentials-id'],
|
|
227
|
+
dataTableVariables: scenario,
|
|
210
228
|
disableIsolation: parsed[constants_1.CommandArgBrowserDisableIsolation],
|
|
211
229
|
enableExtensions: parsed[constants_1.CommandArgBrowserEnableExtensions],
|
|
212
230
|
enableLink: parsed[constants_1.CommandArgEnableLink],
|
|
@@ -15,7 +15,7 @@ async function logTestResults(results, parsed, commandStartTime, rerunCommandTem
|
|
|
15
15
|
if (results.numPassedTests) {
|
|
16
16
|
results.testResults.forEach((result) => {
|
|
17
17
|
if (result.status === 'passed') {
|
|
18
|
-
loggingProvider_1.logger.info(` - ${result
|
|
18
|
+
loggingProvider_1.logger.info(` - ${getTestResultDescription(result)} (${(0, testsUtil_1.calculateTotalTimeSeconds)(result.startTime, result.endTime)}s)`);
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
}
|
|
@@ -23,7 +23,7 @@ async function logTestResults(results, parsed, commandStartTime, rerunCommandTem
|
|
|
23
23
|
if (results.numSkippedTests) {
|
|
24
24
|
results.testResults.forEach((result) => {
|
|
25
25
|
if (result.status === 'skipped') {
|
|
26
|
-
loggingProvider_1.logger.info(chalk_1.default.yellow(` - ${result
|
|
26
|
+
loggingProvider_1.logger.info(chalk_1.default.yellow(` - ${getTestResultDescription(result)}`));
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
29
|
}
|
|
@@ -31,7 +31,7 @@ async function logTestResults(results, parsed, commandStartTime, rerunCommandTem
|
|
|
31
31
|
if (results.numFailedTests) {
|
|
32
32
|
results.testResults.forEach((result) => {
|
|
33
33
|
if (result.status === 'failed') {
|
|
34
|
-
loggingProvider_1.logger.info(chalk_1.default.red(` - ${result
|
|
34
|
+
loggingProvider_1.logger.info(chalk_1.default.red(` - ${getTestResultDescription(result)} (${(0, testsUtil_1.calculateTotalTimeSeconds)(result.startTime, result.endTime)}s)`));
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
if (parsed.labels || parsed['from-plan-id'] || process.env.CI) {
|
|
@@ -45,3 +45,6 @@ async function logTestResults(results, parsed, commandStartTime, rerunCommandTem
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
exports.logTestResults = logTestResults;
|
|
48
|
+
function getTestResultDescription(result) {
|
|
49
|
+
return `${result.testName}${result.scenarioName ? ` - Scenario: ${result.scenarioName}` : ''}`;
|
|
50
|
+
}
|