@appium/base-driver 8.2.4 → 8.4.0
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.
- package/build/lib/basedriver/capabilities.d.ts +80 -0
- package/build/lib/basedriver/capabilities.d.ts.map +1 -0
- package/build/lib/basedriver/capabilities.js +12 -13
- package/build/lib/basedriver/commands/event.d.ts +9 -0
- package/build/lib/basedriver/commands/event.d.ts.map +1 -0
- package/build/lib/basedriver/commands/event.js +21 -23
- package/build/lib/basedriver/commands/find.d.ts +11 -0
- package/build/lib/basedriver/commands/find.d.ts.map +1 -0
- package/build/lib/basedriver/commands/find.js +41 -43
- package/build/lib/basedriver/commands/index.d.ts +8 -0
- package/build/lib/basedriver/commands/index.d.ts.map +1 -0
- package/build/lib/basedriver/commands/index.js +17 -16
- package/build/lib/basedriver/commands/log.d.ts +12 -0
- package/build/lib/basedriver/commands/log.d.ts.map +1 -0
- package/build/lib/basedriver/commands/log.js +23 -30
- package/build/lib/basedriver/commands/session.d.ts +11 -0
- package/build/lib/basedriver/commands/session.d.ts.map +1 -0
- package/build/lib/basedriver/commands/session.js +21 -158
- package/build/lib/basedriver/commands/settings.d.ts +10 -0
- package/build/lib/basedriver/commands/settings.d.ts.map +1 -0
- package/build/lib/basedriver/commands/settings.js +18 -22
- package/build/lib/basedriver/commands/timeout.d.ts +8 -0
- package/build/lib/basedriver/commands/timeout.d.ts.map +1 -0
- package/build/lib/basedriver/commands/timeout.js +118 -144
- package/build/lib/basedriver/core.d.ts +235 -0
- package/build/lib/basedriver/core.d.ts.map +1 -0
- package/build/lib/basedriver/core.js +283 -0
- package/build/lib/basedriver/desired-caps.d.ts +5 -0
- package/build/lib/basedriver/desired-caps.d.ts.map +1 -0
- package/build/lib/basedriver/desired-caps.js +2 -4
- package/build/lib/basedriver/device-settings.d.ts +32 -0
- package/build/lib/basedriver/device-settings.d.ts.map +1 -0
- package/build/lib/basedriver/device-settings.js +33 -15
- package/build/lib/basedriver/driver.d.ts +83 -0
- package/build/lib/basedriver/driver.d.ts.map +1 -0
- package/build/lib/basedriver/driver.js +104 -257
- package/build/lib/basedriver/helpers.d.ts +132 -0
- package/build/lib/basedriver/helpers.d.ts.map +1 -0
- package/build/lib/basedriver/helpers.js +24 -10
- package/build/lib/basedriver/logger.d.ts +3 -0
- package/build/lib/basedriver/logger.d.ts.map +1 -0
- package/build/lib/basedriver/logger.js +2 -4
- package/build/lib/constants.d.ts +9 -0
- package/build/lib/constants.d.ts.map +1 -0
- package/build/lib/constants.js +2 -4
- package/build/lib/express/crash.d.ts +3 -0
- package/build/lib/express/crash.d.ts.map +1 -0
- package/build/lib/express/crash.js +2 -4
- package/build/lib/express/express-logging.d.ts +3 -0
- package/build/lib/express/express-logging.d.ts.map +1 -0
- package/build/lib/express/express-logging.js +3 -5
- package/build/lib/express/idempotency.d.ts +2 -0
- package/build/lib/express/idempotency.d.ts.map +1 -0
- package/build/lib/express/idempotency.js +3 -5
- package/build/lib/express/logger.d.ts +3 -0
- package/build/lib/express/logger.d.ts.map +1 -0
- package/build/lib/express/logger.js +2 -4
- package/build/lib/express/middleware.d.ts +9 -0
- package/build/lib/express/middleware.d.ts.map +1 -0
- package/build/lib/express/middleware.js +2 -4
- package/build/lib/express/server.d.ts +10 -0
- package/build/lib/express/server.d.ts.map +1 -0
- package/build/lib/express/server.js +2 -4
- package/build/lib/express/static.d.ts +6 -0
- package/build/lib/express/static.d.ts.map +1 -0
- package/build/lib/express/static.js +2 -4
- package/build/lib/express/websocket.d.ts +64 -0
- package/build/lib/express/websocket.d.ts.map +1 -0
- package/build/lib/express/websocket.js +2 -4
- package/build/lib/helpers/capabilities.d.ts +13 -0
- package/build/lib/helpers/capabilities.d.ts.map +1 -0
- package/build/lib/helpers/capabilities.js +77 -0
- package/build/lib/index.d.ts +183 -0
- package/build/lib/index.d.ts.map +1 -0
- package/build/lib/index.js +41 -25
- package/build/lib/jsonwp-proxy/protocol-converter.d.ts +48 -0
- package/build/lib/jsonwp-proxy/protocol-converter.d.ts.map +1 -0
- package/build/lib/jsonwp-proxy/protocol-converter.js +19 -15
- package/build/lib/jsonwp-proxy/proxy.d.ts +41 -0
- package/build/lib/jsonwp-proxy/proxy.d.ts.map +1 -0
- package/build/lib/jsonwp-proxy/proxy.js +20 -15
- package/build/lib/jsonwp-status/status.d.ts +159 -0
- package/build/lib/jsonwp-status/status.d.ts.map +1 -0
- package/build/lib/jsonwp-status/status.js +2 -4
- package/build/lib/protocol/errors.d.ts +310 -0
- package/build/lib/protocol/errors.d.ts.map +1 -0
- package/build/lib/protocol/errors.js +82 -5
- package/build/lib/protocol/helpers.d.ts +22 -0
- package/build/lib/protocol/helpers.d.ts.map +1 -0
- package/build/lib/protocol/helpers.js +2 -4
- package/build/lib/protocol/index.d.ts +16 -0
- package/build/lib/protocol/index.d.ts.map +1 -0
- package/build/lib/protocol/index.js +8 -10
- package/build/lib/protocol/protocol.d.ts +11 -0
- package/build/lib/protocol/protocol.d.ts.map +1 -0
- package/build/lib/protocol/protocol.js +38 -35
- package/build/lib/protocol/routes.d.ts +6 -0
- package/build/lib/protocol/routes.d.ts.map +1 -0
- package/build/lib/protocol/routes.js +84 -4
- package/build/lib/protocol/validators.d.ts +8 -0
- package/build/lib/protocol/validators.d.ts.map +1 -0
- package/build/lib/protocol/validators.js +2 -4
- package/build/test/basedriver/README.md +5 -0
- package/build/test/basedriver/driver-e2e-tests.js +2 -4
- package/build/test/basedriver/driver-tests.js +41 -19
- package/build/test/basedriver/index.js +2 -4
- package/build/test/e2e/basedriver/driver.e2e.spec.js +15 -0
- package/build/test/e2e/basedriver/helpers.e2e.spec.js +192 -0
- package/build/test/e2e/basedriver/websockets.e2e.spec.js +82 -0
- package/build/test/e2e/express/server.e2e.spec.js +159 -0
- package/build/test/e2e/jsonwp-proxy/proxy.e2e.spec.js +59 -0
- package/build/test/e2e/protocol/fake-driver.js +163 -0
- package/build/test/e2e/protocol/helpers.js +25 -0
- package/build/test/e2e/protocol/protocol.e2e.spec.js +1186 -0
- package/build/test/helpers.js +2 -4
- package/build/test/unit/basedriver/capabilities.spec.js +672 -0
- package/build/test/unit/basedriver/capability.spec.js +353 -0
- package/build/test/unit/basedriver/commands/event.spec.js +110 -0
- package/build/test/unit/basedriver/commands/log.spec.js +92 -0
- package/build/test/unit/basedriver/driver.spec.js +15 -0
- package/build/test/unit/basedriver/helpers.spec.js +151 -0
- package/build/test/unit/basedriver/timeout.spec.js +135 -0
- package/build/test/unit/express/server.spec.js +155 -0
- package/build/test/unit/express/static.spec.js +26 -0
- package/build/test/unit/jsonwp-proxy/mock-request.js +91 -0
- package/build/test/unit/jsonwp-proxy/protocol-converter.spec.js +171 -0
- package/build/test/unit/jsonwp-proxy/proxy.spec.js +292 -0
- package/build/test/unit/jsonwp-proxy/url.spec.js +165 -0
- package/build/test/unit/jsonwp-status/status.spec.js +34 -0
- package/build/test/unit/protocol/errors.spec.js +390 -0
- package/build/test/unit/protocol/routes.spec.js +80 -0
- package/build/test/unit/protocol/validator.spec.js +149 -0
- package/build/tsconfig.tsbuildinfo +1 -0
- package/lib/basedriver/capabilities.js +49 -10
- package/lib/basedriver/commands/event.js +49 -31
- package/lib/basedriver/commands/find.js +107 -45
- package/lib/basedriver/commands/index.js +25 -19
- package/lib/basedriver/commands/log.js +59 -34
- package/lib/basedriver/commands/session.js +39 -142
- package/lib/basedriver/commands/settings.js +32 -14
- package/lib/basedriver/commands/timeout.js +153 -154
- package/lib/basedriver/core.js +497 -0
- package/lib/basedriver/desired-caps.js +1 -1
- package/lib/basedriver/device-settings.js +57 -13
- package/lib/basedriver/driver.js +277 -375
- package/lib/basedriver/helpers.js +31 -13
- package/lib/express/express-logging.js +1 -1
- package/lib/express/idempotency.js +1 -1
- package/lib/helpers/capabilities.js +84 -0
- package/lib/index.js +17 -13
- package/lib/jsonwp-proxy/protocol-converter.js +14 -13
- package/lib/jsonwp-proxy/proxy.js +16 -12
- package/lib/protocol/errors.js +42 -42
- package/lib/protocol/index.js +4 -4
- package/lib/protocol/protocol.js +35 -32
- package/lib/protocol/routes.js +69 -1
- package/package.json +37 -24
- package/test/basedriver/README.md +5 -0
- package/test/basedriver/driver-e2e-tests.js +1 -1
- package/test/basedriver/driver-tests.js +43 -9
- package/build/lib/protocol/sessions-cache.js +0 -88
- package/build/test/basedriver/capabilities-specs.js +0 -632
- package/build/test/basedriver/capability-specs.js +0 -396
- package/build/test/basedriver/commands/event-specs.js +0 -112
- package/build/test/basedriver/commands/log-specs.js +0 -80
- package/build/test/basedriver/driver-e2e-specs.js +0 -17
- package/build/test/basedriver/driver-specs.js +0 -17
- package/build/test/basedriver/helpers-e2e-specs.js +0 -194
- package/build/test/basedriver/helpers-specs.js +0 -153
- package/build/test/basedriver/timeout-specs.js +0 -139
- package/build/test/basedriver/websockets-e2e-specs.js +0 -84
- package/build/test/express/server-e2e-specs.js +0 -156
- package/build/test/express/server-specs.js +0 -151
- package/build/test/express/static-specs.js +0 -23
- package/build/test/jsonwp-proxy/mock-request.js +0 -93
- package/build/test/jsonwp-proxy/protocol-converter-specs.js +0 -173
- package/build/test/jsonwp-proxy/proxy-e2e-specs.js +0 -61
- package/build/test/jsonwp-proxy/proxy-specs.js +0 -294
- package/build/test/jsonwp-proxy/url-specs.js +0 -167
- package/build/test/jsonwp-status/status-specs.js +0 -36
- package/build/test/protocol/errors-specs.js +0 -388
- package/build/test/protocol/fake-driver.js +0 -168
- package/build/test/protocol/helpers.js +0 -27
- package/build/test/protocol/protocol-e2e-specs.js +0 -1182
- package/build/test/protocol/routes-specs.js +0 -82
- package/build/test/protocol/validator-specs.js +0 -151
- package/index.d.ts +0 -386
- package/lib/protocol/sessions-cache.js +0 -74
- package/test/basedriver/capabilities-specs.js +0 -505
- package/test/basedriver/capability-specs.js +0 -409
- package/test/basedriver/commands/event-specs.js +0 -74
- package/test/basedriver/commands/log-specs.js +0 -70
- package/test/basedriver/driver-e2e-specs.js +0 -8
- package/test/basedriver/driver-specs.js +0 -8
- package/test/basedriver/fixtures/BadZippedApp.zip +0 -1
- package/test/basedriver/fixtures/FakeAndroidApp.apk +0 -1
- package/test/basedriver/fixtures/FakeAndroidApp.asd +0 -0
- package/test/basedriver/fixtures/FakeIOSApp.app +0 -1
- package/test/basedriver/fixtures/FakeIOSApp.app.zip +0 -0
- package/test/basedriver/fixtures/FakeIOSApp.ipa +0 -0
- package/test/basedriver/fixtures/custom-element-finder-bad.js +0 -5
- package/test/basedriver/fixtures/custom-element-finder.js +0 -29
- package/test/basedriver/helpers-e2e-specs.js +0 -187
- package/test/basedriver/helpers-specs.js +0 -137
- package/test/basedriver/timeout-specs.js +0 -133
- package/test/basedriver/websockets-e2e-specs.js +0 -75
|
@@ -1,168 +1,167 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
/* eslint-disable no-unused-vars */
|
|
4
|
+
/* eslint-disable require-await */
|
|
5
|
+
import {waitForCondition} from 'asyncbox';
|
|
3
6
|
import _ from 'lodash';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
7
|
+
import {util} from '@appium/support';
|
|
8
|
+
import {errors} from '../../protocol';
|
|
6
9
|
|
|
10
|
+
const MIN_TIMEOUT = 0;
|
|
7
11
|
|
|
8
|
-
|
|
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
|
+
}
|
|
9
47
|
|
|
10
|
-
|
|
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
|
+
}
|
|
11
66
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
case 'command':
|
|
18
|
-
await this.newCommandTimeout(ms);
|
|
19
|
-
return;
|
|
20
|
-
case 'implicit':
|
|
21
|
-
await this.implicitWaitMJSONWP(ms);
|
|
22
|
-
return;
|
|
23
|
-
case 'page load':
|
|
24
|
-
await this.pageLoadTimeoutMJSONWP(ms);
|
|
25
|
-
return;
|
|
26
|
-
case 'script':
|
|
27
|
-
await this.scriptTimeoutMJSONWP(ms);
|
|
28
|
-
return;
|
|
29
|
-
default:
|
|
30
|
-
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
|
+
};
|
|
31
72
|
}
|
|
32
|
-
}
|
|
33
73
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
+
}
|
|
75
121
|
}
|
|
76
122
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
throw new errors.NotImplementedError('Not implemented yet for pageLoad.');
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
// script
|
|
92
|
-
// eslint-disable-next-line no-unused-vars
|
|
93
|
-
commands.scriptTimeoutW3C = async function scriptTimeoutW3C (ms) { // eslint-disable-line require-await
|
|
94
|
-
throw new errors.NotImplementedError('Not implemented yet for script.');
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
// eslint-disable-next-line no-unused-vars
|
|
98
|
-
commands.scriptTimeoutMJSONWP = async function scriptTimeoutMJSONWP (ms) { // eslint-disable-line require-await
|
|
99
|
-
throw new errors.NotImplementedError('Not implemented yet for script.');
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
// command
|
|
103
|
-
commands.newCommandTimeout = async function newCommandTimeout (ms) { // eslint-disable-line require-await
|
|
104
|
-
this.setNewCommandTimeout(this.parseTimeoutArgument(ms));
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
helpers.setNewCommandTimeout = function setNewCommandTimeout (ms) {
|
|
108
|
-
this.newCommandTimeoutMs = ms;
|
|
109
|
-
log.debug(`Set new command timeout to ${ms}ms`);
|
|
110
|
-
if (this.managedDrivers && this.managedDrivers.length) {
|
|
111
|
-
log.debug('Setting new command timeout on managed drivers');
|
|
112
|
-
for (let driver of this.managedDrivers) {
|
|
113
|
-
if (_.isFunction(driver.setNewCommandTimeout)) {
|
|
114
|
-
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
|
+
}
|
|
115
134
|
}
|
|
116
135
|
}
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
136
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}, this.newCommandTimeoutMs);
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
helpers.implicitWaitForCondition = async function implicitWaitForCondition (condFn) {
|
|
146
|
-
log.debug(`Waiting up to ${this.implicitWaitMs} ms for condition`);
|
|
147
|
-
let wrappedCondFn = async (...args) => {
|
|
148
|
-
// reset command timeout
|
|
149
|
-
this.clearNewCommandTimeout();
|
|
150
|
-
|
|
151
|
-
return await condFn(...args);
|
|
152
|
-
};
|
|
153
|
-
return await waitForCondition(wrappedCondFn, {
|
|
154
|
-
waitMs: this.implicitWaitMs, intervalMs: 500, logger: log
|
|
155
|
-
});
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
helpers.parseTimeoutArgument = function parseTimeoutArgument (ms) {
|
|
159
|
-
let duration = parseInt(ms, 10);
|
|
160
|
-
if (_.isNaN(duration) || duration < MIN_TIMEOUT) {
|
|
161
|
-
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
|
+
}
|
|
162
159
|
}
|
|
163
|
-
return duration;
|
|
164
|
-
};
|
|
165
160
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
161
|
+
return TimeoutCommands;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @typedef {import('@appium/types').TimeoutCommands} ITimeoutCommands
|
|
166
|
+
* @typedef {import('../driver').BaseDriverBase<ITimeoutCommands>} TimeoutBase
|
|
167
|
+
*/
|