@mablhq/mabl-cli 1.21.7 → 1.21.15
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/mablApiClientFactory.js +3 -3
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +1 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +4 -0
- package/commands/config/config_cmds/configKeys.js +12 -1
- package/commands/config/config_cmds/set.js +6 -0
- package/commands/flows/flows_cmds/export.js +1 -1
- package/commands/tests/testsUtil.js +15 -2
- package/commands/tests/tests_cmds/export.js +1 -1
- package/execution/index.js +1 -1
- package/package.json +1 -1
- package/providers/authenticationProvider.js +1 -1
- package/providers/cliConfigProvider.js +20 -8
- package/util/httpUtil.js +3 -2
|
@@ -32,8 +32,8 @@ class MablApiClientFactory {
|
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
static async createApiClient(opts) {
|
|
35
|
-
const { proxyHost, sslVerify } = (await cliConfigProvider_1.CliConfigProvider.getCliConfig())
|
|
36
|
-
.
|
|
35
|
+
const { proxyHost, sslVerify } = (await cliConfigProvider_1.CliConfigProvider.getCliConfig()).http
|
|
36
|
+
.mabl;
|
|
37
37
|
const optsFromCliHttpConfig = {
|
|
38
38
|
proxyUrl: proxyHost,
|
|
39
39
|
sslVerify,
|
|
@@ -62,7 +62,7 @@ class MablApiClientFactory {
|
|
|
62
62
|
return MablApiClientFactory.createApiClient();
|
|
63
63
|
}
|
|
64
64
|
static async createApiClientForAccessToken(accessToken) {
|
|
65
|
-
const httpConfig = (await cliConfigProvider_1.CliConfigProvider.getCliConfig()).http;
|
|
65
|
+
const httpConfig = (await cliConfigProvider_1.CliConfigProvider.getCliConfig()).http.mabl;
|
|
66
66
|
return new mablApiClient_1.MablApiClient({
|
|
67
67
|
authType: types_1.AuthType.Bearer,
|
|
68
68
|
token: accessToken,
|
|
@@ -32,6 +32,7 @@ class PlaywrightBrowserLauncher {
|
|
|
32
32
|
ignoreDefaultArgs: options.ignoreDefaultArgs,
|
|
33
33
|
ignoreHTTPSErrors: true,
|
|
34
34
|
isMobile: (_c = options.defaultDeviceDescriptor) === null || _c === void 0 ? void 0 : _c.isMobile,
|
|
35
|
+
proxy: options.proxy,
|
|
35
36
|
timeout: BROWSER_LAUNCH_TIMEOUT_MS,
|
|
36
37
|
userAgent: options.userAgent,
|
|
37
38
|
viewport,
|
|
@@ -196,5 +196,9 @@ class PlaywrightFrame extends browserLauncher_1.Frame {
|
|
|
196
196
|
}
|
|
197
197
|
return true;
|
|
198
198
|
}
|
|
199
|
+
async getInjectedScriptInSecondaryWorld() {
|
|
200
|
+
const context = await this.getFrameImpl()._utilityContext();
|
|
201
|
+
return new playwrightDom_1.PlaywrightJsHandle(await context.injectedScript(), this.page());
|
|
202
|
+
}
|
|
199
203
|
}
|
|
200
204
|
exports.PlaywrightFrame = PlaywrightFrame;
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validConfigKeyChoices = exports.configKeys = void 0;
|
|
3
|
+
exports.isValidProxyMode = exports.proxyModes = exports.validConfigKeyChoices = exports.configKeys = void 0;
|
|
4
4
|
exports.configKeys = Object.freeze({
|
|
5
5
|
browserPath: 'browser.path',
|
|
6
6
|
enableSourceControlMetadataCollection: 'alpha.scm_metadata.enable',
|
|
7
7
|
defaultWorkspaceId: 'workspace',
|
|
8
8
|
proxy: 'http.proxy',
|
|
9
9
|
sslVerify: 'http.sslVerify',
|
|
10
|
+
proxyMode: 'http.proxyMode',
|
|
10
11
|
});
|
|
11
12
|
exports.validConfigKeyChoices = Object.values(exports.configKeys);
|
|
13
|
+
exports.proxyModes = [
|
|
14
|
+
'mabl',
|
|
15
|
+
'test',
|
|
16
|
+
'all',
|
|
17
|
+
'none',
|
|
18
|
+
];
|
|
19
|
+
function isValidProxyMode(value) {
|
|
20
|
+
return exports.proxyModes.indexOf(value) !== -1;
|
|
21
|
+
}
|
|
22
|
+
exports.isValidProxyMode = isValidProxyMode;
|
|
@@ -49,6 +49,12 @@ async function setConfig(parsed) {
|
|
|
49
49
|
}
|
|
50
50
|
await cliConfigProvider_1.CliConfigProvider.setConfigProperty(key, value);
|
|
51
51
|
break;
|
|
52
|
+
case configKeys_1.configKeys.proxyMode:
|
|
53
|
+
if (!(0, configKeys_1.isValidProxyMode)(value)) {
|
|
54
|
+
throw new Error(`Invalid proxy mode. The value must be one of ${JSON.stringify(configKeys_1.proxyModes)}`);
|
|
55
|
+
}
|
|
56
|
+
await cliConfigProvider_1.CliConfigProvider.setConfigProperty(key, value);
|
|
57
|
+
break;
|
|
52
58
|
default:
|
|
53
59
|
throw new Error(`<${exports.configKeyCommandArg}> value not one of supported types: ${JSON.stringify(configKeys_1.validConfigKeyChoices)}`);
|
|
54
60
|
}
|
|
@@ -40,7 +40,7 @@ async function pullFlow(parsed) {
|
|
|
40
40
|
const flowId = parsed.id;
|
|
41
41
|
const format = parsed.format;
|
|
42
42
|
const detailLevel = parsed[constants_1.CommandArgDetailLevel];
|
|
43
|
-
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.
|
|
43
|
+
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
44
44
|
const branchName = (_a = parsed['mabl-branch']) !== null && _a !== void 0 ? _a : constants_1.DefaultBranchName;
|
|
45
45
|
const flow = await apiClient.getFlow(flowId, branchName);
|
|
46
46
|
switch (format) {
|
|
@@ -138,8 +138,17 @@ async function createBrowserWithAuthedExtension(accessToken, browserWidth, brows
|
|
|
138
138
|
}
|
|
139
139
|
exports.createBrowserWithAuthedExtension = createBrowserWithAuthedExtension;
|
|
140
140
|
async function launchBrowserInstance(chromePath, launchArgs, userDataDir, headless, credentials, options) {
|
|
141
|
+
var _a;
|
|
141
142
|
const { bypassContentSecurityPolicy, defaultDeviceDescriptor, disableFocusEmulation, extraHttpHeaders, ignoreDefaultArgs, runnerType, loggerFunc, userAgent, } = options || {};
|
|
142
143
|
let browser;
|
|
144
|
+
const proxyServer = (_a = (await cliConfigProvider_1.CliConfigProvider.getCliConfig()).http.test
|
|
145
|
+
.proxyHost) === null || _a === void 0 ? void 0 : _a.href;
|
|
146
|
+
let proxy;
|
|
147
|
+
if (proxyServer) {
|
|
148
|
+
proxy = {
|
|
149
|
+
server: proxyServer,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
143
152
|
try {
|
|
144
153
|
browser = await maybeLaunchBrowser(chromePath, launchArgs, userDataDir, headless, credentials, {
|
|
145
154
|
bypassContentSecurityPolicy,
|
|
@@ -149,6 +158,7 @@ async function launchBrowserInstance(chromePath, launchArgs, userDataDir, headle
|
|
|
149
158
|
ignoreDefaultArgs,
|
|
150
159
|
runnerType,
|
|
151
160
|
loggerFunc,
|
|
161
|
+
proxy,
|
|
152
162
|
userAgent,
|
|
153
163
|
});
|
|
154
164
|
}
|
|
@@ -160,6 +170,7 @@ async function launchBrowserInstance(chromePath, launchArgs, userDataDir, headle
|
|
|
160
170
|
bypassContentSecurityPolicy,
|
|
161
171
|
defaultDeviceDescriptor,
|
|
162
172
|
ignoreDefaultArgs,
|
|
173
|
+
proxy,
|
|
163
174
|
runnerType,
|
|
164
175
|
}).catch((error) => {
|
|
165
176
|
messaging_1.mablEventEmitter.log('Browser launch failed', Date.now(), logLineMessaging_1.LogLineColor.red);
|
|
@@ -172,7 +183,7 @@ async function launchBrowserInstance(chromePath, launchArgs, userDataDir, headle
|
|
|
172
183
|
return browser;
|
|
173
184
|
}
|
|
174
185
|
function maybeLaunchBrowser(chromePath, launchArgs, userDataDir, headless, credentials, options) {
|
|
175
|
-
const { bypassContentSecurityPolicy, defaultDeviceDescriptor, disableFocusEmulation, extraHttpHeaders, ignoreDefaultArgs, runnerType, loggerFunc, userAgent, } = options || {};
|
|
186
|
+
const { bypassContentSecurityPolicy, defaultDeviceDescriptor, disableFocusEmulation, extraHttpHeaders, ignoreDefaultArgs, runnerType, loggerFunc, proxy, userAgent, } = options || {};
|
|
176
187
|
return browserLauncher_1.BrowserLauncherFactory.createRunner(runnerType, loggerFunc).launch({
|
|
177
188
|
bypassContentSecurityPolicy,
|
|
178
189
|
defaultDeviceDescriptor,
|
|
@@ -185,6 +196,7 @@ function maybeLaunchBrowser(chromePath, launchArgs, userDataDir, headless, crede
|
|
|
185
196
|
userDataDir,
|
|
186
197
|
downloadPath: createDownloadDirectory(),
|
|
187
198
|
credentials,
|
|
199
|
+
proxy,
|
|
188
200
|
userAgent,
|
|
189
201
|
});
|
|
190
202
|
}
|
|
@@ -210,7 +222,7 @@ function removeTempBrowserPreferencesDirectory(tempDirPath) {
|
|
|
210
222
|
}
|
|
211
223
|
}
|
|
212
224
|
async function createBrowser(browserWidth, browserHeight, headless, containerTesting, tempBrowserPreferencesDirectory, options) {
|
|
213
|
-
const { bypassContentSecurityPolicy, credentials, browserPath, disableFocusEmulation, disableIsolation, extraHttpHeaders, ignoreCertificateErrors, emulationConfig, enableExtensions, runnerType, loggerFunc, resourcesDirectoryOverride, userAgent, } = options || {};
|
|
225
|
+
const { bypassContentSecurityPolicy, credentials, browserPath, disableFocusEmulation, disableIsolation, extraHttpHeaders, ignoreCertificateErrors, emulationConfig, enableExtensions, runnerType, loggerFunc, resourcesDirectoryOverride, proxy, userAgent, } = options || {};
|
|
214
226
|
const chromePath = browserPath !== null && browserPath !== void 0 ? browserPath : (await findChrome());
|
|
215
227
|
if (!chromePath.length) {
|
|
216
228
|
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'));
|
|
@@ -241,6 +253,7 @@ async function createBrowser(browserWidth, browserHeight, headless, containerTes
|
|
|
241
253
|
ignoreDefaultArgs,
|
|
242
254
|
runnerType,
|
|
243
255
|
loggerFunc,
|
|
256
|
+
proxy,
|
|
244
257
|
userAgent: userAgent !== null && userAgent !== void 0 ? userAgent : emulationConfig === null || emulationConfig === void 0 ? void 0 : emulationConfig.device_config.user_agent,
|
|
245
258
|
});
|
|
246
259
|
if (!maybeBrowser) {
|
|
@@ -49,7 +49,7 @@ async function pullJourney(parsed) {
|
|
|
49
49
|
const testId = parsed.id;
|
|
50
50
|
const format = parsed.format;
|
|
51
51
|
const detailLevel = parsed[constants_1.CommandArgDetailLevel];
|
|
52
|
-
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.
|
|
52
|
+
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
53
53
|
const branchName = (_a = parsed['mabl-branch']) !== null && _a !== void 0 ? _a : constants_1.DefaultBranchName;
|
|
54
54
|
const journey = await apiClient.getJourney(testId, branchName, format);
|
|
55
55
|
const flowArray = await (0, util_1.getJourneyFlowArray)(journey, apiClient, branchName);
|