@appium/base-driver 10.0.0-beta.0 → 10.0.0-beta.2
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/README.md +0 -8
- package/build/lib/basedriver/capabilities.d.ts.map +1 -1
- package/build/lib/basedriver/capabilities.js +2 -4
- package/build/lib/basedriver/capabilities.js.map +1 -1
- package/build/lib/basedriver/commands/execute.js.map +1 -1
- package/build/lib/basedriver/commands/timeout.js +12 -31
- package/build/lib/basedriver/commands/timeout.js.map +1 -1
- package/build/lib/basedriver/core.d.ts +0 -8
- package/build/lib/basedriver/core.d.ts.map +1 -1
- package/build/lib/basedriver/core.js +8 -18
- package/build/lib/basedriver/core.js.map +1 -1
- package/build/lib/basedriver/driver.js +2 -2
- package/build/lib/basedriver/driver.js.map +1 -1
- package/build/lib/basedriver/helpers.d.ts +9 -1
- package/build/lib/basedriver/helpers.d.ts.map +1 -1
- package/build/lib/basedriver/helpers.js +56 -142
- package/build/lib/basedriver/helpers.js.map +1 -1
- package/build/lib/basedriver/validation.d.ts +7 -0
- package/build/lib/basedriver/validation.d.ts.map +1 -0
- package/build/lib/basedriver/validation.js +130 -0
- package/build/lib/basedriver/validation.js.map +1 -0
- package/build/lib/express/middleware.d.ts +0 -6
- package/build/lib/express/middleware.d.ts.map +1 -1
- package/build/lib/express/middleware.js +28 -60
- package/build/lib/express/middleware.js.map +1 -1
- package/build/lib/express/server.d.ts.map +1 -1
- package/build/lib/express/server.js +0 -1
- package/build/lib/express/server.js.map +1 -1
- package/build/lib/helpers/capabilities.d.ts +13 -6
- package/build/lib/helpers/capabilities.d.ts.map +1 -1
- package/build/lib/helpers/capabilities.js +7 -0
- package/build/lib/helpers/capabilities.js.map +1 -1
- package/build/lib/index.d.ts +1 -0
- package/build/lib/index.d.ts.map +1 -1
- package/build/lib/index.js +3 -1
- package/build/lib/index.js.map +1 -1
- package/build/lib/jsonwp-proxy/proxy.d.ts +0 -8
- package/build/lib/jsonwp-proxy/proxy.d.ts.map +1 -1
- package/build/lib/jsonwp-proxy/proxy.js +7 -38
- package/build/lib/jsonwp-proxy/proxy.js.map +1 -1
- package/build/lib/protocol/errors.d.ts +171 -277
- package/build/lib/protocol/errors.d.ts.map +1 -1
- package/build/lib/protocol/errors.js +201 -421
- package/build/lib/protocol/errors.js.map +1 -1
- package/build/lib/protocol/helpers.d.ts +6 -6
- package/build/lib/protocol/helpers.d.ts.map +1 -1
- package/build/lib/protocol/helpers.js +11 -7
- package/build/lib/protocol/helpers.js.map +1 -1
- package/build/lib/protocol/index.d.ts +2 -1
- package/build/lib/protocol/index.d.ts.map +1 -1
- package/build/lib/protocol/index.js +2 -1
- package/build/lib/protocol/index.js.map +1 -1
- package/build/lib/protocol/protocol.d.ts +16 -19
- package/build/lib/protocol/protocol.d.ts.map +1 -1
- package/build/lib/protocol/protocol.js +98 -119
- package/build/lib/protocol/protocol.js.map +1 -1
- package/build/lib/protocol/routes.d.ts +12 -714
- package/build/lib/protocol/routes.d.ts.map +1 -1
- package/build/lib/protocol/routes.js +24 -488
- package/build/lib/protocol/routes.js.map +1 -1
- package/build/lib/protocol/validators.d.ts +4 -7
- package/build/lib/protocol/validators.d.ts.map +1 -1
- package/build/lib/protocol/validators.js +4 -21
- package/build/lib/protocol/validators.js.map +1 -1
- package/lib/basedriver/capabilities.ts +2 -4
- package/lib/basedriver/commands/execute.ts +1 -1
- package/lib/basedriver/commands/timeout.ts +16 -43
- package/lib/basedriver/core.ts +10 -19
- package/lib/basedriver/driver.ts +3 -3
- package/lib/basedriver/helpers.js +61 -167
- package/lib/basedriver/validation.ts +145 -0
- package/lib/express/middleware.js +32 -70
- package/lib/express/server.js +0 -2
- package/lib/helpers/capabilities.js +9 -4
- package/lib/index.js +2 -0
- package/lib/jsonwp-proxy/proxy.js +8 -45
- package/lib/protocol/{errors.js → errors.ts} +322 -436
- package/lib/protocol/helpers.js +12 -8
- package/lib/protocol/index.js +8 -1
- package/lib/protocol/{protocol.js → protocol.ts} +147 -146
- package/lib/protocol/routes.js +26 -498
- package/lib/protocol/validators.ts +19 -0
- package/package.json +10 -11
- package/build/lib/basedriver/desired-caps.d.ts +0 -5
- package/build/lib/basedriver/desired-caps.d.ts.map +0 -1
- package/build/lib/basedriver/desired-caps.js +0 -92
- package/build/lib/basedriver/desired-caps.js.map +0 -1
- package/lib/basedriver/README.md +0 -36
- package/lib/basedriver/desired-caps.js +0 -103
- package/lib/express/README.md +0 -59
- package/lib/jsonwp-proxy/README.md +0 -52
- package/lib/jsonwp-status/README.md +0 -20
- package/lib/protocol/README.md +0 -100
- package/lib/protocol/validators.js +0 -38
package/lib/protocol/routes.js
CHANGED
|
@@ -1,26 +1,13 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
1
|
import _ from 'lodash';
|
|
4
|
-
import {
|
|
5
|
-
import {PROTOCOLS, DEFAULT_BASE_PATH} from '../constants';
|
|
2
|
+
import {DEFAULT_BASE_PATH} from '../constants';
|
|
6
3
|
import {match} from 'path-to-regexp';
|
|
7
|
-
import {
|
|
4
|
+
import {LRUCache} from 'lru-cache';
|
|
8
5
|
|
|
9
6
|
/** @type {LRUCache<string, string>} */
|
|
10
7
|
const COMMAND_NAMES_CACHE = new LRUCache({
|
|
11
8
|
max: 1024,
|
|
12
9
|
});
|
|
13
10
|
|
|
14
|
-
const SET_ALERT_TEXT_PAYLOAD_PARAMS = {
|
|
15
|
-
validate: (jsonObj) =>
|
|
16
|
-
!util.hasValue(jsonObj.value) &&
|
|
17
|
-
!util.hasValue(jsonObj.text) &&
|
|
18
|
-
'either "text" or "value" must be set',
|
|
19
|
-
optional: ['value', 'text'],
|
|
20
|
-
// Prefer 'value' since it's more backward-compatible.
|
|
21
|
-
makeArgs: (jsonObj) => [jsonObj.value || jsonObj.text],
|
|
22
|
-
};
|
|
23
|
-
|
|
24
11
|
/**
|
|
25
12
|
* define the routes, mapping of HTTP methods to particular driver commands, and
|
|
26
13
|
* any parameters that are expected in a request parameters can be `required` or
|
|
@@ -30,7 +17,7 @@ const SET_ALERT_TEXT_PAYLOAD_PARAMS = {
|
|
|
30
17
|
export const METHOD_MAP = /** @type {const} */ ({
|
|
31
18
|
|
|
32
19
|
//
|
|
33
|
-
// W3C WebDriver
|
|
20
|
+
// W3C WebDriver
|
|
34
21
|
// https://www.w3.org/TR/webdriver1/
|
|
35
22
|
// https://www.w3.org/TR/webdriver2/
|
|
36
23
|
//
|
|
@@ -41,40 +28,20 @@ export const METHOD_MAP = /** @type {const} */ ({
|
|
|
41
28
|
POST: {
|
|
42
29
|
command: 'createSession',
|
|
43
30
|
payloadParams: {
|
|
44
|
-
|
|
45
|
-
validate: (jsonObj) =>
|
|
46
|
-
!jsonObj.capabilities &&
|
|
47
|
-
!jsonObj.desiredCapabilities &&
|
|
48
|
-
'we require one of "desiredCapabilities" or "capabilities" object',
|
|
49
|
-
optional: ['desiredCapabilities', 'requiredCapabilities', 'capabilities'],
|
|
31
|
+
optional: ['capabilities', 'capabilities', 'capabilities'],
|
|
50
32
|
},
|
|
51
33
|
},
|
|
52
34
|
},
|
|
53
35
|
'/session/:sessionId': {
|
|
36
|
+
// TODO: Decide on the future of this route later
|
|
54
37
|
GET: {command: 'getSession', deprecated: true},
|
|
55
38
|
DELETE: {command: 'deleteSession'},
|
|
56
39
|
},
|
|
57
40
|
'/session/:sessionId/timeouts': {
|
|
58
|
-
GET: {command: 'getTimeouts'},
|
|
41
|
+
GET: {command: 'getTimeouts'},
|
|
59
42
|
POST: {
|
|
60
43
|
command: 'timeouts',
|
|
61
44
|
payloadParams: {
|
|
62
|
-
validate: (jsonObj, protocolName) => {
|
|
63
|
-
if (protocolName === PROTOCOLS.W3C) {
|
|
64
|
-
if (
|
|
65
|
-
!util.hasValue(jsonObj.script) &&
|
|
66
|
-
!util.hasValue(jsonObj.pageLoad) &&
|
|
67
|
-
!util.hasValue(jsonObj.implicit)
|
|
68
|
-
) {
|
|
69
|
-
return 'W3C protocol expects any of script, pageLoad or implicit to be set';
|
|
70
|
-
}
|
|
71
|
-
} else {
|
|
72
|
-
// TODO: Remove in Appium 3
|
|
73
|
-
if (!util.hasValue(jsonObj.type) || !util.hasValue(jsonObj.ms)) {
|
|
74
|
-
return 'MJSONWP protocol requires type and ms';
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
45
|
optional: ['type', 'ms', 'script', 'pageLoad', 'implicit'],
|
|
79
46
|
},
|
|
80
47
|
},
|
|
@@ -110,22 +77,7 @@ export const METHOD_MAP = /** @type {const} */ ({
|
|
|
110
77
|
POST: {
|
|
111
78
|
command: 'setWindow',
|
|
112
79
|
payloadParams: {
|
|
113
|
-
|
|
114
|
-
optional: ['name', 'handle'],
|
|
115
|
-
// Return both values to match W3C and JSONWP protocols
|
|
116
|
-
makeArgs: (jsonObj) => {
|
|
117
|
-
if (util.hasValue(jsonObj.handle) && !util.hasValue(jsonObj.name)) {
|
|
118
|
-
return [jsonObj.handle, jsonObj.handle];
|
|
119
|
-
}
|
|
120
|
-
if (util.hasValue(jsonObj.name) && !util.hasValue(jsonObj.handle)) {
|
|
121
|
-
return [jsonObj.name, jsonObj.name];
|
|
122
|
-
}
|
|
123
|
-
return [jsonObj.name, jsonObj.handle];
|
|
124
|
-
},
|
|
125
|
-
validate: (jsonObj) =>
|
|
126
|
-
!util.hasValue(jsonObj.name) &&
|
|
127
|
-
!util.hasValue(jsonObj.handle) &&
|
|
128
|
-
'we require one of "name" or "handle" to be set',
|
|
80
|
+
required: ['handle'],
|
|
129
81
|
},
|
|
130
82
|
},
|
|
131
83
|
DELETE: {command: 'closeWindow'},
|
|
@@ -170,8 +122,7 @@ export const METHOD_MAP = /** @type {const} */ ({
|
|
|
170
122
|
},
|
|
171
123
|
},
|
|
172
124
|
'/session/:sessionId/element/active': {
|
|
173
|
-
GET: {command: 'active'},
|
|
174
|
-
POST: {command: 'active', deprecated: true},
|
|
125
|
+
GET: {command: 'active'},
|
|
175
126
|
},
|
|
176
127
|
'/session/:sessionId/element/:elementId': {
|
|
177
128
|
GET: {},
|
|
@@ -198,18 +149,7 @@ export const METHOD_MAP = /** @type {const} */ ({
|
|
|
198
149
|
POST: {
|
|
199
150
|
command: 'setValue',
|
|
200
151
|
payloadParams: {
|
|
201
|
-
|
|
202
|
-
!util.hasValue(jsonObj.value) &&
|
|
203
|
-
!util.hasValue(jsonObj.text) &&
|
|
204
|
-
'we require one of "text" or "value" params',
|
|
205
|
-
// TODO: Appium 3 will accept only 'value'.
|
|
206
|
-
optional: ['value', 'text'],
|
|
207
|
-
// override the default argument constructor because of the special
|
|
208
|
-
// logic here. Basically we want to accept either a value (old JSONWP)
|
|
209
|
-
// or a text (new W3C) parameter, but only send one of them to the
|
|
210
|
-
// command (not both). Prefer 'value' since it's more
|
|
211
|
-
// backward-compatible.
|
|
212
|
-
makeArgs: (jsonObj) => [jsonObj.value || jsonObj.text],
|
|
152
|
+
required: ['text'],
|
|
213
153
|
},
|
|
214
154
|
},
|
|
215
155
|
},
|
|
@@ -268,7 +208,9 @@ export const METHOD_MAP = /** @type {const} */ ({
|
|
|
268
208
|
GET: {command: 'getAlertText'},
|
|
269
209
|
POST: {
|
|
270
210
|
command: 'setAlertText',
|
|
271
|
-
payloadParams:
|
|
211
|
+
payloadParams: {
|
|
212
|
+
required: ['text'],
|
|
213
|
+
},
|
|
272
214
|
},
|
|
273
215
|
},
|
|
274
216
|
'/session/:sessionId/alert/accept': {
|
|
@@ -304,19 +246,23 @@ export const METHOD_MAP = /** @type {const} */ ({
|
|
|
304
246
|
// Appium specific
|
|
305
247
|
//
|
|
306
248
|
'/session/:sessionId/ime/available_engines': {
|
|
307
|
-
GET: {command: 'availableIMEEngines'},
|
|
249
|
+
GET: {command: 'availableIMEEngines', deprecated: true},
|
|
308
250
|
},
|
|
309
251
|
'/session/:sessionId/ime/active_engine': {
|
|
310
|
-
GET: {command: 'getActiveIMEEngine'},
|
|
252
|
+
GET: {command: 'getActiveIMEEngine', deprecated: true},
|
|
311
253
|
},
|
|
312
254
|
'/session/:sessionId/ime/activated': {
|
|
313
|
-
GET: {command: 'isIMEActivated'},
|
|
255
|
+
GET: {command: 'isIMEActivated', deprecated: true},
|
|
314
256
|
},
|
|
315
257
|
'/session/:sessionId/ime/deactivate': {
|
|
316
|
-
POST: {command: 'deactivateIMEEngine'},
|
|
258
|
+
POST: {command: 'deactivateIMEEngine', deprecated: true},
|
|
317
259
|
},
|
|
318
260
|
'/session/:sessionId/ime/activate': {
|
|
319
|
-
POST: {
|
|
261
|
+
POST: {
|
|
262
|
+
command: 'activateIMEEngine',
|
|
263
|
+
payloadParams: {required: ['engine']},
|
|
264
|
+
deprecated: true,
|
|
265
|
+
},
|
|
320
266
|
},
|
|
321
267
|
'/session/:sessionId/rotation': {
|
|
322
268
|
GET: {command: 'getRotation'},
|
|
@@ -341,16 +287,18 @@ export const METHOD_MAP = /** @type {const} */ ({
|
|
|
341
287
|
GET: {command: 'getContexts'},
|
|
342
288
|
},
|
|
343
289
|
'/session/:sessionId/network_connection': {
|
|
344
|
-
GET: {command: 'getNetworkConnection'},
|
|
290
|
+
GET: {command: 'getNetworkConnection', deprecated: true},
|
|
345
291
|
POST: {
|
|
346
292
|
command: 'setNetworkConnection',
|
|
347
293
|
payloadParams: {unwrap: 'parameters', required: ['type']},
|
|
294
|
+
deprecated: true,
|
|
348
295
|
},
|
|
349
296
|
},
|
|
350
297
|
'/session/:sessionId/receive_async_response': {
|
|
351
298
|
POST: {
|
|
352
299
|
command: 'receiveAsyncResponse',
|
|
353
300
|
payloadParams: {required: ['status', 'value']},
|
|
301
|
+
deprecated: true,
|
|
354
302
|
},
|
|
355
303
|
},
|
|
356
304
|
'/appium/sessions': {
|
|
@@ -360,7 +308,7 @@ export const METHOD_MAP = /** @type {const} */ ({
|
|
|
360
308
|
GET: {command: 'getAppiumSessionCapabilities'}
|
|
361
309
|
},
|
|
362
310
|
'/session/:sessionId/appium/device/system_time': {
|
|
363
|
-
GET: {command: 'getDeviceTime'
|
|
311
|
+
GET: {command: 'getDeviceTime'},
|
|
364
312
|
POST: {command: 'getDeviceTime', payloadParams: {optional: ['format']}},
|
|
365
313
|
},
|
|
366
314
|
// #region Applications Management
|
|
@@ -409,18 +357,11 @@ export const METHOD_MAP = /** @type {const} */ ({
|
|
|
409
357
|
},
|
|
410
358
|
},
|
|
411
359
|
'/session/:sessionId/appium/device/app_state': {
|
|
412
|
-
GET: {
|
|
413
|
-
command: 'queryAppState',
|
|
414
|
-
payloadParams: {
|
|
415
|
-
required: [['appId'], ['bundleId']],
|
|
416
|
-
},
|
|
417
|
-
},
|
|
418
360
|
POST: {
|
|
419
361
|
command: 'queryAppState',
|
|
420
362
|
payloadParams: {
|
|
421
363
|
required: [['appId'], ['bundleId']],
|
|
422
364
|
},
|
|
423
|
-
deprecated: true,
|
|
424
365
|
},
|
|
425
366
|
},
|
|
426
367
|
// #endregion
|
|
@@ -524,419 +465,6 @@ export const METHOD_MAP = /** @type {const} */ ({
|
|
|
524
465
|
},
|
|
525
466
|
},
|
|
526
467
|
// #endregion
|
|
527
|
-
|
|
528
|
-
//
|
|
529
|
-
// Endpoints deprecated entirely
|
|
530
|
-
//
|
|
531
|
-
// #region MJSONWP
|
|
532
|
-
'/sessions': {
|
|
533
|
-
GET: {command: 'getSessions', deprecated: true},
|
|
534
|
-
},
|
|
535
|
-
'/session/:sessionId/timeouts/async_script': {
|
|
536
|
-
POST: {command: 'asyncScriptTimeout', payloadParams: {required: ['ms']}, deprecated: true},
|
|
537
|
-
},
|
|
538
|
-
'/session/:sessionId/timeouts/implicit_wait': {
|
|
539
|
-
POST: {command: 'implicitWait', payloadParams: {required: ['ms']}, deprecated: true},
|
|
540
|
-
},
|
|
541
|
-
'/session/:sessionId/window_handle': {
|
|
542
|
-
GET: {command: 'getWindowHandle', deprecated: true},
|
|
543
|
-
},
|
|
544
|
-
// Only 'window/handles' exists in W3C WebDriver spec.
|
|
545
|
-
'/session/:sessionId/window/handle': {
|
|
546
|
-
GET: {command: 'getWindowHandle', deprecated: true},
|
|
547
|
-
},
|
|
548
|
-
'/session/:sessionId/window_handles': {
|
|
549
|
-
GET: {command: 'getWindowHandles', deprecated: true},
|
|
550
|
-
},
|
|
551
|
-
'/session/:sessionId/execute': {
|
|
552
|
-
POST: {
|
|
553
|
-
command: 'execute',
|
|
554
|
-
payloadParams: {required: ['script', 'args']},
|
|
555
|
-
deprecated: true
|
|
556
|
-
},
|
|
557
|
-
},
|
|
558
|
-
'/session/:sessionId/execute_async': {
|
|
559
|
-
POST: {
|
|
560
|
-
command: 'executeAsync',
|
|
561
|
-
payloadParams: {required: ['script', 'args']},
|
|
562
|
-
deprecated: true
|
|
563
|
-
},
|
|
564
|
-
},
|
|
565
|
-
'/session/:sessionId/window/:windowhandle/size': {
|
|
566
|
-
GET: {command: 'getWindowSize', deprecated: true},
|
|
567
|
-
},
|
|
568
|
-
'/session/:sessionId/window/:windowhandle/position': {
|
|
569
|
-
POST: {deprecated: true},
|
|
570
|
-
GET: {deprecated: true},
|
|
571
|
-
},
|
|
572
|
-
'/session/:sessionId/window/:windowhandle/maximize': {
|
|
573
|
-
POST: {command: 'maximizeWindow', deprecated: true},
|
|
574
|
-
},
|
|
575
|
-
'/session/:sessionId/element/:elementId/submit': {
|
|
576
|
-
POST: {command: 'submit', deprecated: true},
|
|
577
|
-
},
|
|
578
|
-
'/session/:sessionId/keys': {
|
|
579
|
-
POST: {command: 'keys', payloadParams: {required: ['value']}, deprecated: true},
|
|
580
|
-
},
|
|
581
|
-
'/session/:sessionId/element/:elementId/equals/:otherId': {
|
|
582
|
-
GET: {command: 'equalsElement', deprecated: true},
|
|
583
|
-
},
|
|
584
|
-
'/session/:sessionId/element/:elementId/location': {
|
|
585
|
-
GET: {command: 'getLocation', deprecated: true},
|
|
586
|
-
},
|
|
587
|
-
'/session/:sessionId/element/:elementId/location_in_view': {
|
|
588
|
-
GET: {command: 'getLocationInView', deprecated: true},
|
|
589
|
-
},
|
|
590
|
-
'/session/:sessionId/element/:elementId/size': {
|
|
591
|
-
GET: {command: 'getSize', deprecated: true},
|
|
592
|
-
},
|
|
593
|
-
'/session/:sessionId/moveto': {
|
|
594
|
-
POST: {
|
|
595
|
-
command: 'moveTo',
|
|
596
|
-
payloadParams: {optional: ['element', 'xoffset', 'yoffset']},
|
|
597
|
-
deprecated: true,
|
|
598
|
-
},
|
|
599
|
-
},
|
|
600
|
-
'/session/:sessionId/click': {
|
|
601
|
-
POST: {command: 'clickCurrent', payloadParams: {optional: ['button']}, deprecated: true},
|
|
602
|
-
},
|
|
603
|
-
'/session/:sessionId/buttondown': {
|
|
604
|
-
POST: {command: 'buttonDown', payloadParams: {optional: ['button']}, deprecated: true},
|
|
605
|
-
},
|
|
606
|
-
'/session/:sessionId/buttonup': {
|
|
607
|
-
POST: {command: 'buttonUp', payloadParams: {optional: ['button']}, deprecated: true},
|
|
608
|
-
},
|
|
609
|
-
'/session/:sessionId/doubleclick': {
|
|
610
|
-
POST: {command: 'doubleClick', deprecated: true},
|
|
611
|
-
},
|
|
612
|
-
'/session/:sessionId/touch/click': {
|
|
613
|
-
POST: {command: 'click', payloadParams: {required: ['element']}, deprecated: true},
|
|
614
|
-
},
|
|
615
|
-
'/session/:sessionId/touch/down': {
|
|
616
|
-
POST: {command: 'touchDown', payloadParams: {required: ['x', 'y']}, deprecated: true},
|
|
617
|
-
},
|
|
618
|
-
'/session/:sessionId/touch/up': {
|
|
619
|
-
POST: {command: 'touchUp', payloadParams: {required: ['x', 'y']}, deprecated: true},
|
|
620
|
-
},
|
|
621
|
-
'/session/:sessionId/touch/move': {
|
|
622
|
-
POST: {command: 'touchMove', payloadParams: {required: ['x', 'y']}, deprecated: true},
|
|
623
|
-
},
|
|
624
|
-
'/session/:sessionId/touch/scroll': {
|
|
625
|
-
POST: {deprecated: true},
|
|
626
|
-
},
|
|
627
|
-
'/session/:sessionId/touch/doubleclick': {
|
|
628
|
-
POST: {deprecated: true},
|
|
629
|
-
},
|
|
630
|
-
'/session/:sessionId/touch/longclick': {
|
|
631
|
-
POST: {
|
|
632
|
-
command: 'touchLongClick',
|
|
633
|
-
payloadParams: {required: ['elements']},
|
|
634
|
-
deprecated: true,
|
|
635
|
-
},
|
|
636
|
-
},
|
|
637
|
-
'/session/:sessionId/touch/flick': {
|
|
638
|
-
POST: {
|
|
639
|
-
command: 'flick',
|
|
640
|
-
payloadParams: {
|
|
641
|
-
optional: ['element', 'xspeed', 'yspeed', 'xoffset', 'yoffset', 'speed'],
|
|
642
|
-
},
|
|
643
|
-
deprecated: true,
|
|
644
|
-
},
|
|
645
|
-
},
|
|
646
|
-
'/session/:sessionId/local_storage': {
|
|
647
|
-
GET: {deprecated: true},
|
|
648
|
-
POST: {deprecated: true},
|
|
649
|
-
DELETE: {deprecated: true},
|
|
650
|
-
},
|
|
651
|
-
'/session/:sessionId/local_storage/key/:key': {
|
|
652
|
-
GET: {deprecated: true},
|
|
653
|
-
DELETE: {deprecated: true},
|
|
654
|
-
},
|
|
655
|
-
'/session/:sessionId/local_storage/size': {
|
|
656
|
-
GET: {deprecated: true},
|
|
657
|
-
},
|
|
658
|
-
'/session/:sessionId/session_storage': {
|
|
659
|
-
GET: {deprecated: true},
|
|
660
|
-
POST: {deprecated: true},
|
|
661
|
-
DELETE: {deprecated: true},
|
|
662
|
-
},
|
|
663
|
-
'/session/:sessionId/session_storage/key/:key': {
|
|
664
|
-
GET: {deprecated: true},
|
|
665
|
-
DELETE: {deprecated: true},
|
|
666
|
-
},
|
|
667
|
-
'/session/:sessionId/session_storage/size': {
|
|
668
|
-
GET: {deprecated: true},
|
|
669
|
-
},
|
|
670
|
-
'/session/:sessionId/application_cache/status': {
|
|
671
|
-
GET: {deprecated: true},
|
|
672
|
-
},
|
|
673
|
-
'/session/:sessionId/alert_text': {
|
|
674
|
-
GET: {command: 'getAlertText', deprecated: true},
|
|
675
|
-
POST: {
|
|
676
|
-
command: 'setAlertText',
|
|
677
|
-
payloadParams: SET_ALERT_TEXT_PAYLOAD_PARAMS,
|
|
678
|
-
deprecated: true
|
|
679
|
-
},
|
|
680
|
-
},
|
|
681
|
-
'/session/:sessionId/accept_alert': {
|
|
682
|
-
POST: {command: 'postAcceptAlert', deprecated: true},
|
|
683
|
-
},
|
|
684
|
-
'/session/:sessionId/dismiss_alert': {
|
|
685
|
-
POST: {command: 'postDismissAlert', deprecated: true},
|
|
686
|
-
},
|
|
687
|
-
// Pre-W3C endpoint for element screenshot
|
|
688
|
-
'/session/:sessionId/screenshot/:elementId': {
|
|
689
|
-
GET: {command: 'getElementScreenshot', deprecated: true},
|
|
690
|
-
},
|
|
691
|
-
// #endregion
|
|
692
|
-
// #region Appium specific
|
|
693
|
-
'/session/:sessionId/element/:elementId/pageIndex': {
|
|
694
|
-
GET: {command: 'getPageIndex', deprecated: true},
|
|
695
|
-
},
|
|
696
|
-
'/session/:sessionId/touch/perform': {
|
|
697
|
-
POST: {
|
|
698
|
-
command: 'performTouch',
|
|
699
|
-
payloadParams: {wrap: 'actions', required: ['actions']},
|
|
700
|
-
deprecated: true,
|
|
701
|
-
},
|
|
702
|
-
},
|
|
703
|
-
'/session/:sessionId/touch/multi/perform': {
|
|
704
|
-
POST: {
|
|
705
|
-
command: 'performMultiAction',
|
|
706
|
-
payloadParams: {required: ['actions'], optional: ['elementId']},
|
|
707
|
-
deprecated: true,
|
|
708
|
-
},
|
|
709
|
-
},
|
|
710
|
-
'/session/:sessionId/appium/device/shake': {
|
|
711
|
-
POST: {command: 'mobileShake', deprecated: true},
|
|
712
|
-
},
|
|
713
|
-
'/session/:sessionId/appium/device/lock': {
|
|
714
|
-
POST: {command: 'lock', payloadParams: {optional: ['seconds']}, deprecated: true},
|
|
715
|
-
},
|
|
716
|
-
'/session/:sessionId/appium/device/unlock': {
|
|
717
|
-
POST: {command: 'unlock', deprecated: true},
|
|
718
|
-
},
|
|
719
|
-
'/session/:sessionId/appium/device/is_locked': {
|
|
720
|
-
POST: {command: 'isLocked', deprecated: true},
|
|
721
|
-
},
|
|
722
|
-
'/session/:sessionId/appium/start_recording_screen': {
|
|
723
|
-
POST: {
|
|
724
|
-
command: 'startRecordingScreen',
|
|
725
|
-
payloadParams: {optional: ['options']},
|
|
726
|
-
deprecated: true,
|
|
727
|
-
},
|
|
728
|
-
},
|
|
729
|
-
'/session/:sessionId/appium/stop_recording_screen': {
|
|
730
|
-
POST: {
|
|
731
|
-
command: 'stopRecordingScreen',
|
|
732
|
-
payloadParams: {optional: ['options']},
|
|
733
|
-
deprecated: true,
|
|
734
|
-
},
|
|
735
|
-
},
|
|
736
|
-
'/session/:sessionId/appium/performanceData/types': {
|
|
737
|
-
POST: {command: 'getPerformanceDataTypes', deprecated: true},
|
|
738
|
-
},
|
|
739
|
-
'/session/:sessionId/appium/getPerformanceData': {
|
|
740
|
-
POST: {
|
|
741
|
-
command: 'getPerformanceData',
|
|
742
|
-
payloadParams: {
|
|
743
|
-
required: ['packageName', 'dataType'],
|
|
744
|
-
optional: ['dataReadTimeout'],
|
|
745
|
-
},
|
|
746
|
-
deprecated: true,
|
|
747
|
-
},
|
|
748
|
-
},
|
|
749
|
-
'/session/:sessionId/appium/device/press_keycode': {
|
|
750
|
-
POST: {
|
|
751
|
-
command: 'pressKeyCode',
|
|
752
|
-
payloadParams: {required: ['keycode'], optional: ['metastate', 'flags']},
|
|
753
|
-
deprecated: true,
|
|
754
|
-
},
|
|
755
|
-
},
|
|
756
|
-
'/session/:sessionId/appium/device/long_press_keycode': {
|
|
757
|
-
POST: {
|
|
758
|
-
command: 'longPressKeyCode',
|
|
759
|
-
payloadParams: {required: ['keycode'], optional: ['metastate', 'flags']},
|
|
760
|
-
deprecated: true,
|
|
761
|
-
},
|
|
762
|
-
},
|
|
763
|
-
'/session/:sessionId/appium/device/finger_print': {
|
|
764
|
-
POST: {
|
|
765
|
-
command: 'fingerprint',
|
|
766
|
-
payloadParams: {required: ['fingerprintId']},
|
|
767
|
-
deprecated: true,
|
|
768
|
-
},
|
|
769
|
-
},
|
|
770
|
-
'/session/:sessionId/appium/device/send_sms': {
|
|
771
|
-
POST: {
|
|
772
|
-
command: 'sendSMS',
|
|
773
|
-
payloadParams: {required: ['phoneNumber', 'message']},
|
|
774
|
-
deprecated: true,
|
|
775
|
-
},
|
|
776
|
-
},
|
|
777
|
-
'/session/:sessionId/appium/device/gsm_call': {
|
|
778
|
-
POST: {
|
|
779
|
-
command: 'gsmCall',
|
|
780
|
-
payloadParams: {required: ['phoneNumber', 'action']},
|
|
781
|
-
deprecated: true,
|
|
782
|
-
},
|
|
783
|
-
},
|
|
784
|
-
'/session/:sessionId/appium/device/gsm_signal': {
|
|
785
|
-
POST: {
|
|
786
|
-
command: 'gsmSignal',
|
|
787
|
-
payloadParams: {required: ['signalStrength']},
|
|
788
|
-
deprecated: true,
|
|
789
|
-
},
|
|
790
|
-
},
|
|
791
|
-
'/session/:sessionId/appium/device/gsm_voice': {
|
|
792
|
-
POST: {command: 'gsmVoice', payloadParams: {required: ['state']}, deprecated: true},
|
|
793
|
-
},
|
|
794
|
-
'/session/:sessionId/appium/device/power_capacity': {
|
|
795
|
-
POST: {command: 'powerCapacity', payloadParams: {required: ['percent']}, deprecated: true},
|
|
796
|
-
},
|
|
797
|
-
'/session/:sessionId/appium/device/power_ac': {
|
|
798
|
-
POST: {command: 'powerAC', payloadParams: {required: ['state']}, deprecated: true},
|
|
799
|
-
},
|
|
800
|
-
'/session/:sessionId/appium/device/network_speed': {
|
|
801
|
-
POST: {command: 'networkSpeed', payloadParams: {required: ['netspeed']}, deprecated: true},
|
|
802
|
-
},
|
|
803
|
-
'/session/:sessionId/appium/device/keyevent': {
|
|
804
|
-
POST: {
|
|
805
|
-
command: 'keyevent',
|
|
806
|
-
payloadParams: {required: ['keycode'], optional: ['metastate']},
|
|
807
|
-
deprecated: true,
|
|
808
|
-
},
|
|
809
|
-
},
|
|
810
|
-
'/session/:sessionId/appium/device/current_activity': {
|
|
811
|
-
GET: {command: 'getCurrentActivity', deprecated: true},
|
|
812
|
-
},
|
|
813
|
-
'/session/:sessionId/appium/device/current_package': {
|
|
814
|
-
GET: {command: 'getCurrentPackage', deprecated: true},
|
|
815
|
-
},
|
|
816
|
-
'/session/:sessionId/appium/device/toggle_airplane_mode': {
|
|
817
|
-
POST: {command: 'toggleFlightMode', deprecated: true},
|
|
818
|
-
},
|
|
819
|
-
'/session/:sessionId/appium/device/toggle_data': {
|
|
820
|
-
POST: {command: 'toggleData', deprecated: true},
|
|
821
|
-
},
|
|
822
|
-
'/session/:sessionId/appium/device/toggle_wifi': {
|
|
823
|
-
POST: {command: 'toggleWiFi', deprecated: true},
|
|
824
|
-
},
|
|
825
|
-
'/session/:sessionId/appium/device/toggle_location_services': {
|
|
826
|
-
POST: {command: 'toggleLocationServices', deprecated: true},
|
|
827
|
-
},
|
|
828
|
-
'/session/:sessionId/appium/device/open_notifications': {
|
|
829
|
-
POST: {command: 'openNotifications', deprecated: true},
|
|
830
|
-
},
|
|
831
|
-
'/session/:sessionId/appium/device/start_activity': {
|
|
832
|
-
POST: {
|
|
833
|
-
command: 'startActivity',
|
|
834
|
-
payloadParams: {
|
|
835
|
-
required: ['appPackage', 'appActivity'],
|
|
836
|
-
optional: [
|
|
837
|
-
'appWaitPackage',
|
|
838
|
-
'appWaitActivity',
|
|
839
|
-
'intentAction',
|
|
840
|
-
'intentCategory',
|
|
841
|
-
'intentFlags',
|
|
842
|
-
'optionalIntentArguments',
|
|
843
|
-
'dontStopAppOnReset',
|
|
844
|
-
],
|
|
845
|
-
},
|
|
846
|
-
deprecated: true,
|
|
847
|
-
},
|
|
848
|
-
},
|
|
849
|
-
'/session/:sessionId/appium/device/system_bars': {
|
|
850
|
-
GET: {command: 'getSystemBars', deprecated: true},
|
|
851
|
-
},
|
|
852
|
-
'/session/:sessionId/appium/device/display_density': {
|
|
853
|
-
GET: {command: 'getDisplayDensity', deprecated: true},
|
|
854
|
-
},
|
|
855
|
-
'/session/:sessionId/appium/simulator/touch_id': {
|
|
856
|
-
POST: {command: 'touchId', payloadParams: {required: ['match']}, deprecated: true},
|
|
857
|
-
},
|
|
858
|
-
'/session/:sessionId/appium/simulator/toggle_touch_id_enrollment': {
|
|
859
|
-
POST: {
|
|
860
|
-
command: 'toggleEnrollTouchId',
|
|
861
|
-
payloadParams: {optional: ['enabled']},
|
|
862
|
-
deprecated: true,
|
|
863
|
-
},
|
|
864
|
-
},
|
|
865
|
-
'/session/:sessionId/appium/app/launch': {
|
|
866
|
-
POST: {command: 'launchApp', deprecated: true},
|
|
867
|
-
},
|
|
868
|
-
'/session/:sessionId/appium/app/close': {
|
|
869
|
-
POST: {command: 'closeApp', deprecated: true},
|
|
870
|
-
},
|
|
871
|
-
'/session/:sessionId/appium/app/reset': {
|
|
872
|
-
POST: {command: 'reset', deprecated: true},
|
|
873
|
-
},
|
|
874
|
-
'/session/:sessionId/appium/app/background': {
|
|
875
|
-
POST: {command: 'background', payloadParams: {required: ['seconds']}, deprecated: true},
|
|
876
|
-
},
|
|
877
|
-
'/session/:sessionId/appium/app/end_test_coverage': {
|
|
878
|
-
POST: {
|
|
879
|
-
command: 'endCoverage',
|
|
880
|
-
payloadParams: {required: ['intent', 'path']},
|
|
881
|
-
deprecated: true,
|
|
882
|
-
},
|
|
883
|
-
},
|
|
884
|
-
'/session/:sessionId/appium/app/strings': {
|
|
885
|
-
POST: {
|
|
886
|
-
command: 'getStrings',
|
|
887
|
-
payloadParams: {optional: ['language', 'stringFile']},
|
|
888
|
-
deprecated: true,
|
|
889
|
-
},
|
|
890
|
-
},
|
|
891
|
-
'/session/:sessionId/appium/element/:elementId/value': {
|
|
892
|
-
POST: {
|
|
893
|
-
command: 'setValueImmediate',
|
|
894
|
-
payloadParams: {required: ['text']},
|
|
895
|
-
deprecated: true,
|
|
896
|
-
},
|
|
897
|
-
},
|
|
898
|
-
'/session/:sessionId/appium/element/:elementId/replace_value': {
|
|
899
|
-
POST: {
|
|
900
|
-
command: 'replaceValue',
|
|
901
|
-
payloadParams: {required: ['text']},
|
|
902
|
-
deprecated: true,
|
|
903
|
-
},
|
|
904
|
-
},
|
|
905
|
-
'/session/:sessionId/appium/receive_async_response': {
|
|
906
|
-
POST: {
|
|
907
|
-
command: 'receiveAsyncResponse',
|
|
908
|
-
payloadParams: {required: ['response']},
|
|
909
|
-
deprecated: true,
|
|
910
|
-
},
|
|
911
|
-
},
|
|
912
|
-
'/session/:sessionId/appium/device/set_clipboard': {
|
|
913
|
-
POST: {
|
|
914
|
-
command: 'setClipboard',
|
|
915
|
-
payloadParams: {
|
|
916
|
-
required: ['content'],
|
|
917
|
-
optional: ['contentType', 'label'],
|
|
918
|
-
},
|
|
919
|
-
deprecated: true,
|
|
920
|
-
},
|
|
921
|
-
},
|
|
922
|
-
'/session/:sessionId/appium/device/get_clipboard': {
|
|
923
|
-
POST: {
|
|
924
|
-
command: 'getClipboard',
|
|
925
|
-
payloadParams: {
|
|
926
|
-
optional: ['contentType'],
|
|
927
|
-
},
|
|
928
|
-
deprecated: true,
|
|
929
|
-
},
|
|
930
|
-
},
|
|
931
|
-
// #endregion
|
|
932
|
-
// #region JSONWP
|
|
933
|
-
'/session/:sessionId/log': {
|
|
934
|
-
POST: {command: 'getLog', payloadParams: {required: ['type']}, deprecated: true},
|
|
935
|
-
},
|
|
936
|
-
'/session/:sessionId/log/types': {
|
|
937
|
-
GET: {command: 'getLogTypes', deprecated: true},
|
|
938
|
-
},
|
|
939
|
-
// #endregion
|
|
940
468
|
});
|
|
941
469
|
|
|
942
470
|
// driver command names
|
|
@@ -1008,4 +536,4 @@ function toCommandNameCacheKey(endpoint, method) {
|
|
|
1008
536
|
}
|
|
1009
537
|
|
|
1010
538
|
// driver commands that do not require a session to already exist
|
|
1011
|
-
export const NO_SESSION_ID_COMMANDS = ['createSession', 'getStatus', '
|
|
539
|
+
export const NO_SESSION_ID_COMMANDS = ['createSession', 'getStatus', 'getAppiumSessions'];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
|
|
3
|
+
export const validators = {
|
|
4
|
+
setUrl: (url: any) => {
|
|
5
|
+
// either an `xyz://`, `about:`, or `data:` scheme is allowed
|
|
6
|
+
if (!url || !url.match(/^([a-zA-Z0-9_+.-]+:\/\/)|(about:)|(data:)/)) {
|
|
7
|
+
throw new Error('Url or Uri must start with <scheme>://');
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
setNetworkConnection: (type: any) => {
|
|
11
|
+
if (!isNumber(type) || [0, 1, 2, 4, 6].indexOf(type) === -1) {
|
|
12
|
+
throw new Error('Network type must be one of 0, 1, 2, 4, 6');
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function isNumber(o: any): o is number {
|
|
18
|
+
return _.isNumber(o) || !_.isNaN(parseInt(o, 10)) || !_.isNaN(parseFloat(o));
|
|
19
|
+
}
|