@applitools/spec-driver-webdriver 1.1.26 → 1.2.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.2.1](https://github.com/Applitools-Dev/sdk/compare/js/spec-driver-webdriver@1.2.0...js/spec-driver-webdriver@1.2.1) (2025-03-30)
4
+
5
+
6
+ ### Dependencies
7
+
8
+ * @applitools/utils bumped to 1.8.0
9
+ #### Features
10
+
11
+ * allow sending callback functions to waitBeforeCapture ([#2780](https://github.com/Applitools-Dev/sdk/issues/2780)) ([4caa2e8](https://github.com/Applitools-Dev/sdk/commit/4caa2e8ae055d3dd48164eeceaa4c691eeadcdd4))
12
+ * @applitools/logger bumped to 2.1.2
13
+
14
+ * @applitools/driver bumped to 1.21.0
15
+ #### Features
16
+
17
+ * allow sending callback functions to waitBeforeCapture ([#2780](https://github.com/Applitools-Dev/sdk/issues/2780)) ([4caa2e8](https://github.com/Applitools-Dev/sdk/commit/4caa2e8ae055d3dd48164eeceaa4c691eeadcdd4))
18
+
19
+
20
+
21
+
22
+ ## [1.2.0](https://github.com/Applitools-Dev/sdk/compare/js/spec-driver-webdriver@1.1.26...js/spec-driver-webdriver@1.2.0) (2025-03-13)
23
+
24
+
25
+ ### Features
26
+
27
+ * support HTTPS_PROXY and HTTP_PROXY environment variables ([#2795](https://github.com/Applitools-Dev/sdk/issues/2795)) ([226ae08](https://github.com/Applitools-Dev/sdk/commit/226ae08627381a1212df8b938c6576e82c777914))
28
+
3
29
  ## [1.1.26](https://github.com/Applitools-Dev/sdk/compare/js/spec-driver-webdriver@1.1.25...js/spec-driver-webdriver@1.1.26) (2025-02-26)
4
30
 
5
31
 
@@ -94,6 +94,16 @@ function getFrameworkMajorVersion() {
94
94
  function getWebDriver() {
95
95
  return getFrameworkMajorVersion() < 8 ? require('webdriver').default : require('webdriver');
96
96
  }
97
+ function getAgents(httpUrl, httpsUrl) {
98
+ const httpProxyOptions = { ...(0, url_1.parse)(httpUrl.href), rejectUnauthorized: false };
99
+ const httpAgent = (0, http_proxy_agent_1.default)(httpProxyOptions);
100
+ const httpsProxyOptions = { ...(0, url_1.parse)(httpsUrl.href), rejectUnauthorized: false };
101
+ const httpsAgent = (0, https_proxy_agent_1.default)(httpsProxyOptions);
102
+ httpsAgent.callback = utils.general.wrap(httpsAgent.callback.bind(httpsAgent), (fn, request, options, ...rest) => {
103
+ return fn(request, { ...options, rejectUnauthorized: false }, ...rest);
104
+ });
105
+ return { httpAgent, httpsAgent };
106
+ }
97
107
  function isDriver(driver) {
98
108
  if (!driver)
99
109
  return false;
@@ -146,7 +156,7 @@ function isStaleElementError(error) {
146
156
  }
147
157
  exports.isStaleElementError = isStaleElementError;
148
158
  function toDriver(driver) {
149
- var _a, _b, _c;
159
+ var _a, _b, _c, _d, _e;
150
160
  let transformedDriver;
151
161
  if (utils.types.has(driver, ['sessionId', 'serverUrl'])) {
152
162
  const url = new URL(driver.serverUrl);
@@ -171,12 +181,14 @@ function toDriver(driver) {
171
181
  const proxyUrl = new URL(driver.proxy.url);
172
182
  proxyUrl.username = (_b = driver.proxy.username) !== null && _b !== void 0 ? _b : proxyUrl.username;
173
183
  proxyUrl.password = (_c = driver.proxy.password) !== null && _c !== void 0 ? _c : proxyUrl.password;
174
- const proxyOptions = { ...(0, url_1.parse)(proxyUrl.href), rejectUnauthorized: false };
175
- const httpAgent = (0, http_proxy_agent_1.default)(proxyOptions);
176
- const httpsAgent = (0, https_proxy_agent_1.default)(proxyOptions);
177
- httpsAgent.callback = utils.general.wrap(httpsAgent.callback.bind(httpsAgent), (fn, request, options, ...rest) => {
178
- return fn(request, { ...options, rejectUnauthorized: false }, ...rest);
179
- });
184
+ const { httpAgent, httpsAgent } = getAgents(proxyUrl, proxyUrl);
185
+ options.agent = { http: httpAgent, https: httpsAgent };
186
+ }
187
+ else if (process.env.HTTP_PROXY || process.env.HTTPS_PROXY) {
188
+ // these could be different but if not set as same
189
+ const httpUrl = new URL(((_d = process.env.HTTP_PROXY) !== null && _d !== void 0 ? _d : process.env.HTTPS_PROXY));
190
+ const httpsUrl = new URL(((_e = process.env.HTTPS_PROXY) !== null && _e !== void 0 ? _e : process.env.HTTP_PROXY));
191
+ const { httpAgent, httpsAgent } = getAgents(httpUrl, httpsUrl);
180
192
  options.agent = { http: httpAgent, https: httpsAgent };
181
193
  }
182
194
  else {
@@ -483,6 +495,7 @@ const browserOptionsNames = {
483
495
  * installed in the SDK, then this function will error.
484
496
  */
485
497
  async function build(env) {
498
+ var _a, _b;
486
499
  const WebDriver = getWebDriver();
487
500
  const parseEnv = require('@applitools/test-utils/src/parse-env');
488
501
  const { browser = '', capabilities, url, proxy, configurable = true, args = [], headless, logLevel = 'silent', } = parseEnv(env);
@@ -518,7 +531,15 @@ async function build(env) {
518
531
  noProxy: proxy.bypass.join(','),
519
532
  };
520
533
  }
521
- options.agent = { https: require('https').Agent({ rejectUnauthorized: false }) };
534
+ if (process.env.HTTP_PROXY || process.env.HTTPS_PROXY) {
535
+ const httpUrl = new URL(((_a = process.env.HTTP_PROXY) !== null && _a !== void 0 ? _a : process.env.HTTPS_PROXY));
536
+ const httpsUrl = new URL(((_b = process.env.HTTPS_PROXY) !== null && _b !== void 0 ? _b : process.env.HTTP_PROXY));
537
+ const { httpAgent, httpsAgent } = getAgents(httpUrl, httpsUrl);
538
+ options.agent = { http: httpAgent, https: httpsAgent };
539
+ }
540
+ else {
541
+ options.agent = { https: require('https').Agent({ rejectUnauthorized: false }) };
542
+ }
522
543
  const driver = await WebDriver.newSession(options);
523
544
  return [driver, () => driver.deleteSession()];
524
545
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/spec-driver-webdriver",
3
- "version": "1.1.26",
3
+ "version": "1.2.1",
4
4
  "keywords": [
5
5
  "webdriver",
6
6
  "chrome devtools protocol",
@@ -49,8 +49,8 @@
49
49
  "up:framework": "echo \"$(jq '.devDependencies.webdriver = $ENV.APPLITOOLS_FRAMEWORK_VERSION' ./package.json)\" > ./package.json"
50
50
  },
51
51
  "dependencies": {
52
- "@applitools/driver": "1.20.5",
53
- "@applitools/utils": "1.7.8",
52
+ "@applitools/driver": "1.21.0",
53
+ "@applitools/utils": "1.8.0",
54
54
  "http-proxy-agent": "5.0.0",
55
55
  "https-proxy-agent": "5.0.1"
56
56
  },
package/types/index.d.ts CHANGED
@@ -73,6 +73,7 @@ export type SecondarySpecType = {
73
73
  element: StaticElement;
74
74
  selector: never;
75
75
  secondary: never;
76
+ userFunction: unknown;
76
77
  };
77
78
  export type Driver<TOriginalDriver = unknown> = import('webdriver').Client & { original: TOriginalDriver; } & { __applitoolsBrand?: undefined; };
78
79
  export type Element = ({ 'element-6066-11e4-a52e-4f735466cecf': string; } | { ELEMENT: string; }) & { __applitoolsBrand?: undefined; };
@@ -91,5 +92,6 @@ export type PrimarySpecType = {
91
92
  element: Element;
92
93
  selector: Selector;
93
94
  secondary: SecondarySpecType;
95
+ userFunction: unknown;
94
96
  };
95
97
  export type SpecDriver = import('@applitools/driver').SpecDriver<PrimarySpecType>;