@appium/base-driver 8.5.2 → 8.5.5

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.
Files changed (141) hide show
  1. package/build/lib/basedriver/capabilities.d.ts.map +1 -1
  2. package/build/lib/basedriver/capabilities.js +1 -1
  3. package/build/lib/basedriver/commands/event.js +1 -1
  4. package/build/lib/basedriver/commands/find.d.ts.map +1 -1
  5. package/build/lib/basedriver/commands/find.js +1 -1
  6. package/build/lib/basedriver/commands/index.js +1 -1
  7. package/build/lib/basedriver/commands/log.d.ts.map +1 -1
  8. package/build/lib/basedriver/commands/log.js +1 -1
  9. package/build/lib/basedriver/commands/session.js +1 -1
  10. package/build/lib/basedriver/commands/settings.d.ts.map +1 -1
  11. package/build/lib/basedriver/commands/settings.js +1 -1
  12. package/build/lib/basedriver/commands/timeout.d.ts.map +1 -1
  13. package/build/lib/basedriver/commands/timeout.js +1 -1
  14. package/build/lib/basedriver/core.d.ts +120 -139
  15. package/build/lib/basedriver/core.d.ts.map +1 -1
  16. package/build/lib/basedriver/core.js +1 -49
  17. package/build/lib/basedriver/desired-caps.d.ts +5 -2
  18. package/build/lib/basedriver/desired-caps.d.ts.map +1 -1
  19. package/build/lib/basedriver/desired-caps.js +14 -18
  20. package/build/lib/basedriver/device-settings.d.ts +9 -9
  21. package/build/lib/basedriver/device-settings.d.ts.map +1 -1
  22. package/build/lib/basedriver/device-settings.js +4 -4
  23. package/build/lib/basedriver/driver.d.ts +43 -38
  24. package/build/lib/basedriver/driver.d.ts.map +1 -1
  25. package/build/lib/basedriver/driver.js +58 -11
  26. package/build/lib/basedriver/helpers.d.ts +8 -3
  27. package/build/lib/basedriver/helpers.d.ts.map +1 -1
  28. package/build/lib/basedriver/helpers.js +4 -6
  29. package/build/lib/basedriver/logger.d.ts +1 -1
  30. package/build/lib/basedriver/logger.d.ts.map +1 -1
  31. package/build/lib/basedriver/logger.js +1 -1
  32. package/build/lib/constants.js +1 -1
  33. package/build/lib/express/crash.d.ts.map +1 -1
  34. package/build/lib/express/crash.js +1 -1
  35. package/build/lib/express/express-logging.d.ts.map +1 -1
  36. package/build/lib/express/express-logging.js +1 -1
  37. package/build/lib/express/idempotency.js +1 -1
  38. package/build/lib/express/logger.d.ts +1 -1
  39. package/build/lib/express/logger.d.ts.map +1 -1
  40. package/build/lib/express/logger.js +1 -1
  41. package/build/lib/express/middleware.d.ts.map +1 -1
  42. package/build/lib/express/middleware.js +1 -1
  43. package/build/lib/express/server.d.ts +21 -0
  44. package/build/lib/express/server.d.ts.map +1 -1
  45. package/build/lib/express/server.js +4 -9
  46. package/build/lib/express/static.d.ts.map +1 -1
  47. package/build/lib/express/static.js +2 -2
  48. package/build/lib/express/websocket.d.ts +14 -11
  49. package/build/lib/express/websocket.d.ts.map +1 -1
  50. package/build/lib/express/websocket.js +2 -2
  51. package/build/lib/helpers/capabilities.d.ts.map +1 -1
  52. package/build/lib/helpers/capabilities.js +1 -1
  53. package/build/lib/index.d.ts +2 -1
  54. package/build/lib/index.js +7 -1
  55. package/build/lib/jsonwp-proxy/protocol-converter.d.ts.map +1 -1
  56. package/build/lib/jsonwp-proxy/protocol-converter.js +2 -2
  57. package/build/lib/jsonwp-proxy/proxy.d.ts +30 -5
  58. package/build/lib/jsonwp-proxy/proxy.d.ts.map +1 -1
  59. package/build/lib/jsonwp-proxy/proxy.js +20 -4
  60. package/build/lib/jsonwp-status/status.d.ts.map +1 -1
  61. package/build/lib/jsonwp-status/status.js +2 -2
  62. package/build/lib/protocol/errors.d.ts +17 -8
  63. package/build/lib/protocol/errors.d.ts.map +1 -1
  64. package/build/lib/protocol/errors.js +9 -5
  65. package/build/lib/protocol/helpers.js +1 -1
  66. package/build/lib/protocol/index.js +1 -1
  67. package/build/lib/protocol/protocol.d.ts.map +1 -1
  68. package/build/lib/protocol/protocol.js +1 -1
  69. package/build/lib/protocol/routes.d.ts +17 -3
  70. package/build/lib/protocol/routes.d.ts.map +1 -1
  71. package/build/lib/protocol/routes.js +1 -1
  72. package/build/lib/protocol/validators.js +1 -1
  73. package/build/test/basedriver/driver-e2e-tests.js +1 -1
  74. package/build/test/basedriver/driver-tests.js +1 -1
  75. package/build/test/basedriver/index.js +1 -1
  76. package/build/test/e2e/basedriver/driver.e2e.spec.js +1 -1
  77. package/build/test/e2e/basedriver/helpers.e2e.spec.js +1 -1
  78. package/build/test/e2e/basedriver/websockets.e2e.spec.js +1 -1
  79. package/build/test/e2e/express/server.e2e.spec.js +1 -1
  80. package/build/test/e2e/jsonwp-proxy/proxy.e2e.spec.js +1 -1
  81. package/build/test/e2e/protocol/fake-driver.js +1 -1
  82. package/build/test/e2e/protocol/helpers.js +1 -1
  83. package/build/test/e2e/protocol/protocol.e2e.spec.js +13 -13
  84. package/build/test/helpers.js +1 -1
  85. package/build/test/unit/basedriver/capabilities.spec.js +12 -12
  86. package/build/test/unit/basedriver/capability.spec.js +15 -15
  87. package/build/test/unit/basedriver/commands/event.spec.js +1 -1
  88. package/build/test/unit/basedriver/commands/log.spec.js +1 -1
  89. package/build/test/unit/basedriver/device-settings.spec.js +1 -1
  90. package/build/test/unit/basedriver/driver.spec.js +1 -1
  91. package/build/test/unit/basedriver/helpers.spec.js +33 -33
  92. package/build/test/unit/basedriver/timeout.spec.js +1 -1
  93. package/build/test/unit/express/server.spec.js +1 -1
  94. package/build/test/unit/express/static.spec.js +2 -2
  95. package/build/test/unit/jsonwp-proxy/mock-request.js +1 -1
  96. package/build/test/unit/jsonwp-proxy/protocol-converter.spec.js +1 -1
  97. package/build/test/unit/jsonwp-proxy/proxy.spec.js +2 -2
  98. package/build/test/unit/jsonwp-proxy/url.spec.js +1 -1
  99. package/build/test/unit/jsonwp-status/status.spec.js +1 -1
  100. package/build/test/unit/protocol/errors.spec.js +1 -1
  101. package/build/test/unit/protocol/routes.spec.js +1 -1
  102. package/build/test/unit/protocol/validator.spec.js +1 -1
  103. package/build/tsconfig.tsbuildinfo +1 -1
  104. package/lib/basedriver/capabilities.js +95 -47
  105. package/lib/basedriver/commands/event.js +4 -4
  106. package/lib/basedriver/commands/find.js +12 -26
  107. package/lib/basedriver/commands/index.js +7 -7
  108. package/lib/basedriver/commands/log.js +5 -7
  109. package/lib/basedriver/commands/session.js +3 -3
  110. package/lib/basedriver/commands/settings.js +3 -5
  111. package/lib/basedriver/commands/timeout.js +18 -23
  112. package/lib/basedriver/core.js +150 -229
  113. package/lib/basedriver/desired-caps.js +30 -29
  114. package/lib/basedriver/device-settings.js +21 -20
  115. package/lib/basedriver/driver.js +131 -96
  116. package/lib/basedriver/helpers.js +124 -81
  117. package/lib/basedriver/logger.js +1 -1
  118. package/lib/constants.js +2 -6
  119. package/lib/express/crash.js +4 -6
  120. package/lib/express/express-logging.js +26 -24
  121. package/lib/express/idempotency.js +16 -16
  122. package/lib/express/logger.js +1 -1
  123. package/lib/express/middleware.js +49 -33
  124. package/lib/express/server.js +68 -44
  125. package/lib/express/static.js +11 -12
  126. package/lib/express/websocket.js +26 -16
  127. package/lib/helpers/capabilities.js +11 -16
  128. package/lib/index.js +50 -33
  129. package/lib/jsonwp-proxy/protocol-converter.js +85 -69
  130. package/lib/jsonwp-proxy/proxy.js +116 -53
  131. package/lib/jsonwp-status/status.js +36 -29
  132. package/lib/protocol/errors.js +469 -292
  133. package/lib/protocol/helpers.js +5 -8
  134. package/lib/protocol/index.js +22 -15
  135. package/lib/protocol/protocol.js +103 -55
  136. package/lib/protocol/routes.js +430 -273
  137. package/lib/protocol/validators.js +5 -5
  138. package/package.json +9 -11
  139. package/test/basedriver/driver-e2e-tests.js +92 -66
  140. package/test/basedriver/driver-tests.js +90 -33
  141. package/test/basedriver/index.js +1 -1
package/lib/index.js CHANGED
@@ -1,5 +1,3 @@
1
- // @ts-check
2
-
3
1
  import B from 'bluebird';
4
2
 
5
3
  B.config({
@@ -7,62 +5,81 @@ B.config({
7
5
  });
8
6
 
9
7
  // BaseDriver exports
10
- import { BaseDriver } from './basedriver/driver';
11
- export { DriverCore } from './basedriver/core';
12
- import { DeviceSettings } from './basedriver/device-settings';
8
+ import {BaseDriver} from './basedriver/driver';
9
+ export {DriverCore} from './basedriver/core';
10
+ import {DeviceSettings} from './basedriver/device-settings';
13
11
 
14
- export { BaseDriver, DeviceSettings };
12
+ export {BaseDriver, DeviceSettings};
15
13
  export default BaseDriver;
16
14
 
17
-
18
15
  // MJSONWP exports
19
16
  import * as protocol from './protocol';
20
- import {
21
- DEFAULT_BASE_PATH, PROTOCOLS
22
- } from './constants';
17
+ import {DEFAULT_BASE_PATH, PROTOCOLS} from './constants';
23
18
 
24
19
  const {
25
- routeConfiguringFunction, errors, isErrorType,
26
- errorFromMJSONWPStatusCode, errorFromW3CJsonCode, ALL_COMMANDS, METHOD_MAP,
27
- routeToCommandName, NO_SESSION_ID_COMMANDS, isSessionCommand,
28
- determineProtocol, CREATE_SESSION_COMMAND,
29
- DELETE_SESSION_COMMAND, GET_STATUS_COMMAND,
20
+ routeConfiguringFunction,
21
+ errors,
22
+ isErrorType,
23
+ errorFromMJSONWPStatusCode,
24
+ errorFromW3CJsonCode,
25
+ ALL_COMMANDS,
26
+ METHOD_MAP,
27
+ routeToCommandName,
28
+ NO_SESSION_ID_COMMANDS,
29
+ isSessionCommand,
30
+ determineProtocol,
31
+ CREATE_SESSION_COMMAND,
32
+ DELETE_SESSION_COMMAND,
33
+ GET_STATUS_COMMAND,
30
34
  } = protocol;
31
35
 
32
36
  export {
33
- routeConfiguringFunction, errors, isErrorType, PROTOCOLS,
34
- errorFromMJSONWPStatusCode, errorFromW3CJsonCode, determineProtocol,
35
- errorFromMJSONWPStatusCode as errorFromCode, ALL_COMMANDS, METHOD_MAP,
36
- routeToCommandName, NO_SESSION_ID_COMMANDS, isSessionCommand,
37
- DEFAULT_BASE_PATH, CREATE_SESSION_COMMAND,
38
- DELETE_SESSION_COMMAND, GET_STATUS_COMMAND,
37
+ routeConfiguringFunction,
38
+ errors,
39
+ isErrorType,
40
+ PROTOCOLS,
41
+ errorFromMJSONWPStatusCode,
42
+ errorFromW3CJsonCode,
43
+ determineProtocol,
44
+ errorFromMJSONWPStatusCode as errorFromCode,
45
+ ALL_COMMANDS,
46
+ METHOD_MAP,
47
+ routeToCommandName,
48
+ NO_SESSION_ID_COMMANDS,
49
+ isSessionCommand,
50
+ DEFAULT_BASE_PATH,
51
+ CREATE_SESSION_COMMAND,
52
+ DELETE_SESSION_COMMAND,
53
+ GET_STATUS_COMMAND,
39
54
  };
40
55
 
41
56
  // Express exports
42
57
  import * as staticIndex from './express/static';
43
- const { STATIC_DIR } = staticIndex;
44
- export { STATIC_DIR };
58
+ const {STATIC_DIR} = staticIndex;
59
+ export {STATIC_DIR};
45
60
 
46
61
  import * as serverIndex from './express/server';
47
- const { server, normalizeBasePath } = serverIndex;
48
- export { server, normalizeBasePath };
62
+ const {server, normalizeBasePath} = serverIndex;
63
+ export {server, normalizeBasePath};
49
64
 
50
65
  // jsonwp-proxy exports
51
66
  import * as proxyIndex from './jsonwp-proxy/proxy';
52
- const { JWProxy } = proxyIndex;
53
- export { JWProxy };
67
+ const {JWProxy} = proxyIndex;
68
+ export {JWProxy};
54
69
 
55
70
  // jsonwp-status exports
56
71
  import * as statusIndex from './jsonwp-status/status';
57
- const { codes: statusCodes, getSummaryByCode } = statusIndex;
58
- export { statusCodes, getSummaryByCode };
72
+ const {codes: statusCodes, getSummaryByCode} = statusIndex;
73
+ export {statusCodes, getSummaryByCode};
59
74
 
60
75
  // W3C capabilities parser
61
76
  import * as caps from './basedriver/capabilities';
62
- const { processCapabilities, isStandardCap, validateCaps } = caps;
63
- export { processCapabilities, isStandardCap, validateCaps };
77
+ const {processCapabilities, isStandardCap, validateCaps} = caps;
78
+ export {processCapabilities, isStandardCap, validateCaps};
64
79
 
65
80
  // Web socket helpers
66
81
  import * as ws from './express/websocket';
67
- const { DEFAULT_WS_PATHNAME_PREFIX } = ws;
68
- export { DEFAULT_WS_PATHNAME_PREFIX };
82
+ const {DEFAULT_WS_PATHNAME_PREFIX} = ws;
83
+ export {DEFAULT_WS_PATHNAME_PREFIX};
84
+
85
+ export {PREFIXED_APPIUM_OPTS_CAP} from './basedriver/capabilities';
@@ -1,33 +1,29 @@
1
1
  import _ from 'lodash';
2
- import { logger, util } from '@appium/support';
3
- import { duplicateKeys } from '../basedriver/helpers';
4
- import {
5
- MJSONWP_ELEMENT_KEY, W3C_ELEMENT_KEY, PROTOCOLS
6
- } from '../constants';
2
+ import {logger, util} from '@appium/support';
3
+ import {duplicateKeys} from '../basedriver/helpers';
4
+ import {MJSONWP_ELEMENT_KEY, W3C_ELEMENT_KEY, PROTOCOLS} from '../constants';
7
5
 
8
6
  export const COMMAND_URLS_CONFLICTS = [
9
7
  {
10
8
  commandNames: ['execute', 'executeAsync'],
11
- jsonwpConverter: (url) => url.replace(/\/execute.*/,
12
- url.includes('async') ? '/execute_async' : '/execute'),
13
- w3cConverter: (url) => url.replace(/\/execute.*/,
14
- url.includes('async') ? '/execute/async' : '/execute/sync'),
9
+ jsonwpConverter: (url) =>
10
+ url.replace(/\/execute.*/, url.includes('async') ? '/execute_async' : '/execute'),
11
+ w3cConverter: (url) =>
12
+ url.replace(/\/execute.*/, url.includes('async') ? '/execute/async' : '/execute/sync'),
15
13
  },
16
14
  {
17
15
  commandNames: ['getElementScreenshot'],
18
- jsonwpConverter: (url) => url.replace(/\/element\/([^/]+)\/screenshot$/,
19
- '/screenshot/$1'),
20
- w3cConverter: (url) => url.replace(/\/screenshot\/([^/]+)/,
21
- '/element/$1/screenshot'),
16
+ jsonwpConverter: (url) => url.replace(/\/element\/([^/]+)\/screenshot$/, '/screenshot/$1'),
17
+ w3cConverter: (url) => url.replace(/\/screenshot\/([^/]+)/, '/element/$1/screenshot'),
22
18
  },
23
19
  {
24
20
  commandNames: ['getWindowHandles', 'getWindowHandle'],
25
- jsonwpConverter (url) {
21
+ jsonwpConverter(url) {
26
22
  return /\/window$/.test(url)
27
23
  ? url.replace(/\/window$/, '/window_handle')
28
24
  : url.replace(/\/window\/handle(s?)$/, '/window_handle$1');
29
25
  },
30
- w3cConverter (url) {
26
+ w3cConverter(url) {
31
27
  return /\/window_handle$/.test(url)
32
28
  ? url.replace(/\/window_handle$/, '/window')
33
29
  : url.replace(/\/window_handles$/, '/window/handles');
@@ -40,29 +36,28 @@ export const COMMAND_URLS_CONFLICTS = [
40
36
  const jsonwpUrl = w3cUrl.replace(w3cPropertyRegex, '/element/$1/attribute/$2');
41
37
  return jsonwpUrl;
42
38
  },
43
- w3cConverter: (jsonwpUrl) => jsonwpUrl // Don't convert JSONWP URL to W3C. W3C accepts /attribute and /property
44
- }
39
+ w3cConverter: (jsonwpUrl) => jsonwpUrl, // Don't convert JSONWP URL to W3C. W3C accepts /attribute and /property
40
+ },
45
41
  ];
46
42
  const {MJSONWP, W3C} = PROTOCOLS;
47
43
  const DEFAULT_LOG = logger.getLogger('Protocol Converter');
48
44
 
49
-
50
45
  class ProtocolConverter {
51
- constructor (proxyFunc, log = null) {
46
+ constructor(proxyFunc, log = null) {
52
47
  this.proxyFunc = proxyFunc;
53
48
  this._downstreamProtocol = null;
54
49
  this._log = log;
55
50
  }
56
51
 
57
- get log () {
52
+ get log() {
58
53
  return this._log ?? DEFAULT_LOG;
59
54
  }
60
55
 
61
- set downstreamProtocol (value) {
56
+ set downstreamProtocol(value) {
62
57
  this._downstreamProtocol = value;
63
58
  }
64
59
 
65
- get downstreamProtocol () {
60
+ get downstreamProtocol() {
66
61
  return this._downstreamProtocol;
67
62
  }
68
63
 
@@ -74,25 +69,29 @@ class ProtocolConverter {
74
69
  * @param {Object} body Request body
75
70
  * @return {Array} Array of W3C + MJSONWP compatible timeout objects
76
71
  */
77
- getTimeoutRequestObjects (body) {
72
+ getTimeoutRequestObjects(body) {
78
73
  if (this.downstreamProtocol === W3C && _.has(body, 'ms') && _.has(body, 'type')) {
79
- const typeToW3C = (x) => x === 'page load' ? 'pageLoad' : x;
80
- return [{
81
- [typeToW3C(body.type)]: body.ms,
82
- }];
74
+ const typeToW3C = (x) => (x === 'page load' ? 'pageLoad' : x);
75
+ return [
76
+ {
77
+ [typeToW3C(body.type)]: body.ms,
78
+ },
79
+ ];
83
80
  }
84
81
 
85
82
  if (this.downstreamProtocol === MJSONWP && (!_.has(body, 'ms') || !_.has(body, 'type'))) {
86
- const typeToJSONWP = (x) => x === 'pageLoad' ? 'page load' : x;
87
- return _.toPairs(body)
88
- // Only transform the entry if ms value is a valid positive float number
89
- .filter((pair) => /^\d+(?:[.,]\d*?)?$/.test(`${pair[1]}`))
90
- .map(function (pair) {
91
- return {
92
- type: typeToJSONWP(pair[0]),
93
- ms: pair[1],
94
- };
95
- });
83
+ const typeToJSONWP = (x) => (x === 'pageLoad' ? 'page load' : x);
84
+ return (
85
+ _.toPairs(body)
86
+ // Only transform the entry if ms value is a valid positive float number
87
+ .filter((pair) => /^\d+(?:[.,]\d*?)?$/.test(`${pair[1]}`))
88
+ .map(function (pair) {
89
+ return {
90
+ type: typeToJSONWP(pair[0]),
91
+ ms: pair[1],
92
+ };
93
+ })
94
+ );
96
95
  }
97
96
 
98
97
  return [body];
@@ -104,11 +103,15 @@ class ProtocolConverter {
104
103
  * @param {String} method Endpoint method
105
104
  * @param {Object} body Request body
106
105
  */
107
- async proxySetTimeouts (url, method, body) {
106
+ async proxySetTimeouts(url, method, body) {
108
107
  let response, resBody;
109
108
 
110
109
  const timeoutRequestObjects = this.getTimeoutRequestObjects(body);
111
- this.log.debug(`Will send the following request bodies to /timeouts: ${JSON.stringify(timeoutRequestObjects)}`);
110
+ this.log.debug(
111
+ `Will send the following request bodies to /timeouts: ${JSON.stringify(
112
+ timeoutRequestObjects
113
+ )}`
114
+ );
112
115
  for (const timeoutObj of timeoutRequestObjects) {
113
116
  [response, resBody] = await this.proxyFunc(url, method, timeoutObj);
114
117
 
@@ -127,7 +130,7 @@ class ProtocolConverter {
127
130
  return [response, resBody];
128
131
  }
129
132
 
130
- async proxySetWindow (url, method, body) {
133
+ async proxySetWindow(url, method, body) {
131
134
  const bodyObj = util.safeJsonParse(body);
132
135
  if (_.isPlainObject(bodyObj)) {
133
136
  if (this.downstreamProtocol === W3C && _.has(bodyObj, 'name') && !_.has(bodyObj, 'handle')) {
@@ -137,7 +140,11 @@ class ProtocolConverter {
137
140
  handle: bodyObj.name,
138
141
  });
139
142
  }
140
- if (this.downstreamProtocol === MJSONWP && _.has(bodyObj, 'handle') && !_.has(bodyObj, 'name')) {
143
+ if (
144
+ this.downstreamProtocol === MJSONWP &&
145
+ _.has(bodyObj, 'handle') &&
146
+ !_.has(bodyObj, 'name')
147
+ ) {
141
148
  this.log.debug(`Copied 'handle' value '${bodyObj.handle}' to 'name' as per JSONWP spec`);
142
149
  return await this.proxyFunc(url, method, {
143
150
  ...bodyObj,
@@ -149,48 +156,54 @@ class ProtocolConverter {
149
156
  return await this.proxyFunc(url, method, body);
150
157
  }
151
158
 
152
- async proxySetValue (url, method, body) {
159
+ async proxySetValue(url, method, body) {
153
160
  const bodyObj = util.safeJsonParse(body);
154
161
  if (_.isPlainObject(bodyObj) && (util.hasValue(bodyObj.text) || util.hasValue(bodyObj.value))) {
155
162
  let {text, value} = bodyObj;
156
163
  if (util.hasValue(text) && !util.hasValue(value)) {
157
- value = _.isString(text)
158
- ? [...text]
159
- : (_.isArray(text) ? text : []);
160
- this.log.debug(`Added 'value' property ${JSON.stringify(value)} to 'setValue' request body`);
164
+ value = _.isString(text) ? [...text] : _.isArray(text) ? text : [];
165
+ this.log.debug(
166
+ `Added 'value' property ${JSON.stringify(value)} to 'setValue' request body`
167
+ );
161
168
  } else if (!util.hasValue(text) && util.hasValue(value)) {
162
- text = _.isArray(value)
163
- ? value.join('')
164
- : (_.isString(value) ? value : '');
169
+ text = _.isArray(value) ? value.join('') : _.isString(value) ? value : '';
165
170
  this.log.debug(`Added 'text' property ${JSON.stringify(text)} to 'setValue' request body`);
166
171
  }
167
- return await this.proxyFunc(url, method, Object.assign({}, bodyObj, {
168
- text,
169
- value,
170
- }));
172
+ return await this.proxyFunc(
173
+ url,
174
+ method,
175
+ Object.assign({}, bodyObj, {
176
+ text,
177
+ value,
178
+ })
179
+ );
171
180
  }
172
181
 
173
182
  return await this.proxyFunc(url, method, body);
174
183
  }
175
184
 
176
- async proxySetFrame (url, method, body) {
185
+ async proxySetFrame(url, method, body) {
177
186
  const bodyObj = util.safeJsonParse(body);
178
187
  return _.has(bodyObj, 'id') && _.isPlainObject(bodyObj.id)
179
188
  ? await this.proxyFunc(url, method, {
180
- ...bodyObj,
181
- id: duplicateKeys(bodyObj.id, MJSONWP_ELEMENT_KEY, W3C_ELEMENT_KEY),
182
- })
189
+ ...bodyObj,
190
+ id: duplicateKeys(bodyObj.id, MJSONWP_ELEMENT_KEY, W3C_ELEMENT_KEY),
191
+ })
183
192
  : await this.proxyFunc(url, method, body);
184
193
  }
185
194
 
186
- async proxyPerformActions (url, method, body) {
195
+ async proxyPerformActions(url, method, body) {
187
196
  const bodyObj = util.safeJsonParse(body);
188
197
  return _.isPlainObject(bodyObj)
189
- ? await this.proxyFunc(url, method, duplicateKeys(bodyObj, MJSONWP_ELEMENT_KEY, W3C_ELEMENT_KEY))
198
+ ? await this.proxyFunc(
199
+ url,
200
+ method,
201
+ duplicateKeys(bodyObj, MJSONWP_ELEMENT_KEY, W3C_ELEMENT_KEY)
202
+ )
190
203
  : await this.proxyFunc(url, method, body);
191
204
  }
192
205
 
193
- async proxyReleaseActions (url, method) {
206
+ async proxyReleaseActions(url, method) {
194
207
  return await this.proxyFunc(url, method);
195
208
  }
196
209
 
@@ -204,7 +217,7 @@ class ProtocolConverter {
204
217
  * @param {?string|object} body
205
218
  * @returns The proxyfying result as [response, responseBody] tuple
206
219
  */
207
- async convertAndProxy (commandName, url, method, body) {
220
+ async convertAndProxy(commandName, url, method, body) {
208
221
  if (!this.downstreamProtocol) {
209
222
  return await this.proxyFunc(url, method, body);
210
223
  }
@@ -220,7 +233,7 @@ class ProtocolConverter {
220
233
  case 'performActions':
221
234
  return await this.proxyPerformActions(url, method, body);
222
235
  case 'releaseActions':
223
- return await this.proxyReleaseActions(url, method, body);
236
+ return await this.proxyReleaseActions(url, method);
224
237
  case 'setFrame':
225
238
  return await this.proxySetFrame(url, method, body);
226
239
  default:
@@ -233,16 +246,19 @@ class ProtocolConverter {
233
246
  continue;
234
247
  }
235
248
 
236
- const rewrittenUrl = this.downstreamProtocol === MJSONWP
237
- ? jsonwpConverter(url)
238
- : w3cConverter(url);
249
+ const rewrittenUrl =
250
+ this.downstreamProtocol === MJSONWP ? jsonwpConverter(url) : w3cConverter(url);
239
251
  if (rewrittenUrl === url) {
240
- this.log.debug(`Did not know how to rewrite the original URL '${url}' ` +
241
- `for ${this.downstreamProtocol} protocol`);
252
+ this.log.debug(
253
+ `Did not know how to rewrite the original URL '${url}' ` +
254
+ `for ${this.downstreamProtocol} protocol`
255
+ );
242
256
  break;
243
257
  }
244
- this.log.info(`Rewrote the original URL '${url}' to '${rewrittenUrl}' ` +
245
- `for ${this.downstreamProtocol} protocol`);
258
+ this.log.info(
259
+ `Rewrote the original URL '${url}' to '${rewrittenUrl}' ` +
260
+ `for ${this.downstreamProtocol} protocol`
261
+ );
246
262
  return await this.proxyFunc(rewrittenUrl, method, body);
247
263
  }
248
264