@appium/base-driver 8.3.0 → 8.4.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.
Files changed (202) hide show
  1. package/build/lib/basedriver/capabilities.d.ts +80 -0
  2. package/build/lib/basedriver/capabilities.d.ts.map +1 -0
  3. package/build/lib/basedriver/capabilities.js +12 -13
  4. package/build/lib/basedriver/commands/event.d.ts +9 -0
  5. package/build/lib/basedriver/commands/event.d.ts.map +1 -0
  6. package/build/lib/basedriver/commands/event.js +21 -23
  7. package/build/lib/basedriver/commands/find.d.ts +11 -0
  8. package/build/lib/basedriver/commands/find.d.ts.map +1 -0
  9. package/build/lib/basedriver/commands/find.js +42 -37
  10. package/build/lib/basedriver/commands/index.d.ts +8 -0
  11. package/build/lib/basedriver/commands/index.d.ts.map +1 -0
  12. package/build/lib/basedriver/commands/index.js +17 -16
  13. package/build/lib/basedriver/commands/log.d.ts +12 -0
  14. package/build/lib/basedriver/commands/log.d.ts.map +1 -0
  15. package/build/lib/basedriver/commands/log.js +23 -27
  16. package/build/lib/basedriver/commands/session.d.ts +11 -0
  17. package/build/lib/basedriver/commands/session.d.ts.map +1 -0
  18. package/build/lib/basedriver/commands/session.js +21 -149
  19. package/build/lib/basedriver/commands/settings.d.ts +10 -0
  20. package/build/lib/basedriver/commands/settings.d.ts.map +1 -0
  21. package/build/lib/basedriver/commands/settings.js +19 -19
  22. package/build/lib/basedriver/commands/timeout.d.ts +8 -0
  23. package/build/lib/basedriver/commands/timeout.d.ts.map +1 -0
  24. package/build/lib/basedriver/commands/timeout.js +118 -139
  25. package/build/lib/basedriver/core.d.ts +235 -0
  26. package/build/lib/basedriver/core.d.ts.map +1 -0
  27. package/build/lib/basedriver/core.js +283 -0
  28. package/build/lib/basedriver/desired-caps.d.ts +5 -0
  29. package/build/lib/basedriver/desired-caps.d.ts.map +1 -0
  30. package/build/lib/basedriver/desired-caps.js +2 -4
  31. package/build/lib/basedriver/device-settings.d.ts +32 -0
  32. package/build/lib/basedriver/device-settings.d.ts.map +1 -0
  33. package/build/lib/basedriver/device-settings.js +20 -14
  34. package/build/lib/basedriver/driver.d.ts +83 -0
  35. package/build/lib/basedriver/driver.d.ts.map +1 -0
  36. package/build/lib/basedriver/driver.js +101 -256
  37. package/build/lib/basedriver/helpers.d.ts +132 -0
  38. package/build/lib/basedriver/helpers.d.ts.map +1 -0
  39. package/build/lib/basedriver/helpers.js +16 -2
  40. package/build/lib/basedriver/logger.d.ts +3 -0
  41. package/build/lib/basedriver/logger.d.ts.map +1 -0
  42. package/build/lib/basedriver/logger.js +2 -4
  43. package/build/lib/constants.d.ts +9 -0
  44. package/build/lib/constants.d.ts.map +1 -0
  45. package/build/lib/constants.js +2 -4
  46. package/build/lib/express/crash.d.ts +3 -0
  47. package/build/lib/express/crash.d.ts.map +1 -0
  48. package/build/lib/express/crash.js +2 -4
  49. package/build/lib/express/express-logging.d.ts +3 -0
  50. package/build/lib/express/express-logging.d.ts.map +1 -0
  51. package/build/lib/express/express-logging.js +2 -4
  52. package/build/lib/express/idempotency.d.ts +2 -0
  53. package/build/lib/express/idempotency.d.ts.map +1 -0
  54. package/build/lib/express/idempotency.js +2 -4
  55. package/build/lib/express/logger.d.ts +3 -0
  56. package/build/lib/express/logger.d.ts.map +1 -0
  57. package/build/lib/express/logger.js +2 -4
  58. package/build/lib/express/middleware.d.ts +9 -0
  59. package/build/lib/express/middleware.d.ts.map +1 -0
  60. package/build/lib/express/middleware.js +2 -4
  61. package/build/lib/express/server.d.ts +10 -0
  62. package/build/lib/express/server.d.ts.map +1 -0
  63. package/build/lib/express/server.js +2 -4
  64. package/build/lib/express/static.d.ts +6 -0
  65. package/build/lib/express/static.d.ts.map +1 -0
  66. package/build/lib/express/static.js +2 -4
  67. package/build/lib/express/websocket.d.ts +64 -0
  68. package/build/lib/express/websocket.d.ts.map +1 -0
  69. package/build/lib/express/websocket.js +40 -41
  70. package/build/lib/helpers/capabilities.d.ts +13 -0
  71. package/build/lib/helpers/capabilities.d.ts.map +1 -0
  72. package/build/lib/helpers/capabilities.js +40 -2
  73. package/build/lib/index.d.ts +183 -0
  74. package/build/lib/index.d.ts.map +1 -0
  75. package/build/lib/index.js +41 -23
  76. package/build/lib/jsonwp-proxy/protocol-converter.d.ts +48 -0
  77. package/build/lib/jsonwp-proxy/protocol-converter.d.ts.map +1 -0
  78. package/build/lib/jsonwp-proxy/protocol-converter.js +2 -4
  79. package/build/lib/jsonwp-proxy/proxy.d.ts +41 -0
  80. package/build/lib/jsonwp-proxy/proxy.d.ts.map +1 -0
  81. package/build/lib/jsonwp-proxy/proxy.js +25 -9
  82. package/build/lib/jsonwp-status/status.d.ts +159 -0
  83. package/build/lib/jsonwp-status/status.d.ts.map +1 -0
  84. package/build/lib/jsonwp-status/status.js +2 -4
  85. package/build/lib/protocol/errors.d.ts +310 -0
  86. package/build/lib/protocol/errors.d.ts.map +1 -0
  87. package/build/lib/protocol/errors.js +82 -5
  88. package/build/lib/protocol/helpers.d.ts +22 -0
  89. package/build/lib/protocol/helpers.d.ts.map +1 -0
  90. package/build/lib/protocol/helpers.js +2 -4
  91. package/build/lib/protocol/index.d.ts +16 -0
  92. package/build/lib/protocol/index.d.ts.map +1 -0
  93. package/build/lib/protocol/index.js +8 -10
  94. package/build/lib/protocol/protocol.d.ts +11 -0
  95. package/build/lib/protocol/protocol.d.ts.map +1 -0
  96. package/build/lib/protocol/protocol.js +3 -9
  97. package/build/lib/protocol/routes.d.ts +6 -0
  98. package/build/lib/protocol/routes.d.ts.map +1 -0
  99. package/build/lib/protocol/routes.js +18 -4
  100. package/build/lib/protocol/validators.d.ts +8 -0
  101. package/build/lib/protocol/validators.d.ts.map +1 -0
  102. package/build/lib/protocol/validators.js +2 -4
  103. package/build/test/basedriver/README.md +5 -0
  104. package/build/test/basedriver/driver-e2e-tests.js +2 -4
  105. package/build/test/basedriver/driver-tests.js +31 -6
  106. package/build/test/basedriver/index.js +2 -4
  107. package/build/test/e2e/basedriver/driver.e2e.spec.js +15 -0
  108. package/build/test/e2e/basedriver/helpers.e2e.spec.js +192 -0
  109. package/build/test/e2e/basedriver/websockets.e2e.spec.js +87 -0
  110. package/build/test/e2e/express/server.e2e.spec.js +159 -0
  111. package/build/test/e2e/jsonwp-proxy/proxy.e2e.spec.js +59 -0
  112. package/build/test/e2e/protocol/fake-driver.js +163 -0
  113. package/build/test/e2e/protocol/helpers.js +25 -0
  114. package/build/test/e2e/protocol/protocol.e2e.spec.js +1186 -0
  115. package/build/test/helpers.js +2 -4
  116. package/build/test/unit/basedriver/capabilities.spec.js +672 -0
  117. package/build/test/unit/basedriver/capability.spec.js +353 -0
  118. package/build/test/unit/basedriver/commands/event.spec.js +110 -0
  119. package/build/test/unit/basedriver/commands/log.spec.js +92 -0
  120. package/build/test/unit/basedriver/driver.spec.js +15 -0
  121. package/build/test/unit/basedriver/helpers.spec.js +151 -0
  122. package/build/test/unit/basedriver/timeout.spec.js +135 -0
  123. package/build/test/unit/express/server.spec.js +155 -0
  124. package/build/test/unit/express/static.spec.js +26 -0
  125. package/build/test/unit/jsonwp-proxy/mock-request.js +91 -0
  126. package/build/test/unit/jsonwp-proxy/protocol-converter.spec.js +171 -0
  127. package/build/test/unit/jsonwp-proxy/proxy.spec.js +292 -0
  128. package/build/test/unit/jsonwp-proxy/url.spec.js +165 -0
  129. package/build/test/unit/jsonwp-status/status.spec.js +34 -0
  130. package/build/test/unit/protocol/errors.spec.js +390 -0
  131. package/build/test/unit/protocol/routes.spec.js +80 -0
  132. package/build/test/unit/protocol/validator.spec.js +149 -0
  133. package/build/tsconfig.tsbuildinfo +1 -0
  134. package/lib/basedriver/capabilities.js +49 -10
  135. package/lib/basedriver/commands/event.js +49 -31
  136. package/lib/basedriver/commands/find.js +108 -43
  137. package/lib/basedriver/commands/index.js +25 -19
  138. package/lib/basedriver/commands/log.js +60 -33
  139. package/lib/basedriver/commands/session.js +39 -141
  140. package/lib/basedriver/commands/settings.js +33 -13
  141. package/lib/basedriver/commands/timeout.js +153 -153
  142. package/lib/basedriver/core.js +497 -0
  143. package/lib/basedriver/desired-caps.js +1 -1
  144. package/lib/basedriver/device-settings.js +47 -12
  145. package/lib/basedriver/driver.js +272 -383
  146. package/lib/basedriver/helpers.js +18 -2
  147. package/lib/express/websocket.js +35 -32
  148. package/lib/helpers/capabilities.js +60 -1
  149. package/lib/index.js +16 -12
  150. package/lib/jsonwp-proxy/proxy.js +26 -6
  151. package/lib/protocol/errors.js +42 -42
  152. package/lib/protocol/index.js +4 -4
  153. package/lib/protocol/protocol.js +1 -3
  154. package/lib/protocol/routes.js +9 -0
  155. package/package.json +22 -14
  156. package/test/basedriver/README.md +5 -0
  157. package/test/basedriver/driver-e2e-tests.js +1 -1
  158. package/test/basedriver/driver-tests.js +31 -2
  159. package/build/test/basedriver/capabilities-specs.js +0 -674
  160. package/build/test/basedriver/capability-specs.js +0 -355
  161. package/build/test/basedriver/commands/event-specs.js +0 -112
  162. package/build/test/basedriver/commands/log-specs.js +0 -87
  163. package/build/test/basedriver/driver-e2e-specs.js +0 -17
  164. package/build/test/basedriver/driver-specs.js +0 -17
  165. package/build/test/basedriver/helpers-e2e-specs.js +0 -194
  166. package/build/test/basedriver/helpers-specs.js +0 -153
  167. package/build/test/basedriver/timeout-specs.js +0 -137
  168. package/build/test/basedriver/websockets-e2e-specs.js +0 -84
  169. package/build/test/express/server-e2e-specs.js +0 -161
  170. package/build/test/express/server-specs.js +0 -157
  171. package/build/test/express/static-specs.js +0 -28
  172. package/build/test/jsonwp-proxy/mock-request.js +0 -93
  173. package/build/test/jsonwp-proxy/protocol-converter-specs.js +0 -173
  174. package/build/test/jsonwp-proxy/proxy-e2e-specs.js +0 -61
  175. package/build/test/jsonwp-proxy/proxy-specs.js +0 -294
  176. package/build/test/jsonwp-proxy/url-specs.js +0 -167
  177. package/build/test/jsonwp-status/status-specs.js +0 -36
  178. package/build/test/protocol/errors-specs.js +0 -388
  179. package/build/test/protocol/fake-driver.js +0 -165
  180. package/build/test/protocol/helpers.js +0 -27
  181. package/build/test/protocol/protocol-e2e-specs.js +0 -1188
  182. package/build/test/protocol/routes-specs.js +0 -82
  183. package/build/test/protocol/validator-specs.js +0 -151
  184. package/index.d.ts +0 -386
  185. package/test/basedriver/capabilities-specs.js +0 -537
  186. package/test/basedriver/capability-specs.js +0 -383
  187. package/test/basedriver/commands/event-specs.js +0 -74
  188. package/test/basedriver/commands/log-specs.js +0 -79
  189. package/test/basedriver/driver-e2e-specs.js +0 -8
  190. package/test/basedriver/driver-specs.js +0 -8
  191. package/test/basedriver/fixtures/BadZippedApp.zip +0 -1
  192. package/test/basedriver/fixtures/FakeAndroidApp.apk +0 -1
  193. package/test/basedriver/fixtures/FakeAndroidApp.asd +0 -0
  194. package/test/basedriver/fixtures/FakeIOSApp.app +0 -1
  195. package/test/basedriver/fixtures/FakeIOSApp.app.zip +0 -0
  196. package/test/basedriver/fixtures/FakeIOSApp.ipa +0 -0
  197. package/test/basedriver/fixtures/custom-element-finder-bad.js +0 -5
  198. package/test/basedriver/fixtures/custom-element-finder.js +0 -29
  199. package/test/basedriver/helpers-e2e-specs.js +0 -187
  200. package/test/basedriver/helpers-specs.js +0 -137
  201. package/test/basedriver/timeout-specs.js +0 -128
  202. package/test/basedriver/websockets-e2e-specs.js +0 -75
@@ -1,167 +1,167 @@
1
- import { waitForCondition } from 'asyncbox';
1
+ // @ts-check
2
+
3
+ /* eslint-disable no-unused-vars */
4
+ /* eslint-disable require-await */
5
+ import {waitForCondition} from 'asyncbox';
2
6
  import _ from 'lodash';
3
- import { util } from '@appium/support';
4
- import { errors } from '../../protocol';
7
+ import {util} from '@appium/support';
8
+ import {errors} from '../../protocol';
5
9
 
10
+ const MIN_TIMEOUT = 0;
6
11
 
7
- let commands = {}, helpers = {}, extensions = {};
12
+ /**
13
+ * @param {import('../driver').BaseDriverBase} Base
14
+ * @returns {TimeoutBase}
15
+ */
16
+ export function TimeoutMixin (Base) {
17
+
18
+ /**
19
+ * @implements {ITimeoutCommands}
20
+ */
21
+ class TimeoutCommands extends Base {
22
+ async timeouts (type, ms, script, pageLoad, implicit) {
23
+ if (util.hasValue(type) && util.hasValue(ms)) {
24
+ this.log.debug(
25
+ `MJSONWP timeout arguments: ${JSON.stringify({type, ms})}}`,
26
+ );
27
+
28
+ switch (type) {
29
+ case 'command':
30
+ await this.newCommandTimeout(ms);
31
+ return;
32
+ case 'implicit':
33
+ await this.implicitWaitMJSONWP(ms);
34
+ return;
35
+ case 'page load':
36
+ await this.pageLoadTimeoutMJSONWP(ms);
37
+ return;
38
+ case 'script':
39
+ await this.scriptTimeoutMJSONWP(ms);
40
+ return;
41
+ default:
42
+ throw new Error(
43
+ `'${type}' type is not supported for MJSONWP timeout`,
44
+ );
45
+ }
46
+ }
8
47
 
9
- const MIN_TIMEOUT = 0;
48
+ // Otherwise assume it is W3C protocol
49
+ this.log.debug(
50
+ `W3C timeout argument: ${JSON.stringify({
51
+ script,
52
+ pageLoad,
53
+ implicit,
54
+ })}}`,
55
+ );
56
+ if (util.hasValue(script)) {
57
+ await this.scriptTimeoutW3C(script);
58
+ }
59
+ if (util.hasValue(pageLoad)) {
60
+ await this.pageLoadTimeoutW3C(pageLoad);
61
+ }
62
+ if (util.hasValue(implicit)) {
63
+ await this.implicitWaitW3C(implicit);
64
+ }
65
+ }
10
66
 
11
- commands.timeouts = async function timeouts (type, ms, script, pageLoad, implicit) {
12
- if (util.hasValue(type) && util.hasValue(ms)) {
13
- this.log.debug(`MJSONWP timeout arguments: ${JSON.stringify({type, ms})}}`);
14
-
15
- switch (type) {
16
- case 'command':
17
- await this.newCommandTimeout(ms);
18
- return;
19
- case 'implicit':
20
- await this.implicitWaitMJSONWP(ms);
21
- return;
22
- case 'page load':
23
- await this.pageLoadTimeoutMJSONWP(ms);
24
- return;
25
- case 'script':
26
- await this.scriptTimeoutMJSONWP(ms);
27
- return;
28
- default:
29
- throw new Error(`'${type}' type is not supported for MJSONWP timeout`);
67
+ async getTimeouts () {
68
+ return {
69
+ command: this.newCommandTimeoutMs,
70
+ implicit: this.implicitWaitMs,
71
+ };
30
72
  }
31
- }
32
73
 
33
- // Otherwise assume it is W3C protocol
34
- this.log.debug(`W3C timeout argument: ${JSON.stringify({script, pageLoad, implicit})}}`);
35
- if (util.hasValue(script)) {
36
- await this.scriptTimeoutW3C(script);
37
- }
38
- if (util.hasValue(pageLoad)) {
39
- await this.pageLoadTimeoutW3C(pageLoad);
40
- }
41
- if (util.hasValue(implicit)) {
42
- await this.implicitWaitW3C(implicit);
43
- }
44
- };
45
-
46
- commands.getTimeouts = async function getTimeouts () { // eslint-disable-line require-await
47
- return {
48
- command: this.newCommandTimeoutMs,
49
- implicit: this.implicitWaitMs,
50
- };
51
- };
52
-
53
- // implicit
54
- commands.implicitWaitW3C = async function implicitWaitW3C (ms) {
55
- await this.implicitWait(ms);
56
- };
57
-
58
- commands.implicitWaitMJSONWP = async function implicitWaitMJSONWP (ms) {
59
- await this.implicitWait(ms);
60
- };
61
-
62
- commands.implicitWait = async function implicitWait (ms) {
63
- await this.setImplicitWait(this.parseTimeoutArgument(ms));
64
- };
65
-
66
- helpers.setImplicitWait = function setImplicitWait (ms) { // eslint-disable-line require-await
67
- this.implicitWaitMs = ms;
68
- this.log.debug(`Set implicit wait to ${ms}ms`);
69
- if (this.managedDrivers && this.managedDrivers.length) {
70
- this.log.debug('Setting implicit wait on managed drivers');
71
- for (let driver of this.managedDrivers) {
72
- if (_.isFunction(driver.setImplicitWait)) {
73
- driver.setImplicitWait(ms);
74
+ // implicit
75
+ async implicitWaitW3C (ms) {
76
+ await this.implicitWait(ms);
77
+ }
78
+
79
+ async implicitWaitMJSONWP (ms) {
80
+ await this.implicitWait(ms);
81
+ }
82
+
83
+ async implicitWait (ms) {
84
+ await this.setImplicitWait(this.parseTimeoutArgument(ms));
85
+ }
86
+
87
+ // pageLoad
88
+ async pageLoadTimeoutW3C (ms) {
89
+ throw new errors.NotImplementedError('Not implemented yet for pageLoad.');
90
+ }
91
+
92
+ async pageLoadTimeoutMJSONWP (ms) {
93
+ throw new errors.NotImplementedError('Not implemented yet for pageLoad.');
94
+ }
95
+
96
+ // script
97
+ async scriptTimeoutW3C (ms) {
98
+ throw new errors.NotImplementedError('Not implemented yet for script.');
99
+ }
100
+
101
+ async scriptTimeoutMJSONWP (ms) {
102
+ throw new errors.NotImplementedError('Not implemented yet for script.');
103
+ }
104
+
105
+ // command
106
+ async newCommandTimeout (ms) {
107
+ this.setNewCommandTimeout(this.parseTimeoutArgument(ms));
108
+ }
109
+
110
+ setImplicitWait (ms) {
111
+ // eslint-disable-line require-await
112
+ this.implicitWaitMs = ms;
113
+ this.log.debug(`Set implicit wait to ${ms}ms`);
114
+ if (this.managedDrivers && this.managedDrivers.length) {
115
+ this.log.debug('Setting implicit wait on managed drivers');
116
+ for (let driver of this.managedDrivers) {
117
+ if (_.isFunction(driver.setImplicitWait)) {
118
+ driver.setImplicitWait(ms);
119
+ }
120
+ }
74
121
  }
75
122
  }
76
- }
77
- };
78
-
79
- // pageLoad
80
- // eslint-disable-next-line no-unused-vars
81
- commands.pageLoadTimeoutW3C = async function pageLoadTimeoutW3C (ms) { // eslint-disable-line require-await
82
- throw new errors.NotImplementedError('Not implemented yet for pageLoad.');
83
- };
84
-
85
- // eslint-disable-next-line no-unused-vars
86
- commands.pageLoadTimeoutMJSONWP = async function pageLoadTimeoutMJSONWP (ms) { // eslint-disable-line require-await
87
- throw new errors.NotImplementedError('Not implemented yet for pageLoad.');
88
- };
89
-
90
- // script
91
- // eslint-disable-next-line no-unused-vars
92
- commands.scriptTimeoutW3C = async function scriptTimeoutW3C (ms) { // eslint-disable-line require-await
93
- throw new errors.NotImplementedError('Not implemented yet for script.');
94
- };
95
-
96
- // eslint-disable-next-line no-unused-vars
97
- commands.scriptTimeoutMJSONWP = async function scriptTimeoutMJSONWP (ms) { // eslint-disable-line require-await
98
- throw new errors.NotImplementedError('Not implemented yet for script.');
99
- };
100
-
101
- // command
102
- commands.newCommandTimeout = async function newCommandTimeout (ms) { // eslint-disable-line require-await
103
- this.setNewCommandTimeout(this.parseTimeoutArgument(ms));
104
- };
105
-
106
- helpers.setNewCommandTimeout = function setNewCommandTimeout (ms) {
107
- this.newCommandTimeoutMs = ms;
108
- this.log.debug(`Set new command timeout to ${ms}ms`);
109
- if (this.managedDrivers && this.managedDrivers.length) {
110
- this.log.debug('Setting new command timeout on managed drivers');
111
- for (let driver of this.managedDrivers) {
112
- if (_.isFunction(driver.setNewCommandTimeout)) {
113
- driver.setNewCommandTimeout(ms);
123
+
124
+ setNewCommandTimeout (ms) {
125
+ this.newCommandTimeoutMs = ms;
126
+ this.log.debug(`Set new command timeout to ${ms}ms`);
127
+ if (this.managedDrivers && this.managedDrivers.length) {
128
+ this.log.debug('Setting new command timeout on managed drivers');
129
+ for (let driver of this.managedDrivers) {
130
+ if (_.isFunction(driver.setNewCommandTimeout)) {
131
+ driver.setNewCommandTimeout(ms);
132
+ }
133
+ }
114
134
  }
115
135
  }
116
- }
117
- };
118
136
 
119
- helpers.clearNewCommandTimeout = function clearNewCommandTimeout () {
120
- if (this.noCommandTimer) {
121
- clearTimeout(this.noCommandTimer);
122
- this.noCommandTimer = null;
123
- }
124
- };
125
-
126
- helpers.startNewCommandTimeout = function startNewCommandTimeout () {
127
- // make sure there are no rogue timeouts
128
- this.clearNewCommandTimeout();
129
-
130
- // if command timeout is 0, it is disabled
131
- if (!this.newCommandTimeoutMs) return; // eslint-disable-line curly
132
-
133
- this.noCommandTimer = setTimeout(async () => {
134
- this.log.warn(`Shutting down because we waited ` +
135
- `${this.newCommandTimeoutMs / 1000.0} seconds for a command`);
136
- const errorMessage = `New Command Timeout of ` +
137
- `${this.newCommandTimeoutMs / 1000.0} seconds ` +
138
- `expired. Try customizing the timeout using the ` +
139
- `'newCommandTimeout' desired capability`;
140
- await this.startUnexpectedShutdown(new Error(errorMessage));
141
- }, this.newCommandTimeoutMs);
142
- };
143
-
144
- helpers.implicitWaitForCondition = async function implicitWaitForCondition (condFn) {
145
- this.log.debug(`Waiting up to ${this.implicitWaitMs} ms for condition`);
146
- let wrappedCondFn = async (...args) => {
147
- // reset command timeout
148
- this.clearNewCommandTimeout();
149
-
150
- return await condFn(...args);
151
- };
152
- return await waitForCondition(wrappedCondFn, {
153
- waitMs: this.implicitWaitMs, intervalMs: 500, logger: this.log
154
- });
155
- };
156
-
157
- helpers.parseTimeoutArgument = function parseTimeoutArgument (ms) {
158
- let duration = parseInt(ms, 10);
159
- if (_.isNaN(duration) || duration < MIN_TIMEOUT) {
160
- throw new errors.UnknownError(`Invalid timeout value '${ms}'`);
137
+ async implicitWaitForCondition (condFn) {
138
+ this.log.debug(`Waiting up to ${this.implicitWaitMs} ms for condition`);
139
+ let wrappedCondFn = async (...args) => {
140
+ // reset command timeout
141
+ await this.clearNewCommandTimeout();
142
+
143
+ return await condFn(...args);
144
+ };
145
+ return await waitForCondition(wrappedCondFn, {
146
+ waitMs: this.implicitWaitMs,
147
+ intervalMs: 500,
148
+ logger: this.log,
149
+ });
150
+ }
151
+
152
+ parseTimeoutArgument (ms) {
153
+ let duration = parseInt(ms, 10);
154
+ if (_.isNaN(duration) || duration < MIN_TIMEOUT) {
155
+ throw new errors.UnknownError(`Invalid timeout value '${ms}'`);
156
+ }
157
+ return duration;
158
+ }
161
159
  }
162
- return duration;
163
- };
164
160
 
165
- Object.assign(extensions, commands, helpers);
166
- export { commands, helpers };
167
- export default extensions;
161
+ return TimeoutCommands;
162
+ }
163
+
164
+ /**
165
+ * @typedef {import('@appium/types').TimeoutCommands} ITimeoutCommands
166
+ * @typedef {import('../driver').BaseDriverBase<ITimeoutCommands>} TimeoutBase
167
+ */