@applitools/spec-driver-webdriver 1.0.31 → 1.0.32

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.
@@ -30,7 +30,8 @@ exports.build = exports.switchWorld = exports.getWorlds = exports.getCurrentWorl
30
30
  const url_1 = require("url");
31
31
  const utils = __importStar(require("@applitools/utils"));
32
32
  const webdriver_1 = __importStar(require("webdriver"));
33
- const proxy_agent_1 = __importDefault(require("proxy-agent"));
33
+ const http_proxy_agent_1 = __importDefault(require("http-proxy-agent"));
34
+ const https_proxy_agent_1 = __importDefault(require("https-proxy-agent"));
34
35
  const http_1 = __importDefault(require("http"));
35
36
  const https_1 = __importDefault(require("https"));
36
37
  // #region HELPERS
@@ -103,7 +104,7 @@ function isSelector(selector) {
103
104
  }
104
105
  exports.isSelector = isSelector;
105
106
  function transformDriver(driver) {
106
- var _a;
107
+ var _a, _b, _c;
107
108
  if (!utils.types.has(driver, ['sessionId', 'serverUrl']))
108
109
  return driver;
109
110
  const url = new URL(driver.serverUrl);
@@ -119,17 +120,21 @@ function transformDriver(driver) {
119
120
  ...environment,
120
121
  };
121
122
  if ((_a = driver.proxy) === null || _a === void 0 ? void 0 : _a.url) {
122
- const agent = new proxy_agent_1.default({ ...(0, url_1.parse)(driver.proxy.url), rejectUnauthorized: false });
123
- agent.callback = utils.general.wrap(agent.callback.bind(agent), (fn, request, options, ...rest) => {
123
+ const proxyUrl = new URL(driver.proxy.url);
124
+ proxyUrl.username = (_b = driver.proxy.username) !== null && _b !== void 0 ? _b : proxyUrl.username;
125
+ proxyUrl.password = (_c = driver.proxy.password) !== null && _c !== void 0 ? _c : proxyUrl.password;
126
+ const proxyOptions = { ...(0, url_1.parse)(proxyUrl.href), rejectUnauthorized: false };
127
+ const httpAgent = (0, http_proxy_agent_1.default)(proxyOptions);
128
+ const httpsAgent = (0, https_proxy_agent_1.default)(proxyOptions);
129
+ httpsAgent.callback = utils.general.wrap(httpsAgent.callback.bind(httpsAgent), (fn, request, options, ...rest) => {
124
130
  return fn(request, { ...options, rejectUnauthorized: false }, ...rest);
125
131
  });
126
- options.agent = { http: agent, https: agent };
132
+ options.agent = { http: httpAgent, https: httpsAgent };
127
133
  }
128
134
  else {
129
- const httpsAgent = new https_1.default.Agent({
130
- rejectUnauthorized: false,
131
- });
132
- options.agent = { http: http_1.default.globalAgent, https: httpsAgent };
135
+ const httpAgent = http_1.default.globalAgent;
136
+ const httpsAgent = new https_1.default.Agent({ rejectUnauthorized: false });
137
+ options.agent = { http: httpAgent, https: httpsAgent };
133
138
  }
134
139
  if (!options.port) {
135
140
  if (options.protocol === 'http')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/spec-driver-webdriver",
3
- "version": "1.0.31",
3
+ "version": "1.0.32",
4
4
  "keywords": [
5
5
  "webdriver",
6
6
  "chrome devtools protocol",
@@ -61,15 +61,16 @@
61
61
  "postversion": "bongo postversion"
62
62
  },
63
63
  "dependencies": {
64
- "@applitools/driver": "1.11.51",
65
- "@applitools/utils": "1.3.36",
66
- "proxy-agent": "5.0.0"
64
+ "@applitools/driver": "1.12.0",
65
+ "@applitools/utils": "1.3.37",
66
+ "http-proxy-agent": "5.0.0",
67
+ "https-proxy-agent": "5.0.1"
67
68
  },
68
69
  "devDependencies": {
69
70
  "@applitools/api-extractor": "1.2.21",
70
- "@applitools/bongo": "^3.0.3",
71
- "@applitools/test-server": "^1.2.0",
72
- "@applitools/test-utils": "1.5.16",
71
+ "@applitools/bongo": "^3.0.4",
72
+ "@applitools/test-server": "^1.2.1",
73
+ "@applitools/test-utils": "1.5.17",
73
74
  "@types/node": "^12.20.55",
74
75
  "nock": "^13.2.9",
75
76
  "webdriver": "^7.27.0"
package/types/index.d.ts CHANGED
@@ -69,5 +69,5 @@ export type Selector = {
69
69
  __applitoolsBrand?: undefined;
70
70
  };
71
71
  export type SpecType = { driver: Driver; context: Driver; element: Element; selector: Selector; };
72
- export type StaticDriver = { sessionId: string; serverUrl: string; capabilities: Record<string, any>; proxy?: undefined | { url: string; }; };
72
+ export type StaticDriver = { sessionId: string; serverUrl: string; capabilities: Record<string, any>; proxy?: undefined | { url: string; username?: undefined | string; password?: undefined | string; }; };
73
73
  export type StaticElement = { elementId: string; };