@mablhq/mabl-cli 2.61.18 → 2.63.0

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.
@@ -103,6 +103,11 @@ class ChromiumBrowserEngine {
103
103
  else if (proxyInfo.socksProxy) {
104
104
  commandLineArgs.push(`--proxy-server=socks=${proxyInfo.socksProxy}`);
105
105
  }
106
+ else if (proxyInfo.httpProxy) {
107
+ const proxyUrl = new URL(proxyInfo.httpProxy);
108
+ const proxyAddress = `${proxyUrl.hostname}:${proxyUrl.port}`;
109
+ commandLineArgs.push(`--proxy-server=http=${proxyAddress};https=${proxyAddress}`);
110
+ }
106
111
  else {
107
112
  throw new Error('no proxy provided for cloud run');
108
113
  }
@@ -178,8 +183,16 @@ class ChromiumBrowserEngine {
178
183
  chrome.includes('beta'));
179
184
  })[0];
180
185
  }
181
- getProxySpec(_proxyInfo) {
182
- return;
186
+ getProxySpec(proxyInfo) {
187
+ const { httpProxy, socksProxy, excludeFromProxy } = proxyInfo;
188
+ const server = httpProxy ?? socksProxy;
189
+ if (!server) {
190
+ return;
191
+ }
192
+ const bypass = excludeFromProxy?.length
193
+ ? excludeFromProxy.join(',')
194
+ : undefined;
195
+ return { server, bypass };
183
196
  }
184
197
  }
185
198
  exports.ChromiumBrowserEngine = ChromiumBrowserEngine;
@@ -54,25 +54,40 @@ class FirefoxBrowserEngine {
54
54
  permissions: ['geolocation', 'notifications'],
55
55
  };
56
56
  }
57
- getExecutionEngineBrowserLaunchOptions(options, _proxyInfo) {
57
+ getExecutionEngineBrowserLaunchOptions(options, proxyInfo) {
58
+ if (Object.keys(this.getProxyPreferences(proxyInfo)).length === 0) {
59
+ throw new Error('no proxy provided for cloud run');
60
+ }
58
61
  return {
59
62
  commandLineArgs: [],
60
63
  defaultDeviceDescriptor: (0, mobileEmulationUtil_1.getDeviceDescriptorForEmulation)(options.emulationConfig),
61
64
  };
62
65
  }
63
- prepareBrowserPreferencesDirectory(_windowPlacement, proxyInfo) {
64
- const customPreferences = {};
66
+ getProxyPreferences(proxyInfo) {
67
+ const proxyPreferences = {};
65
68
  if (proxyInfo?.pacProxy) {
66
- customPreferences['network.proxy.autoconfig_url'] = proxyInfo.pacProxy;
67
- customPreferences['network.proxy.type'] = 2;
69
+ proxyPreferences['network.proxy.autoconfig_url'] = proxyInfo.pacProxy;
70
+ proxyPreferences['network.proxy.type'] = 2;
68
71
  }
69
72
  else if (proxyInfo?.socksProxy) {
70
73
  const socksUrl = new URL(proxyInfo.socksProxy);
71
- customPreferences['network.proxy.socks'] = socksUrl.hostname;
72
- customPreferences['network.proxy.socks_port'] = Number.parseInt(socksUrl.port);
73
- customPreferences['network.proxy.socks_version'] = 5;
74
- customPreferences['network.proxy.type'] = 1;
74
+ proxyPreferences['network.proxy.socks'] = socksUrl.hostname;
75
+ proxyPreferences['network.proxy.socks_port'] = Number.parseInt(socksUrl.port);
76
+ proxyPreferences['network.proxy.socks_version'] = 5;
77
+ proxyPreferences['network.proxy.type'] = 1;
78
+ }
79
+ else if (proxyInfo?.httpProxy) {
80
+ const proxyUrl = new URL(proxyInfo.httpProxy);
81
+ proxyPreferences['network.proxy.http'] = proxyUrl.hostname;
82
+ proxyPreferences['network.proxy.http_port'] = Number.parseInt(proxyUrl.port);
83
+ proxyPreferences['network.proxy.https_port'] = Number.parseInt(proxyUrl.port);
84
+ proxyPreferences['network.proxy.share_proxy_settings'] = true;
85
+ proxyPreferences['network.proxy.type'] = 1;
75
86
  }
87
+ return proxyPreferences;
88
+ }
89
+ prepareBrowserPreferencesDirectory(_windowPlacement, proxyInfo) {
90
+ const customPreferences = this.getProxyPreferences(proxyInfo);
76
91
  return (0, async_retry_1.default)(() => {
77
92
  const preferenceFileName = 'user.js';
78
93
  const tempBrowserPreferencesDirectory = (0, browserEngine_1.getTempBrowserPrefDirectory)(this.name());
@@ -137,8 +152,16 @@ class FirefoxBrowserEngine {
137
152
  'network.proxy.socks_remote_dns': true,
138
153
  };
139
154
  }
140
- getProxySpec(_proxyInfo) {
141
- return;
155
+ getProxySpec(proxyInfo) {
156
+ const { httpProxy, socksProxy, excludeFromProxy } = proxyInfo;
157
+ const server = httpProxy ?? socksProxy;
158
+ if (!server) {
159
+ return;
160
+ }
161
+ const bypass = excludeFromProxy?.length
162
+ ? excludeFromProxy.join(',')
163
+ : undefined;
164
+ return { server, bypass };
142
165
  }
143
166
  }
144
167
  exports.FirefoxBrowserEngine = FirefoxBrowserEngine;