webdriver 7.16.7 → 7.16.14

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.
@@ -1,4 +1,8 @@
1
1
  import type { Options } from '@wdio/types';
2
2
  export declare const DEFAULTS: Options.Definition<Required<Options.WebDriver>>;
3
3
  export declare const VALID_CAPS: string[];
4
+ export declare const REG_EXPS: {
5
+ commandName: RegExp;
6
+ execFn: RegExp;
7
+ };
4
8
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE1C,eAAO,MAAM,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAiJpE,CAAA;AAED,eAAO,MAAM,UAAU,UAItB,CAAA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE1C,eAAO,MAAM,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CA0IpE,CAAA;AAED,eAAO,MAAM,UAAU,UAItB,CAAA;AAED,eAAO,MAAM,QAAQ;;;CAGpB,CAAA"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VALID_CAPS = exports.DEFAULTS = void 0;
3
+ exports.REG_EXPS = exports.VALID_CAPS = exports.DEFAULTS = void 0;
4
4
  exports.DEFAULTS = {
5
5
  /**
6
6
  * protocol of automation driver
@@ -124,18 +124,11 @@ exports.DEFAULTS = {
124
124
  },
125
125
  /**
126
126
  * Appium direct connect options server (https://appiumpro.com/editions/86-connecting-directly-to-appium-hosts-in-distributed-environments)
127
+ * Whether to allow direct connect caps to adjust endpoint details (Appium only)
127
128
  */
128
- directConnectProtocol: {
129
- type: 'string'
130
- },
131
- directConnectHost: {
132
- type: 'string'
133
- },
134
- directConnectPort: {
135
- type: 'number'
136
- },
137
- directConnectPath: {
138
- type: 'string'
129
+ enableDirectConnect: {
130
+ type: 'boolean',
131
+ default: true
139
132
  },
140
133
  /**
141
134
  * Whether it requires SSL certificates to be valid in HTTP/s requests
@@ -151,3 +144,7 @@ exports.VALID_CAPS = [
151
144
  'pageLoadStrategy', 'proxy', 'setWindowRect', 'timeouts', 'strictFileInteractability',
152
145
  'unhandledPromptBehavior'
153
146
  ];
147
+ exports.REG_EXPS = {
148
+ commandName: /.*\/session\/[0-9a-f-]+\/(.*)/,
149
+ execFn: /return \(([\s\S]*)\)\.apply\(null, arguments\)/
150
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAgB,MAAM,aAAa,CAAA;AAExD,OAAO,OAAO,MAAM,WAAW,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAyB,YAAY,EAAsB,MAAM,SAAS,CAAA;AACjF,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAgB,MAAM,SAAS,CAAA;AAIlE,MAAM,CAAC,OAAO,OAAO,SAAS;WACb,UAAU,CACnB,OAAO,EAAE,OAAO,CAAC,SAAS,EAC1B,QAAQ,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAClC,aAAa,KAAK,EAClB,oBAAoB,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAC/C,OAAO,CAAC,MAAM,CAAC;IAgDlB;;OAEG;IACH,MAAM,CAAC,eAAe,CAClB,OAAO,CAAC,EAAE,aAAa,EACvB,QAAQ,CAAC,EAAE,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AAQ,EAAE,MAAM;IAW5C,MAAM,KAAK,SAAS,qBAEnB;CACJ;AAED;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAA;AAC1C,cAAc,SAAS,CAAA"}
package/build/index.js CHANGED
@@ -38,22 +38,6 @@ class WebDriver {
38
38
  process.env.WDIO_LOG_PATH = path_1.default.join(params.outputDir, 'wdio.log');
39
39
  }
40
40
  log.info('Initiate new session using the WebDriver protocol');
41
- /**
42
- * if the server responded with direct connect information, update the
43
- * params to speak directly to the appium host instead of a load
44
- * balancer (see https://github.com/appium/python-client#direct-connect-urls
45
- * for example). But only do this if the user has enabled this
46
- * behavior in the first place.
47
- */
48
- const { directConnectProtocol, directConnectHost, directConnectPort, directConnectPath } = params;
49
- if (directConnectProtocol && directConnectHost && directConnectPort && (directConnectPath || directConnectPath === '')) {
50
- log.info('Found direct connect information in new session response. ' +
51
- `Will connect to server at ${directConnectProtocol}://${directConnectHost}:${directConnectPort}/${directConnectPath}`);
52
- params.protocol = directConnectProtocol;
53
- params.hostname = directConnectHost;
54
- params.port = directConnectPort;
55
- params.path = directConnectPath;
56
- }
57
41
  const requestedCapabilities = { ...params.capabilities };
58
42
  const { sessionId, capabilities } = await (0, utils_2.startWebDriverSession)(params);
59
43
  const environment = (0, utils_1.sessionEnvironmentDetector)({ capabilities, requestedCapabilities });
@@ -61,7 +45,18 @@ class WebDriver {
61
45
  const protocolCommands = (0, utils_2.getPrototype)(environment);
62
46
  const prototype = { ...protocolCommands, ...environmentPrototype, ...userPrototype };
63
47
  const monad = (0, utils_1.webdriverMonad)({ ...params, requestedCapabilities }, modifier, prototype);
64
- return monad(sessionId, customCommandWrapper);
48
+ const client = monad(sessionId, customCommandWrapper);
49
+ /**
50
+ * if the server responded with direct connect information, update the
51
+ * client options to speak directly to the appium host instead of a load
52
+ * balancer (see https://github.com/appium/python-client#direct-connect-urls
53
+ * for example). But only do this if the user has enabled this
54
+ * behavior in the first place.
55
+ */
56
+ if (params.enableDirectConnect) {
57
+ (0, utils_2.setupDirectConnect)(client);
58
+ }
59
+ return client;
65
60
  }
66
61
  /**
67
62
  * allows user to attach to existing sessions
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/request/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAErC,OAAO,gBAAgB,MAAM,SAAS,CAAA;AAGtC,aAAK,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAA;AAClD,aAAK,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;AAU7D,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,gBAAgB;gBAE3C,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAE,OAAe;IAI5G,SAAS,CAAC,cAAc,CAAE,OAAO,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,iBAAiB;cAIzE,WAAW,CAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,iBAAiB;;;;CA2BpE"}
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/request/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAErC,OAAO,gBAAgB,MAAM,SAAS,CAAA;AAGtC,aAAK,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAA;AAClD,aAAK,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;AAU7D,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,gBAAgB;gBAE3C,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAE,OAAe;IAI5G,SAAS,CAAC,cAAc,CAAE,OAAO,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,iBAAiB;cAIzE,WAAW,CAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,iBAAiB;;;;CA8BpE"}
@@ -28,10 +28,11 @@ class BrowserRequest extends index_1.default {
28
28
  log.info(`Browser-based webdriver does not support the '${String(opt)}' option; behavior may be unexpected`);
29
29
  continue;
30
30
  }
31
+ // @ts-expect-error
31
32
  kyOptions[opt] = options[opt];
32
33
  }
33
34
  if (options.username && options.password) {
34
- const encodedAuth = btoa(`${options.username}:${options.password}`);
35
+ const encodedAuth = Buffer.from(`${options.username}:${options.password}`, 'utf8').toString('base64');
35
36
  kyOptions.headers = {
36
37
  ...kyOptions.headers,
37
38
  Authorization: `Basic ${encodedAuth}`
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAErC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAK9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAM1C,aAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;AAC5B,aAAK,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAA;AAClD,aAAK,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAA;AACpD,aAAK,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;AAE7D,qBAAa,eAAgB,SAAQ,KAAK;IACtC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,GAAG,CAAA;IACV,IAAI,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,iBAAiB;IAC9B,KAAK,EAAE,GAAG,CAAA;IACV;;;OAGG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,EAAE,SAAS,GAAE,OAAe,GAAG,iBAAiB;cAiErG,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;YAIhF,QAAQ;CA8GzB"}
@@ -144,7 +144,8 @@ class WebDriverRequest extends events_1.EventEmitter {
144
144
  * handle timeouts
145
145
  */
146
146
  if (response.code === 'ETIMEDOUT') {
147
- return retry(response, 'Request timed out! Consider increasing the "connectionRetryTimeout" option.');
147
+ const error = (0, utils_2.getTimeoutError)(response, fullRequestOptions);
148
+ return retry(error, 'Request timed out! Consider increasing the "connectionRetryTimeout" option.');
148
149
  }
149
150
  /**
150
151
  * throw if request error is unknown
package/build/utils.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Options, Capabilities } from '@wdio/types';
2
2
  import { WebDriverResponse } from './request';
3
- import type { JSONWPCommandError, SessionFlags } from './types';
3
+ import type { Client, JSONWPCommandError, SessionFlags } from './types';
4
4
  /**
5
5
  * start browser session with WebDriver protocol
6
6
  */
@@ -60,9 +60,20 @@ export declare function getEnvironmentVars({ isW3C, isMobile, isIOS, isAndroid,
60
60
  value: boolean | undefined;
61
61
  };
62
62
  };
63
+ /**
64
+ * Decorate the client's options object with host updates based on the presence of
65
+ * directConnect capabilities in the new session response. Note that this
66
+ * mutates the object.
67
+ * @param {Client} params post-new-session client
68
+ */
69
+ export declare function setupDirectConnect(client: Client): void;
63
70
  /**
64
71
  * get human readable message from response error
65
72
  * @param {Error} err response error
66
73
  */
67
74
  export declare const getSessionError: (err: JSONWPCommandError, params?: Partial<Options.WebDriver>) => string;
75
+ /**
76
+ * return timeout error with information about the executing command on which the test hangs
77
+ */
78
+ export declare const getTimeoutError: (error: Error, requestOptions: Options.RequestLibOptions) => Error;
68
79
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAOA,OAAO,E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
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getSessionError = exports.getEnvironmentVars = exports.CustomRequestError = exports.getErrorFromResponseBody = exports.getPrototype = exports.isSuccessfulResponse = exports.startWebDriverSession = void 0;
6
+ exports.getTimeoutError = exports.getSessionError = exports.setupDirectConnect = exports.getEnvironmentVars = exports.CustomRequestError = exports.getErrorFromResponseBody = exports.getPrototype = exports.isSuccessfulResponse = exports.startWebDriverSession = void 0;
7
7
  const lodash_merge_1 = __importDefault(require("lodash.merge"));
8
8
  const logger_1 = __importDefault(require("@wdio/logger"));
9
9
  const protocols_1 = require("@wdio/protocols");
10
10
  const factory_1 = __importDefault(require("./request/factory"));
11
11
  const command_1 = __importDefault(require("./command"));
12
+ const utils_1 = require("@wdio/utils");
12
13
  const constants_1 = require("./constants");
13
14
  const log = (0, logger_1.default)('webdriver');
14
15
  const BROWSER_DRIVER_ERRORS = [
@@ -235,6 +236,33 @@ function getEnvironmentVars({ isW3C, isMobile, isIOS, isAndroid, isChrome, isFir
235
236
  };
236
237
  }
237
238
  exports.getEnvironmentVars = getEnvironmentVars;
239
+ /**
240
+ * Decorate the client's options object with host updates based on the presence of
241
+ * directConnect capabilities in the new session response. Note that this
242
+ * mutates the object.
243
+ * @param {Client} params post-new-session client
244
+ */
245
+ function setupDirectConnect(client) {
246
+ const capabilities = client.capabilities;
247
+ const directConnectProtocol = capabilities.directConnectProtocol || capabilities['appium:directConnectProtocol'];
248
+ const directConnectHost = capabilities.directConnectHost || capabilities['appium:directConnectHost'];
249
+ let directConnectPath = capabilities.directConnectPath;
250
+ if (!(directConnectPath || directConnectPath === '')) {
251
+ directConnectPath = capabilities['appium:directConnectPath'];
252
+ }
253
+ const directConnectPort = capabilities.directConnectPort || capabilities['appium:directConnectPort'];
254
+ if (directConnectProtocol && directConnectHost && directConnectPort &&
255
+ (directConnectPath || directConnectPath === '')) {
256
+ log.info('Found direct connect information in new session response. ' +
257
+ `Will connect to server at ${directConnectProtocol}://` +
258
+ `${directConnectHost}:${directConnectPort}${directConnectPath}`);
259
+ client.options.protocol = directConnectProtocol;
260
+ client.options.hostname = directConnectHost;
261
+ client.options.port = directConnectPort;
262
+ client.options.path = directConnectPath;
263
+ }
264
+ }
265
+ exports.setupDirectConnect = setupDirectConnect;
238
266
  /**
239
267
  * get human readable message from response error
240
268
  * @param {Error} err response error
@@ -283,3 +311,35 @@ const getSessionError = (err, params = {}) => {
283
311
  return err.message;
284
312
  };
285
313
  exports.getSessionError = getSessionError;
314
+ /**
315
+ * return timeout error with information about the executing command on which the test hangs
316
+ */
317
+ const getTimeoutError = (error, requestOptions) => {
318
+ const cmdName = getExecCmdName(requestOptions);
319
+ const cmdArgs = getExecCmdArgs(requestOptions);
320
+ const cmdInfoMsg = `when running "${cmdName}" with method "${requestOptions.method}"`;
321
+ const cmdArgsMsg = cmdArgs ? ` and args ${cmdArgs}` : '';
322
+ const timeoutErr = new Error(`${error.message} ${cmdInfoMsg}${cmdArgsMsg}`);
323
+ return Object.assign(timeoutErr, error);
324
+ };
325
+ exports.getTimeoutError = getTimeoutError;
326
+ function getExecCmdName(requestOptions) {
327
+ const { href } = requestOptions.url;
328
+ const res = href.match(constants_1.REG_EXPS.commandName) || [];
329
+ return res[1] || href;
330
+ }
331
+ function getExecCmdArgs(requestOptions) {
332
+ const { json: cmdJson } = requestOptions;
333
+ if (typeof cmdJson !== 'object') {
334
+ return '';
335
+ }
336
+ const transformedRes = (0, utils_1.transformCommandLogResult)(cmdJson);
337
+ if (typeof transformedRes === 'string') {
338
+ return transformedRes;
339
+ }
340
+ if (typeof cmdJson.script === 'string') {
341
+ const scriptRes = cmdJson.script.match(constants_1.REG_EXPS.execFn) || [];
342
+ return `"${scriptRes[1] || cmdJson.script}"`;
343
+ }
344
+ return Object.keys(cmdJson).length ? `"${JSON.stringify(cmdJson)}"` : '';
345
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webdriver",
3
- "version": "7.16.7",
3
+ "version": "7.16.14",
4
4
  "description": "A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol",
5
5
  "author": "Christian Bromann <christian@saucelabs.com>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/webdriver",
@@ -25,15 +25,15 @@
25
25
  "@types/lodash.merge": "^4.6.6"
26
26
  },
27
27
  "dependencies": {
28
- "@types/node": "^16.11.1",
29
- "@wdio/config": "7.16.3",
28
+ "@types/node": "^17.0.4",
29
+ "@wdio/config": "7.16.14",
30
30
  "@wdio/logger": "7.16.0",
31
31
  "@wdio/protocols": "7.16.7",
32
- "@wdio/types": "7.16.3",
33
- "@wdio/utils": "7.16.3",
32
+ "@wdio/types": "7.16.14",
33
+ "@wdio/utils": "7.16.14",
34
34
  "got": "^11.0.2",
35
35
  "ky": "^0.28.5",
36
36
  "lodash.merge": "^4.6.1"
37
37
  },
38
- "gitHead": "6c51be2984c51b4442cc185e2fe4579179c6da03"
38
+ "gitHead": "be9d252b21fff13f161b8607e186a33a530e3d3d"
39
39
  }