@mablhq/mabl-cli 1.22.1 → 1.25.5
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/README.md +2 -2
- package/api/basicApiClient.js +4 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +24 -10
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +3 -0
- package/commands/deploy/deploy_cmds/awaitDeploymentCompletion.js +2 -6
- package/commands/deploy/deploy_cmds/create.js +0 -3
- package/commands/deploy/deploy_cmds/executionResultPresenter.js +9 -27
- package/commands/tests/testsUtil.js +27 -62
- package/commands/tests/tests_cmds/run.js +6 -6
- package/commands/tests/tests_cmds/trainerUtil.js +12 -0
- package/domUtil/index.js +1 -1
- package/execution/index.js +1 -1
- package/execution/index.js.LICENSE.txt +0 -29
- package/mablApi/index.js +1 -1
- package/mablscript/steps/SyntheticStep.js +2 -2
- package/mablscriptFind/index.js +1 -1
- package/package.json +9 -9
- package/resources/mablFind.js +1 -1
- package/util/markdownUtil.js +3 -21
- package/util/timeUtil.js +31 -0
- package/commands/tests/executionUtil.js +0 -36
- package/commands/tests/tests_cmds/run-alpha.js +0 -129
- package/commands/tests/tests_cmds/run-legacy.js +0 -109
- package/commands/tests/tests_cmds/trainer.js +0 -5
- package/commands/tests/tests_cmds/trainer_cmds/install.js +0 -14
- package/commands/tests/tests_cmds/trainer_cmds/trainerUtil.js +0 -169
- package/commands/tests/tests_cmds/trainer_cmds/update.js +0 -27
- package/commands/tests/tests_cmds/trainer_cmds/version.js +0 -22
package/README.md
CHANGED
|
@@ -345,10 +345,10 @@ mabl config delete http.sslVerify
|
|
|
345
345
|
|
|
346
346
|
## Installation Troubleshooting
|
|
347
347
|
|
|
348
|
-
If you receive the following error message, you need to ensure you have Node
|
|
348
|
+
If you receive the following error message, you need to ensure you have Node 14+
|
|
349
349
|
installed.
|
|
350
350
|
|
|
351
351
|
```bash
|
|
352
|
-
npm WARN notsup Unsupported engine for @mablhq/mabl-cli@0.1.13: wanted: {"node":">=
|
|
352
|
+
npm WARN notsup Unsupported engine for @mablhq/mabl-cli@0.1.13: wanted: {"node":">= 14.0.0"} (current: {"node":"8.15.1","npm":"6.13.4"})
|
|
353
353
|
npm WARN notsup Not compatible with your version of node/npm: @mablhq/mabl-cli@0.1.13
|
|
354
354
|
```
|
package/api/basicApiClient.js
CHANGED
|
@@ -59,6 +59,9 @@ class BasicApiClient {
|
|
|
59
59
|
sslVerify: (_a = options.sslVerify) !== null && _a !== void 0 ? _a : DEFAULT_SSL_VERIFY,
|
|
60
60
|
proxyHost: options.proxyUrl,
|
|
61
61
|
});
|
|
62
|
+
if (!config.headers) {
|
|
63
|
+
config.headers = {};
|
|
64
|
+
}
|
|
62
65
|
config.timeout =
|
|
63
66
|
(_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;
|
|
64
67
|
switch (options.authType) {
|
|
@@ -87,6 +90,7 @@ class BasicApiClient {
|
|
|
87
90
|
}
|
|
88
91
|
this.httpRequestConfig = config;
|
|
89
92
|
this.httpClient = axios_1.default.create(config);
|
|
93
|
+
this.httpClient.defaults.headers.common = { ...config.headers };
|
|
90
94
|
this.retryConfig = options.retryConfig;
|
|
91
95
|
this.debugLogger = (_e = options.debugLogger) !== null && _e !== void 0 ? _e : logUtils_1.logInternal;
|
|
92
96
|
}
|
|
@@ -131,8 +131,10 @@ 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
|
-
|
|
134
|
+
async maybeOverwriteScrollIntoViewDuringAction(action, options) {
|
|
135
|
+
if (options === null || options === void 0 ? void 0 : options.minimizeScrollIntoView) {
|
|
136
|
+
await this.overwriteScrollIntoViewFunction();
|
|
137
|
+
}
|
|
136
138
|
try {
|
|
137
139
|
return await action();
|
|
138
140
|
}
|
|
@@ -140,11 +142,13 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
|
|
|
140
142
|
throw e;
|
|
141
143
|
}
|
|
142
144
|
finally {
|
|
143
|
-
|
|
145
|
+
if (options === null || options === void 0 ? void 0 : options.minimizeScrollIntoView) {
|
|
146
|
+
await this.resetScrollIntoViewFunction();
|
|
147
|
+
}
|
|
144
148
|
}
|
|
145
149
|
}
|
|
146
150
|
click(options) {
|
|
147
|
-
return this.
|
|
151
|
+
return this.maybeOverwriteScrollIntoViewDuringAction(async () => {
|
|
148
152
|
var _a, _b, _c;
|
|
149
153
|
const trial = (_a = options === null || options === void 0 ? void 0 : options.trial) !== null && _a !== void 0 ? _a : false;
|
|
150
154
|
try {
|
|
@@ -162,10 +166,12 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
|
|
|
162
166
|
}
|
|
163
167
|
throw error;
|
|
164
168
|
}
|
|
169
|
+
}, {
|
|
170
|
+
minimizeScrollIntoView: options === null || options === void 0 ? void 0 : options.minimizeScrollIntoView,
|
|
165
171
|
});
|
|
166
172
|
}
|
|
167
173
|
async doubleClick(options) {
|
|
168
|
-
return this.
|
|
174
|
+
return this.maybeOverwriteScrollIntoViewDuringAction(async () => {
|
|
169
175
|
var _a, _b;
|
|
170
176
|
try {
|
|
171
177
|
const trial = (_a = options === null || options === void 0 ? void 0 : options.trial) !== null && _a !== void 0 ? _a : false;
|
|
@@ -180,6 +186,8 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
|
|
|
180
186
|
(0, logUtils_1.logInternal)(`Action timed out due to navigation timeout. ${error.toString()}`);
|
|
181
187
|
}
|
|
182
188
|
}
|
|
189
|
+
}, {
|
|
190
|
+
minimizeScrollIntoView: options === null || options === void 0 ? void 0 : options.minimizeScrollIntoView,
|
|
183
191
|
});
|
|
184
192
|
}
|
|
185
193
|
async clickablePoint() {
|
|
@@ -206,11 +214,13 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
|
|
|
206
214
|
scrollIntoViewIfNeeded() {
|
|
207
215
|
return this.element.scrollIntoViewIfNeeded();
|
|
208
216
|
}
|
|
209
|
-
async select(value) {
|
|
210
|
-
return this.
|
|
217
|
+
async select(value, options) {
|
|
218
|
+
return this.maybeOverwriteScrollIntoViewDuringAction(async () => this.element.selectOption(value), {
|
|
219
|
+
minimizeScrollIntoView: options === null || options === void 0 ? void 0 : options.minimizeScrollIntoView,
|
|
220
|
+
});
|
|
211
221
|
}
|
|
212
222
|
async type(text, options) {
|
|
213
|
-
return this.
|
|
223
|
+
return this.maybeOverwriteScrollIntoViewDuringAction(async () => {
|
|
214
224
|
var _a;
|
|
215
225
|
const selectText = (_a = options === null || options === void 0 ? void 0 : options.selectText) !== null && _a !== void 0 ? _a : true;
|
|
216
226
|
if (selectText) {
|
|
@@ -220,10 +230,14 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
|
|
|
220
230
|
delay: options === null || options === void 0 ? void 0 : options.delay,
|
|
221
231
|
timeout: 0,
|
|
222
232
|
});
|
|
233
|
+
}, {
|
|
234
|
+
minimizeScrollIntoView: options === null || options === void 0 ? void 0 : options.minimizeScrollIntoView,
|
|
223
235
|
});
|
|
224
236
|
}
|
|
225
|
-
press(key) {
|
|
226
|
-
return this.
|
|
237
|
+
press(key, options) {
|
|
238
|
+
return this.maybeOverwriteScrollIntoViewDuringAction(async () => this.element.press(key), {
|
|
239
|
+
minimizeScrollIntoView: options === null || options === void 0 ? void 0 : options.minimizeScrollIntoView,
|
|
240
|
+
});
|
|
227
241
|
}
|
|
228
242
|
getRemoteObjectId() {
|
|
229
243
|
var _a, _b, _c;
|
|
@@ -200,5 +200,8 @@ class PlaywrightFrame extends browserLauncher_1.Frame {
|
|
|
200
200
|
const context = await this.getFrameImpl()._utilityContext();
|
|
201
201
|
return new playwrightDom_1.PlaywrightJsHandle(await context.injectedScript(), this.page());
|
|
202
202
|
}
|
|
203
|
+
isDetached() {
|
|
204
|
+
return this.frame.isDetached();
|
|
205
|
+
}
|
|
203
206
|
}
|
|
204
207
|
exports.PlaywrightFrame = PlaywrightFrame;
|
|
@@ -3,11 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AwaitDeploymentCompletion = void 0;
|
|
4
4
|
const awaitCompletion_1 = require("../../commandUtil/awaitCompletion");
|
|
5
5
|
const executionResultPresenter_1 = require("./executionResultPresenter");
|
|
6
|
-
const moment = require("moment");
|
|
7
6
|
const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
|
|
7
|
+
const timeUtil_1 = require("../../../util/timeUtil");
|
|
8
8
|
const chalk = require('chalk');
|
|
9
|
-
const momentDurationFormatSetup = require('moment-duration-format');
|
|
10
|
-
momentDurationFormatSetup(moment);
|
|
11
9
|
class AwaitDeploymentCompletion extends awaitCompletion_1.AwaitCompletion {
|
|
12
10
|
constructor(apiClient, exitOnFirstFailure, isSilent) {
|
|
13
11
|
super(apiClient, AwaitDeploymentCompletion.pollingTimeoutMilliseconds, AwaitDeploymentCompletion.pollingIntervalMilliseconds);
|
|
@@ -46,9 +44,7 @@ class AwaitDeploymentCompletion extends awaitCompletion_1.AwaitCompletion {
|
|
|
46
44
|
if (this.isSilent) {
|
|
47
45
|
return;
|
|
48
46
|
}
|
|
49
|
-
const elapsedTimeString =
|
|
50
|
-
.duration(this.getElapsedMilliseconds(), 'ms')
|
|
51
|
-
.format('hh:mm:ss', { trim: false });
|
|
47
|
+
const elapsedTimeString = (0, timeUtil_1.elapsedTimeDurationToString)(this.getElapsedMilliseconds());
|
|
52
48
|
const passed = (_b = (_a = lastEntity.plan_execution_metrics) === null || _a === void 0 ? void 0 : _a.passed) !== null && _b !== void 0 ? _b : 0;
|
|
53
49
|
const failed = (_d = (_c = lastEntity.plan_execution_metrics) === null || _c === void 0 ? void 0 : _c.failed) !== null && _d !== void 0 ? _d : 0;
|
|
54
50
|
const total = (_f = (_e = lastEntity.plan_execution_metrics) === null || _e === void 0 ? void 0 : _e.total) !== null && _f !== void 0 ? _f : 0;
|
|
@@ -7,7 +7,6 @@ const mablApi_1 = require("../../../mablApi");
|
|
|
7
7
|
const util_1 = require("../../commandUtil/util");
|
|
8
8
|
const branches_1 = require("../../commandUtil/branches");
|
|
9
9
|
const awaitDeploymentCompletion_1 = require("./awaitDeploymentCompletion");
|
|
10
|
-
const moment = require("moment");
|
|
11
10
|
const scmContextProvider_1 = require("../../../providers/scmContextProvider");
|
|
12
11
|
const cliConfigProvider_1 = require("../../../providers/cliConfigProvider");
|
|
13
12
|
const configKeys_1 = require("../../config/config_cmds/configKeys");
|
|
@@ -16,8 +15,6 @@ const constants_1 = require("../../constants");
|
|
|
16
15
|
const describe_1 = require("../../commandUtil/describe");
|
|
17
16
|
const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
|
|
18
17
|
const chalk = require('chalk');
|
|
19
|
-
const momentDurationFormatSetup = require('moment-duration-format');
|
|
20
|
-
momentDurationFormatSetup(moment);
|
|
21
18
|
const CommandArgAwaitCompletion = 'await-completion';
|
|
22
19
|
const CommandArgRebaselineImages = 'rebaseline-images';
|
|
23
20
|
const CommandArgRepositoryUrl = 'repository-url';
|
|
@@ -6,11 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.ExecutionResultPresenter = void 0;
|
|
7
7
|
const change_case_1 = require("change-case");
|
|
8
8
|
const mablApi_1 = require("../../../mablApi");
|
|
9
|
-
const moment = require("moment");
|
|
10
9
|
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
10
|
+
const timeUtil_1 = require("../../../util/timeUtil");
|
|
11
11
|
const chalk = require('chalk');
|
|
12
|
-
const momentDurationFormatSetup = require('moment-duration-format');
|
|
13
|
-
momentDurationFormatSetup(moment);
|
|
14
12
|
class ExecutionResultPresenter {
|
|
15
13
|
entityToString(results, columnWidth) {
|
|
16
14
|
var _a;
|
|
@@ -45,7 +43,7 @@ class ExecutionResultPresenter {
|
|
|
45
43
|
planId,
|
|
46
44
|
'---',
|
|
47
45
|
statusChalk(this.maybeCapitalize(planRunStatus.toString())),
|
|
48
|
-
|
|
46
|
+
summaryToElapsedTime(summary),
|
|
49
47
|
]);
|
|
50
48
|
(_e = summary === null || summary === void 0 ? void 0 : summary.journey_executions) === null || _e === void 0 ? void 0 : _e.forEach((journeyRun) => {
|
|
51
49
|
var _a, _b, _c, _d;
|
|
@@ -61,7 +59,7 @@ class ExecutionResultPresenter {
|
|
|
61
59
|
journeyId,
|
|
62
60
|
journeyBrowser,
|
|
63
61
|
statusChalk(journeyStatus),
|
|
64
|
-
|
|
62
|
+
journeyRunToElapsedTime(journeyRun),
|
|
65
63
|
]);
|
|
66
64
|
});
|
|
67
65
|
});
|
|
@@ -73,28 +71,6 @@ class ExecutionResultPresenter {
|
|
|
73
71
|
}
|
|
74
72
|
return;
|
|
75
73
|
}
|
|
76
|
-
journeyRunToElapsedTime(journeyRun) {
|
|
77
|
-
let elapsedTimeString = '--:--:--';
|
|
78
|
-
const startTime = journeyRun.start_time;
|
|
79
|
-
const stopTime = journeyRun.stop_time;
|
|
80
|
-
if (startTime && stopTime) {
|
|
81
|
-
elapsedTimeString = moment
|
|
82
|
-
.duration(stopTime - startTime, 'ms')
|
|
83
|
-
.format('hh:mm:ss', { trim: false });
|
|
84
|
-
}
|
|
85
|
-
return elapsedTimeString;
|
|
86
|
-
}
|
|
87
|
-
summaryToElapsedTime(summary) {
|
|
88
|
-
let elapsedTimeString = '--:--:--';
|
|
89
|
-
const startTime = summary.start_time;
|
|
90
|
-
const stopTime = summary.stop_time;
|
|
91
|
-
if (startTime && stopTime) {
|
|
92
|
-
elapsedTimeString = moment
|
|
93
|
-
.duration(stopTime - startTime, 'ms')
|
|
94
|
-
.format('hh:mm:ss', { trim: false });
|
|
95
|
-
}
|
|
96
|
-
return elapsedTimeString;
|
|
97
|
-
}
|
|
98
74
|
mapPlanRunStatusToColor(status) {
|
|
99
75
|
switch (status) {
|
|
100
76
|
case mablApi_1.PlanExecutionResult.StatusEnum.Queued:
|
|
@@ -132,3 +108,9 @@ class ExecutionResultPresenter {
|
|
|
132
108
|
}
|
|
133
109
|
}
|
|
134
110
|
exports.ExecutionResultPresenter = ExecutionResultPresenter;
|
|
111
|
+
function journeyRunToElapsedTime(journeyRun) {
|
|
112
|
+
return (0, timeUtil_1.elapsedTimeToString)(journeyRun.start_time, journeyRun.stop_time);
|
|
113
|
+
}
|
|
114
|
+
function summaryToElapsedTime(summary) {
|
|
115
|
+
return (0, timeUtil_1.elapsedTimeToString)(summary.start_time, summary.stop_time);
|
|
116
|
+
}
|
|
@@ -26,9 +26,8 @@ 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.downloadUploadFile = exports.sleep = exports.editTheTest = exports.runTheTest = exports.prepareTrainerForSplitPlayback = exports.createTrainingSession = exports.cleanUpInitialPages = exports.getExtensionBackgroundPageWithCliTool = exports.
|
|
29
|
+
exports.toBasicHttpAuthenticationCredentials = exports.generateChromiumPreferencesFile = exports.logTestInfoIfPresent = exports.milliSecondsToSeconds = exports.calculateTotalTimeSeconds = exports.extractTestRunConfig = exports.pullDownTestRunConfig = exports.validateRunCommandWithLabels = exports.validateRunEditCommand = exports.downloadUploadFile = 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 os = __importStar(require("os"));
|
|
31
|
-
const trainerUtil_1 = require("./tests_cmds/trainer_cmds/trainerUtil");
|
|
32
31
|
const fs = __importStar(require("fs-extra"));
|
|
33
32
|
const path = __importStar(require("path"));
|
|
34
33
|
const constants_1 = require("../constants");
|
|
@@ -47,6 +46,7 @@ const resourceUtil_1 = require("../../util/resourceUtil");
|
|
|
47
46
|
const mobileEmulationUtil_1 = require("./mobileEmulationUtil");
|
|
48
47
|
const browserLauncher_1 = require("../../browserLauncher/browserLauncher");
|
|
49
48
|
const stream_1 = require("stream");
|
|
49
|
+
const trainerUtil_1 = require("./tests_cmds/trainerUtil");
|
|
50
50
|
const chalk = require('chalk');
|
|
51
51
|
const chromeFinder = require('chrome-launcher/dist/chrome-finder');
|
|
52
52
|
const launchUtils = require('chrome-launcher/dist/utils');
|
|
@@ -105,38 +105,6 @@ async function findChrome() {
|
|
|
105
105
|
return chromePath;
|
|
106
106
|
}
|
|
107
107
|
exports.findChrome = findChrome;
|
|
108
|
-
async function createBrowserWithAuthedExtension(accessToken, browserWidth, browserHeight, tempBrowserPreferencesDirectory, options) {
|
|
109
|
-
const { credentials, disableIsolation, ignoreCertificateErrors, runnerType, loggerFunc, } = options;
|
|
110
|
-
const pathToExtension = await (0, trainerUtil_1.getMablTrainerExtensionPath)();
|
|
111
|
-
const chromePath = await findChrome();
|
|
112
|
-
if (!chromePath.length) {
|
|
113
|
-
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'));
|
|
114
|
-
throw new Error('Chrome not found error');
|
|
115
|
-
}
|
|
116
|
-
messaging_1.mablEventEmitter.log(`Using Chrome at the following path: ${chromePath}`);
|
|
117
|
-
const launchArgs = [
|
|
118
|
-
`--disable-extensions-except=${pathToExtension}`,
|
|
119
|
-
`--load-extension=${pathToExtension}`,
|
|
120
|
-
`--window-size=${browserWidth},${browserHeight}`,
|
|
121
|
-
];
|
|
122
|
-
if (ignoreCertificateErrors) {
|
|
123
|
-
launchArgs.push('--ignore-certificate-errors');
|
|
124
|
-
}
|
|
125
|
-
if (disableIsolation) {
|
|
126
|
-
launchArgs.push('--disable-features=IsolateOrigins,site-per-process');
|
|
127
|
-
}
|
|
128
|
-
const maybeBrowser = await launchBrowserInstance(chromePath, launchArgs, tempBrowserPreferencesDirectory, false, credentials, {
|
|
129
|
-
runnerType,
|
|
130
|
-
loggerFunc,
|
|
131
|
-
});
|
|
132
|
-
if (!maybeBrowser) {
|
|
133
|
-
throw new Error('Unable to start Chrome session');
|
|
134
|
-
}
|
|
135
|
-
await setUpAuthTokenForExtension(maybeBrowser, accessToken);
|
|
136
|
-
maybeBrowser.on(browserLauncher_1.BrowserEvent.BrowserDestroyed, () => removeTempBrowserPreferencesDirectory(tempBrowserPreferencesDirectory));
|
|
137
|
-
return maybeBrowser;
|
|
138
|
-
}
|
|
139
|
-
exports.createBrowserWithAuthedExtension = createBrowserWithAuthedExtension;
|
|
140
108
|
async function launchBrowserInstance(chromePath, launchArgs, userDataDir, headless, credentials, options) {
|
|
141
109
|
var _a;
|
|
142
110
|
const { bypassContentSecurityPolicy, defaultDeviceDescriptor, disableFocusEmulation, extraHttpHeaders, ignoreDefaultArgs, runnerType, loggerFunc, userAgent, } = options || {};
|
|
@@ -312,15 +280,6 @@ async function createBrowserForExecutionEngine(browserWidth, browserHeight, head
|
|
|
312
280
|
return maybeBrowser;
|
|
313
281
|
}
|
|
314
282
|
exports.createBrowserForExecutionEngine = createBrowserForExecutionEngine;
|
|
315
|
-
async function setUpAuthTokenForExtension(browser, accessToken) {
|
|
316
|
-
const backgroundPage = await browser.getExtensionBackgroundPage((0, trainerUtil_1.getTrainerId)());
|
|
317
|
-
await backgroundPage.evaluate((token) => {
|
|
318
|
-
localStorage.setItem('authResult', JSON.stringify({ idToken: token }));
|
|
319
|
-
localStorage.setItem('trainerWorld', 'mablCLI');
|
|
320
|
-
}, accessToken);
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
|
-
exports.setUpAuthTokenForExtension = setUpAuthTokenForExtension;
|
|
324
283
|
async function getExtensionBackgroundPageWithCliTool(browser) {
|
|
325
284
|
const backgroundPage = await browser.getExtensionBackgroundPage((0, trainerUtil_1.getTrainerId)());
|
|
326
285
|
if (backgroundPage) {
|
|
@@ -634,28 +593,31 @@ function validateRunCommandWithLabels(testId, suppliedLabelsInclude, suppliedLab
|
|
|
634
593
|
}
|
|
635
594
|
exports.validateRunCommandWithLabels = validateRunCommandWithLabels;
|
|
636
595
|
async function pullDownTestRunConfig(testRunId, apiClient) {
|
|
637
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
596
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
638
597
|
const journeyRun = await apiClient.getTestRun(testRunId);
|
|
639
598
|
const planRun = await apiClient.getPlanRun(journeyRun.parent_execution);
|
|
640
599
|
return {
|
|
641
|
-
|
|
600
|
+
basicAuthCredentialsId: ((_a = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _a === void 0 ? void 0 : _a.http_auth_credentials_required)
|
|
601
|
+
? (_b = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _b === void 0 ? void 0 : _b.http_auth_credentials_id
|
|
602
|
+
: undefined,
|
|
642
603
|
branchName: (_c = journeyRun.journey_parameters) === null || _c === void 0 ? void 0 : _c.source_control_tag,
|
|
643
|
-
credentialsId: (_d = planRun.run_policy) === null || _d === void 0 ? void 0 : _d.
|
|
644
|
-
|
|
645
|
-
testId: (_e = journeyRun.journey) === null || _e === void 0 ? void 0 : _e.invariant_id,
|
|
646
|
-
url: (_g = (_f = journeyRun.journey_parameters) === null || _f === void 0 ? void 0 : _f.deployment) === null || _g === void 0 ? void 0 : _g.uri,
|
|
647
|
-
basicAuthCredentialsId: ((_h = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _h === void 0 ? void 0 : _h.http_auth_credentials_required)
|
|
648
|
-
? (_j = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _j === void 0 ? void 0 : _j.http_auth_credentials_id
|
|
604
|
+
credentialsId: ((_d = planRun.run_policy) === null || _d === void 0 ? void 0 : _d.credentials_required)
|
|
605
|
+
? (_e = planRun.run_policy) === null || _e === void 0 ? void 0 : _e.credentials_id
|
|
649
606
|
: undefined,
|
|
650
|
-
dataTableVariables: (
|
|
651
|
-
deviceEmulation: (
|
|
607
|
+
dataTableVariables: (_f = journeyRun.journey_parameters) === null || _f === void 0 ? void 0 : _f.user_variables,
|
|
608
|
+
deviceEmulation: (_g = journeyRun.journey_parameters) === null || _g === void 0 ? void 0 : _g.device_emulation,
|
|
609
|
+
environmentId: (_j = (_h = journeyRun.journey_parameters) === null || _h === void 0 ? void 0 : _h.deployment) === null || _j === void 0 ? void 0 : _j.environment_id,
|
|
610
|
+
filterHttpRequests: false,
|
|
611
|
+
journeyUserDefinedVariables: (_l = (_k = journeyRun.journey) === null || _k === void 0 ? void 0 : _k.variables) === null || _l === void 0 ? void 0 : _l.inputs,
|
|
652
612
|
importedVariables: (_m = journeyRun.journey_parameters) === null || _m === void 0 ? void 0 : _m.imported_variables,
|
|
653
613
|
pageLoadWait: (_o = journeyRun.journey_parameters) === null || _o === void 0 ? void 0 : _o.page_load_wait,
|
|
614
|
+
testId: (_p = journeyRun.journey) === null || _p === void 0 ? void 0 : _p.invariant_id,
|
|
615
|
+
url: (_r = (_q = journeyRun.journey_parameters) === null || _q === void 0 ? void 0 : _q.deployment) === null || _r === void 0 ? void 0 : _r.uri,
|
|
654
616
|
};
|
|
655
617
|
}
|
|
656
618
|
exports.pullDownTestRunConfig = pullDownTestRunConfig;
|
|
657
619
|
async function extractTestRunConfig(executionMessage, apiClient) {
|
|
658
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
620
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
659
621
|
const journeyRun = (_a = executionMessage.journey_run) !== null && _a !== void 0 ? _a : (await apiClient.getTestRun(executionMessage.journey_run_id));
|
|
660
622
|
const planRun = executionMessage.plan_run;
|
|
661
623
|
const maybeRunnerType = ((_b = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _b === void 0 ? void 0 : _b.nodejs_runtime_variant)
|
|
@@ -663,17 +625,20 @@ async function extractTestRunConfig(executionMessage, apiClient) {
|
|
|
663
625
|
(_c = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _c === void 0 ? void 0 : _c.nodejs_runtime_variant
|
|
664
626
|
: undefined;
|
|
665
627
|
return {
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
628
|
+
branchName: (_d = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _d === void 0 ? void 0 : _d.source_control_tag,
|
|
629
|
+
credentialsId: ((_e = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _e === void 0 ? void 0 : _e.credentials_required)
|
|
630
|
+
? (_f = planRun === null || planRun === void 0 ? void 0 : planRun.run_policy) === null || _f === void 0 ? void 0 : _f.credentials_id
|
|
631
|
+
: undefined,
|
|
632
|
+
dataTableVariables: (_g = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _g === void 0 ? void 0 : _g.user_variables,
|
|
633
|
+
deviceEmulation: (_h = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _h === void 0 ? void 0 : _h.device_emulation,
|
|
634
|
+
environmentId: (_k = (_j = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _j === void 0 ? void 0 : _j.deployment) === null || _k === void 0 ? void 0 : _k.environment_id,
|
|
669
635
|
filterHttpRequests: true,
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
dataTableVariables: (_l = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _l === void 0 ? void 0 : _l.user_variables,
|
|
673
|
-
deviceEmulation: (_m = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _m === void 0 ? void 0 : _m.device_emulation,
|
|
674
|
-
importedVariables: (_o = journeyRun.journey_parameters) === null || _o === void 0 ? void 0 : _o.imported_variables,
|
|
636
|
+
importedVariables: (_l = journeyRun.journey_parameters) === null || _l === void 0 ? void 0 : _l.imported_variables,
|
|
637
|
+
journeyUserDefinedVariables: (_o = (_m = journeyRun.journey) === null || _m === void 0 ? void 0 : _m.variables) === null || _o === void 0 ? void 0 : _o.inputs,
|
|
675
638
|
pageLoadWait: (_p = journeyRun.journey_parameters) === null || _p === void 0 ? void 0 : _p.page_load_wait,
|
|
676
639
|
runnerType: maybeRunnerType,
|
|
640
|
+
testId: (_q = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey) === null || _q === void 0 ? void 0 : _q.invariant_id,
|
|
641
|
+
url: (_s = (_r = journeyRun === null || journeyRun === void 0 ? void 0 : journeyRun.journey_parameters) === null || _r === void 0 ? void 0 : _r.deployment) === null || _s === void 0 ? void 0 : _s.uri,
|
|
677
642
|
};
|
|
678
643
|
}
|
|
679
644
|
exports.extractTestRunConfig = extractTestRunConfig;
|
|
@@ -186,27 +186,27 @@ async function run(parsed) {
|
|
|
186
186
|
});
|
|
187
187
|
const testRunnerConfig = {
|
|
188
188
|
_cliCreated: true,
|
|
189
|
-
branchName: parsed['mabl-branch'],
|
|
190
189
|
basicAuthCredentialsId: parsed[constants_1.CommandArgBasicAuthCredentials],
|
|
190
|
+
branchName: parsed['mabl-branch'],
|
|
191
191
|
credentialsId: parsed['credentials-id'],
|
|
192
192
|
disableIsolation: parsed[constants_1.CommandArgBrowserDisableIsolation],
|
|
193
|
+
enableExtensions: parsed[constants_1.CommandArgBrowserEnableExtensions],
|
|
193
194
|
enableLink: parsed[constants_1.CommandArgEnableLink],
|
|
194
195
|
environmentId: parsed[constants_1.CommandArgEnvironmentId],
|
|
196
|
+
extraHttpHeaders,
|
|
195
197
|
filterHttpRequests: false,
|
|
198
|
+
fromPlanId: parsed['from-plan-id'],
|
|
196
199
|
headless: parsed.headless,
|
|
197
200
|
height: parsed.height,
|
|
198
201
|
highlights: parsed.highlights,
|
|
199
202
|
ignoreCertificateErrors: parsed[constants_1.CommandArgBrowserIgnoreCertificateErrors],
|
|
200
203
|
interactionSpeed: parsed[constants_1.CommandArgTestInteractionSpeed],
|
|
201
|
-
enableExtensions: parsed[constants_1.CommandArgBrowserEnableExtensions],
|
|
202
|
-
extraHttpHeaders,
|
|
203
204
|
keepBrowserOpen: parsed['keep-browser-open'],
|
|
204
205
|
labelsExclude: parsed['exclude-labels'],
|
|
205
206
|
labelsInclude: parsed.labels,
|
|
206
|
-
fromPlanId: parsed['from-plan-id'],
|
|
207
|
-
testId: parsed.id,
|
|
208
|
-
testFile: parsed[constants_1.CommandArgTestFile],
|
|
209
207
|
runId: parsed['run-id'],
|
|
208
|
+
testFile: parsed[constants_1.CommandArgTestFile],
|
|
209
|
+
testId: parsed.id,
|
|
210
210
|
url: parsed.url,
|
|
211
211
|
userAgent: parsed[constants_1.CommandArgUserAgent],
|
|
212
212
|
width: parsed.width,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTrainerId = exports.LOCAL_TRAINER_ID = void 0;
|
|
4
|
+
const env_1 = require("../../../env/env");
|
|
5
|
+
exports.LOCAL_TRAINER_ID = 'jmeffipchlcmnkllcolcbmneknjckcpp';
|
|
6
|
+
function getTrainerId() {
|
|
7
|
+
if (env_1.LOCAL_TRAINER_PATH) {
|
|
8
|
+
return env_1.EXTENSION_ID;
|
|
9
|
+
}
|
|
10
|
+
return exports.LOCAL_TRAINER_ID;
|
|
11
|
+
}
|
|
12
|
+
exports.getTrainerId = getTrainerId;
|