webdriver 8.24.0 → 8.24.3

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.
@@ -27,6 +27,7 @@ export interface WebDriverResponse {
27
27
  status?: number;
28
28
  sessionId?: string;
29
29
  }
30
+ export declare const COMMANDS_WITHOUT_RETRY: string[];
30
31
  export default abstract class WebDriverRequest extends EventEmitter {
31
32
  body?: Record<string, unknown>;
32
33
  method: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request/index.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAInC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAQ1C,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;AAC5B,KAAK,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAA;AAClD,KAAK,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAA;AACpD,KAAK,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;AAY7D,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;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB;AAYD,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,gBAAiB,SAAQ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xB,QAAQ;CAmHzB"}
@@ -1,6 +1,7 @@
1
1
  import path from 'node:path';
2
2
  import { EventEmitter } from 'node:events';
3
3
  import { createRequire } from 'node:module';
4
+ import { WebDriverProtocol } from '@wdio/protocols';
4
5
  import logger from '@wdio/logger';
5
6
  import { transformCommandLogResult } from '@wdio/utils';
6
7
  import { URLFactory } from './factory.js';
@@ -21,6 +22,9 @@ export class RequestLibError extends Error {
21
22
  body;
22
23
  code;
23
24
  }
25
+ export const COMMANDS_WITHOUT_RETRY = [
26
+ findCommandPathByName('performActions'),
27
+ ];
24
28
  const MAX_RETRY_TIMEOUT = 100; // 100ms
25
29
  const DEFAULT_HEADERS = {
26
30
  'Content-Type': 'application/json; charset=utf-8',
@@ -72,8 +76,19 @@ export default class WebDriverRequest extends EventEmitter {
72
76
  searchParams,
73
77
  retry: {
74
78
  limit: options.connectionRetryCount,
75
- methods: RETRY_METHODS,
76
- calculateDelay: ({ computedValue }) => Math.min(MAX_RETRY_TIMEOUT, computedValue / 10)
79
+ /**
80
+ * this enables request retries for all commands except for the
81
+ * ones defined in `COMMANDS_WITHOUT_RETRY` since they have their
82
+ * own retry mechanism. Including a request based retry mechanism
83
+ * here also ensures we retry if e.g. a connection to the server
84
+ * can't be established at all.
85
+ */
86
+ ...(COMMANDS_WITHOUT_RETRY.includes(this.endpoint)
87
+ ? {}
88
+ : {
89
+ methods: RETRY_METHODS,
90
+ calculateDelay: ({ computedValue }) => Math.min(MAX_RETRY_TIMEOUT, computedValue / 10)
91
+ }),
77
92
  },
78
93
  timeout: { response: options.connectionRetryTimeout }
79
94
  };
@@ -218,3 +233,10 @@ export default class WebDriverRequest extends EventEmitter {
218
233
  return retry(error, `Request failed with status ${response.statusCode} due to ${error.message}`);
219
234
  }
220
235
  }
236
+ function findCommandPathByName(commandName) {
237
+ const command = Object.entries(WebDriverProtocol).find(([, command]) => Object.values(command).find((cmd) => cmd.command === commandName));
238
+ if (!command) {
239
+ throw new Error(`Couldn't find command "${commandName}"`);
240
+ }
241
+ return command[0];
242
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webdriver",
3
- "version": "8.24.0",
3
+ "version": "8.24.3",
4
4
  "description": "A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol",
5
5
  "author": "Christian Bromann <mail@bromann.dev>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/webdriver",
@@ -38,15 +38,15 @@
38
38
  "dependencies": {
39
39
  "@types/node": "^20.1.0",
40
40
  "@types/ws": "^8.5.3",
41
- "@wdio/config": "8.24.0",
41
+ "@wdio/config": "8.24.3",
42
42
  "@wdio/logger": "8.16.17",
43
43
  "@wdio/protocols": "8.23.0",
44
- "@wdio/types": "8.24.0",
45
- "@wdio/utils": "8.24.0",
44
+ "@wdio/types": "8.24.2",
45
+ "@wdio/utils": "8.24.3",
46
46
  "deepmerge-ts": "^5.1.0",
47
47
  "got": "^ 12.6.1",
48
48
  "ky": "^0.33.0",
49
49
  "ws": "^8.8.0"
50
50
  },
51
- "gitHead": "5fe7908a837461102ada6edf71c160f2c66dd88f"
51
+ "gitHead": "365d1997d0303e41bc418e447a46573fdbcc2dce"
52
52
  }