@appium/base-driver 9.17.0 → 10.0.0-beta.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.
- 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/timeout.js +7 -25
- 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 +12 -64
- 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 +1 -2
- 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 +1 -29
- 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/protocol.d.ts +5 -0
- package/build/lib/protocol/protocol.d.ts.map +1 -1
- package/build/lib/protocol/protocol.js +23 -23
- package/build/lib/protocol/protocol.js.map +1 -1
- package/build/lib/protocol/routes.d.ts +6 -715
- package/build/lib/protocol/routes.d.ts.map +1 -1
- package/build/lib/protocol/routes.js +16 -481
- 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 -24
- package/build/lib/protocol/validators.js.map +1 -1
- package/lib/basedriver/capabilities.ts +2 -4
- package/lib/basedriver/commands/timeout.ts +11 -34
- 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 +16 -75
- package/lib/express/server.js +1 -3
- package/lib/helpers/capabilities.js +9 -4
- package/lib/index.js +2 -0
- package/lib/jsonwp-proxy/proxy.js +2 -33
- package/lib/protocol/{errors.js → errors.ts} +322 -436
- package/lib/protocol/helpers.js +12 -8
- package/lib/protocol/protocol.js +25 -23
- package/lib/protocol/routes.js +18 -491
- package/lib/protocol/validators.ts +19 -0
- package/package.json +10 -10
- 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/desired-caps.js +0 -103
- package/lib/protocol/validators.js +0 -41
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,41 +28,26 @@ 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: (
|
|
63
|
-
if (
|
|
64
|
-
|
|
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
|
-
}
|
|
45
|
+
validate: ({script, pageLoad, implicit}) => {
|
|
46
|
+
if ([script, pageLoad, implicit].every(_.isNil)) {
|
|
47
|
+
return 'W3C protocol expects any of script, pageLoad or implicit to be set';
|
|
76
48
|
}
|
|
77
49
|
},
|
|
78
|
-
optional: ['
|
|
50
|
+
optional: ['script', 'pageLoad', 'implicit'],
|
|
79
51
|
},
|
|
80
52
|
},
|
|
81
53
|
},
|
|
@@ -110,22 +82,7 @@ export const METHOD_MAP = /** @type {const} */ ({
|
|
|
110
82
|
POST: {
|
|
111
83
|
command: 'setWindow',
|
|
112
84
|
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',
|
|
85
|
+
required: ['handle'],
|
|
129
86
|
},
|
|
130
87
|
},
|
|
131
88
|
DELETE: {command: 'closeWindow'},
|
|
@@ -170,8 +127,7 @@ export const METHOD_MAP = /** @type {const} */ ({
|
|
|
170
127
|
},
|
|
171
128
|
},
|
|
172
129
|
'/session/:sessionId/element/active': {
|
|
173
|
-
GET: {command: 'active'},
|
|
174
|
-
POST: {command: 'active', deprecated: true},
|
|
130
|
+
GET: {command: 'active'},
|
|
175
131
|
},
|
|
176
132
|
'/session/:sessionId/element/:elementId': {
|
|
177
133
|
GET: {},
|
|
@@ -198,18 +154,7 @@ export const METHOD_MAP = /** @type {const} */ ({
|
|
|
198
154
|
POST: {
|
|
199
155
|
command: 'setValue',
|
|
200
156
|
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],
|
|
157
|
+
required: ['text'],
|
|
213
158
|
},
|
|
214
159
|
},
|
|
215
160
|
},
|
|
@@ -268,7 +213,9 @@ export const METHOD_MAP = /** @type {const} */ ({
|
|
|
268
213
|
GET: {command: 'getAlertText'},
|
|
269
214
|
POST: {
|
|
270
215
|
command: 'setAlertText',
|
|
271
|
-
payloadParams:
|
|
216
|
+
payloadParams: {
|
|
217
|
+
required: ['text'],
|
|
218
|
+
},
|
|
272
219
|
},
|
|
273
220
|
},
|
|
274
221
|
'/session/:sessionId/alert/accept': {
|
|
@@ -366,7 +313,7 @@ export const METHOD_MAP = /** @type {const} */ ({
|
|
|
366
313
|
GET: {command: 'getAppiumSessionCapabilities'}
|
|
367
314
|
},
|
|
368
315
|
'/session/:sessionId/appium/device/system_time': {
|
|
369
|
-
GET: {command: 'getDeviceTime'
|
|
316
|
+
GET: {command: 'getDeviceTime'},
|
|
370
317
|
POST: {command: 'getDeviceTime', payloadParams: {optional: ['format']}},
|
|
371
318
|
},
|
|
372
319
|
// #region Applications Management
|
|
@@ -415,18 +362,11 @@ export const METHOD_MAP = /** @type {const} */ ({
|
|
|
415
362
|
},
|
|
416
363
|
},
|
|
417
364
|
'/session/:sessionId/appium/device/app_state': {
|
|
418
|
-
GET: {
|
|
419
|
-
command: 'queryAppState',
|
|
420
|
-
payloadParams: {
|
|
421
|
-
required: [['appId'], ['bundleId']],
|
|
422
|
-
},
|
|
423
|
-
},
|
|
424
365
|
POST: {
|
|
425
366
|
command: 'queryAppState',
|
|
426
367
|
payloadParams: {
|
|
427
368
|
required: [['appId'], ['bundleId']],
|
|
428
369
|
},
|
|
429
|
-
deprecated: true,
|
|
430
370
|
},
|
|
431
371
|
},
|
|
432
372
|
// #endregion
|
|
@@ -530,419 +470,6 @@ export const METHOD_MAP = /** @type {const} */ ({
|
|
|
530
470
|
},
|
|
531
471
|
},
|
|
532
472
|
// #endregion
|
|
533
|
-
|
|
534
|
-
//
|
|
535
|
-
// Endpoints deprecated entirely
|
|
536
|
-
//
|
|
537
|
-
// #region MJSONWP
|
|
538
|
-
'/sessions': {
|
|
539
|
-
GET: {command: 'getSessions', deprecated: true},
|
|
540
|
-
},
|
|
541
|
-
'/session/:sessionId/timeouts/async_script': {
|
|
542
|
-
POST: {command: 'asyncScriptTimeout', payloadParams: {required: ['ms']}, deprecated: true},
|
|
543
|
-
},
|
|
544
|
-
'/session/:sessionId/timeouts/implicit_wait': {
|
|
545
|
-
POST: {command: 'implicitWait', payloadParams: {required: ['ms']}, deprecated: true},
|
|
546
|
-
},
|
|
547
|
-
'/session/:sessionId/window_handle': {
|
|
548
|
-
GET: {command: 'getWindowHandle', deprecated: true},
|
|
549
|
-
},
|
|
550
|
-
// Only 'window/handles' exists in W3C WebDriver spec.
|
|
551
|
-
'/session/:sessionId/window/handle': {
|
|
552
|
-
GET: {command: 'getWindowHandle', deprecated: true},
|
|
553
|
-
},
|
|
554
|
-
'/session/:sessionId/window_handles': {
|
|
555
|
-
GET: {command: 'getWindowHandles', deprecated: true},
|
|
556
|
-
},
|
|
557
|
-
'/session/:sessionId/execute': {
|
|
558
|
-
POST: {
|
|
559
|
-
command: 'execute',
|
|
560
|
-
payloadParams: {required: ['script', 'args']},
|
|
561
|
-
deprecated: true
|
|
562
|
-
},
|
|
563
|
-
},
|
|
564
|
-
'/session/:sessionId/execute_async': {
|
|
565
|
-
POST: {
|
|
566
|
-
command: 'executeAsync',
|
|
567
|
-
payloadParams: {required: ['script', 'args']},
|
|
568
|
-
deprecated: true
|
|
569
|
-
},
|
|
570
|
-
},
|
|
571
|
-
'/session/:sessionId/window/:windowhandle/size': {
|
|
572
|
-
GET: {command: 'getWindowSize', deprecated: true},
|
|
573
|
-
},
|
|
574
|
-
'/session/:sessionId/window/:windowhandle/position': {
|
|
575
|
-
POST: {deprecated: true},
|
|
576
|
-
GET: {deprecated: true},
|
|
577
|
-
},
|
|
578
|
-
'/session/:sessionId/window/:windowhandle/maximize': {
|
|
579
|
-
POST: {command: 'maximizeWindow', deprecated: true},
|
|
580
|
-
},
|
|
581
|
-
'/session/:sessionId/element/:elementId/submit': {
|
|
582
|
-
POST: {command: 'submit', deprecated: true},
|
|
583
|
-
},
|
|
584
|
-
'/session/:sessionId/keys': {
|
|
585
|
-
POST: {command: 'keys', payloadParams: {required: ['value']}, deprecated: true},
|
|
586
|
-
},
|
|
587
|
-
'/session/:sessionId/element/:elementId/equals/:otherId': {
|
|
588
|
-
GET: {command: 'equalsElement', deprecated: true},
|
|
589
|
-
},
|
|
590
|
-
'/session/:sessionId/element/:elementId/location': {
|
|
591
|
-
GET: {command: 'getLocation', deprecated: true},
|
|
592
|
-
},
|
|
593
|
-
'/session/:sessionId/element/:elementId/location_in_view': {
|
|
594
|
-
GET: {command: 'getLocationInView', deprecated: true},
|
|
595
|
-
},
|
|
596
|
-
'/session/:sessionId/element/:elementId/size': {
|
|
597
|
-
GET: {command: 'getSize', deprecated: true},
|
|
598
|
-
},
|
|
599
|
-
'/session/:sessionId/moveto': {
|
|
600
|
-
POST: {
|
|
601
|
-
command: 'moveTo',
|
|
602
|
-
payloadParams: {optional: ['element', 'xoffset', 'yoffset']},
|
|
603
|
-
deprecated: true,
|
|
604
|
-
},
|
|
605
|
-
},
|
|
606
|
-
'/session/:sessionId/click': {
|
|
607
|
-
POST: {command: 'clickCurrent', payloadParams: {optional: ['button']}, deprecated: true},
|
|
608
|
-
},
|
|
609
|
-
'/session/:sessionId/buttondown': {
|
|
610
|
-
POST: {command: 'buttonDown', payloadParams: {optional: ['button']}, deprecated: true},
|
|
611
|
-
},
|
|
612
|
-
'/session/:sessionId/buttonup': {
|
|
613
|
-
POST: {command: 'buttonUp', payloadParams: {optional: ['button']}, deprecated: true},
|
|
614
|
-
},
|
|
615
|
-
'/session/:sessionId/doubleclick': {
|
|
616
|
-
POST: {command: 'doubleClick', deprecated: true},
|
|
617
|
-
},
|
|
618
|
-
'/session/:sessionId/touch/click': {
|
|
619
|
-
POST: {command: 'click', payloadParams: {required: ['element']}, deprecated: true},
|
|
620
|
-
},
|
|
621
|
-
'/session/:sessionId/touch/down': {
|
|
622
|
-
POST: {command: 'touchDown', payloadParams: {required: ['x', 'y']}, deprecated: true},
|
|
623
|
-
},
|
|
624
|
-
'/session/:sessionId/touch/up': {
|
|
625
|
-
POST: {command: 'touchUp', payloadParams: {required: ['x', 'y']}, deprecated: true},
|
|
626
|
-
},
|
|
627
|
-
'/session/:sessionId/touch/move': {
|
|
628
|
-
POST: {command: 'touchMove', payloadParams: {required: ['x', 'y']}, deprecated: true},
|
|
629
|
-
},
|
|
630
|
-
'/session/:sessionId/touch/scroll': {
|
|
631
|
-
POST: {deprecated: true},
|
|
632
|
-
},
|
|
633
|
-
'/session/:sessionId/touch/doubleclick': {
|
|
634
|
-
POST: {deprecated: true},
|
|
635
|
-
},
|
|
636
|
-
'/session/:sessionId/touch/longclick': {
|
|
637
|
-
POST: {
|
|
638
|
-
command: 'touchLongClick',
|
|
639
|
-
payloadParams: {required: ['elements']},
|
|
640
|
-
deprecated: true,
|
|
641
|
-
},
|
|
642
|
-
},
|
|
643
|
-
'/session/:sessionId/touch/flick': {
|
|
644
|
-
POST: {
|
|
645
|
-
command: 'flick',
|
|
646
|
-
payloadParams: {
|
|
647
|
-
optional: ['element', 'xspeed', 'yspeed', 'xoffset', 'yoffset', 'speed'],
|
|
648
|
-
},
|
|
649
|
-
deprecated: true,
|
|
650
|
-
},
|
|
651
|
-
},
|
|
652
|
-
'/session/:sessionId/local_storage': {
|
|
653
|
-
GET: {deprecated: true},
|
|
654
|
-
POST: {deprecated: true},
|
|
655
|
-
DELETE: {deprecated: true},
|
|
656
|
-
},
|
|
657
|
-
'/session/:sessionId/local_storage/key/:key': {
|
|
658
|
-
GET: {deprecated: true},
|
|
659
|
-
DELETE: {deprecated: true},
|
|
660
|
-
},
|
|
661
|
-
'/session/:sessionId/local_storage/size': {
|
|
662
|
-
GET: {deprecated: true},
|
|
663
|
-
},
|
|
664
|
-
'/session/:sessionId/session_storage': {
|
|
665
|
-
GET: {deprecated: true},
|
|
666
|
-
POST: {deprecated: true},
|
|
667
|
-
DELETE: {deprecated: true},
|
|
668
|
-
},
|
|
669
|
-
'/session/:sessionId/session_storage/key/:key': {
|
|
670
|
-
GET: {deprecated: true},
|
|
671
|
-
DELETE: {deprecated: true},
|
|
672
|
-
},
|
|
673
|
-
'/session/:sessionId/session_storage/size': {
|
|
674
|
-
GET: {deprecated: true},
|
|
675
|
-
},
|
|
676
|
-
'/session/:sessionId/application_cache/status': {
|
|
677
|
-
GET: {deprecated: true},
|
|
678
|
-
},
|
|
679
|
-
'/session/:sessionId/alert_text': {
|
|
680
|
-
GET: {command: 'getAlertText', deprecated: true},
|
|
681
|
-
POST: {
|
|
682
|
-
command: 'setAlertText',
|
|
683
|
-
payloadParams: SET_ALERT_TEXT_PAYLOAD_PARAMS,
|
|
684
|
-
deprecated: true
|
|
685
|
-
},
|
|
686
|
-
},
|
|
687
|
-
'/session/:sessionId/accept_alert': {
|
|
688
|
-
POST: {command: 'postAcceptAlert', deprecated: true},
|
|
689
|
-
},
|
|
690
|
-
'/session/:sessionId/dismiss_alert': {
|
|
691
|
-
POST: {command: 'postDismissAlert', deprecated: true},
|
|
692
|
-
},
|
|
693
|
-
// Pre-W3C endpoint for element screenshot
|
|
694
|
-
'/session/:sessionId/screenshot/:elementId': {
|
|
695
|
-
GET: {command: 'getElementScreenshot', deprecated: true},
|
|
696
|
-
},
|
|
697
|
-
// #endregion
|
|
698
|
-
// #region Appium specific
|
|
699
|
-
'/session/:sessionId/element/:elementId/pageIndex': {
|
|
700
|
-
GET: {command: 'getPageIndex', deprecated: true},
|
|
701
|
-
},
|
|
702
|
-
'/session/:sessionId/touch/perform': {
|
|
703
|
-
POST: {
|
|
704
|
-
command: 'performTouch',
|
|
705
|
-
payloadParams: {wrap: 'actions', required: ['actions']},
|
|
706
|
-
deprecated: true,
|
|
707
|
-
},
|
|
708
|
-
},
|
|
709
|
-
'/session/:sessionId/touch/multi/perform': {
|
|
710
|
-
POST: {
|
|
711
|
-
command: 'performMultiAction',
|
|
712
|
-
payloadParams: {required: ['actions'], optional: ['elementId']},
|
|
713
|
-
deprecated: true,
|
|
714
|
-
},
|
|
715
|
-
},
|
|
716
|
-
'/session/:sessionId/appium/device/shake': {
|
|
717
|
-
POST: {command: 'mobileShake', deprecated: true},
|
|
718
|
-
},
|
|
719
|
-
'/session/:sessionId/appium/device/lock': {
|
|
720
|
-
POST: {command: 'lock', payloadParams: {optional: ['seconds']}, deprecated: true},
|
|
721
|
-
},
|
|
722
|
-
'/session/:sessionId/appium/device/unlock': {
|
|
723
|
-
POST: {command: 'unlock', deprecated: true},
|
|
724
|
-
},
|
|
725
|
-
'/session/:sessionId/appium/device/is_locked': {
|
|
726
|
-
POST: {command: 'isLocked', deprecated: true},
|
|
727
|
-
},
|
|
728
|
-
'/session/:sessionId/appium/start_recording_screen': {
|
|
729
|
-
POST: {
|
|
730
|
-
command: 'startRecordingScreen',
|
|
731
|
-
payloadParams: {optional: ['options']},
|
|
732
|
-
deprecated: true,
|
|
733
|
-
},
|
|
734
|
-
},
|
|
735
|
-
'/session/:sessionId/appium/stop_recording_screen': {
|
|
736
|
-
POST: {
|
|
737
|
-
command: 'stopRecordingScreen',
|
|
738
|
-
payloadParams: {optional: ['options']},
|
|
739
|
-
deprecated: true,
|
|
740
|
-
},
|
|
741
|
-
},
|
|
742
|
-
'/session/:sessionId/appium/performanceData/types': {
|
|
743
|
-
POST: {command: 'getPerformanceDataTypes', deprecated: true},
|
|
744
|
-
},
|
|
745
|
-
'/session/:sessionId/appium/getPerformanceData': {
|
|
746
|
-
POST: {
|
|
747
|
-
command: 'getPerformanceData',
|
|
748
|
-
payloadParams: {
|
|
749
|
-
required: ['packageName', 'dataType'],
|
|
750
|
-
optional: ['dataReadTimeout'],
|
|
751
|
-
},
|
|
752
|
-
deprecated: true,
|
|
753
|
-
},
|
|
754
|
-
},
|
|
755
|
-
'/session/:sessionId/appium/device/press_keycode': {
|
|
756
|
-
POST: {
|
|
757
|
-
command: 'pressKeyCode',
|
|
758
|
-
payloadParams: {required: ['keycode'], optional: ['metastate', 'flags']},
|
|
759
|
-
deprecated: true,
|
|
760
|
-
},
|
|
761
|
-
},
|
|
762
|
-
'/session/:sessionId/appium/device/long_press_keycode': {
|
|
763
|
-
POST: {
|
|
764
|
-
command: 'longPressKeyCode',
|
|
765
|
-
payloadParams: {required: ['keycode'], optional: ['metastate', 'flags']},
|
|
766
|
-
deprecated: true,
|
|
767
|
-
},
|
|
768
|
-
},
|
|
769
|
-
'/session/:sessionId/appium/device/finger_print': {
|
|
770
|
-
POST: {
|
|
771
|
-
command: 'fingerprint',
|
|
772
|
-
payloadParams: {required: ['fingerprintId']},
|
|
773
|
-
deprecated: true,
|
|
774
|
-
},
|
|
775
|
-
},
|
|
776
|
-
'/session/:sessionId/appium/device/send_sms': {
|
|
777
|
-
POST: {
|
|
778
|
-
command: 'sendSMS',
|
|
779
|
-
payloadParams: {required: ['phoneNumber', 'message']},
|
|
780
|
-
deprecated: true,
|
|
781
|
-
},
|
|
782
|
-
},
|
|
783
|
-
'/session/:sessionId/appium/device/gsm_call': {
|
|
784
|
-
POST: {
|
|
785
|
-
command: 'gsmCall',
|
|
786
|
-
payloadParams: {required: ['phoneNumber', 'action']},
|
|
787
|
-
deprecated: true,
|
|
788
|
-
},
|
|
789
|
-
},
|
|
790
|
-
'/session/:sessionId/appium/device/gsm_signal': {
|
|
791
|
-
POST: {
|
|
792
|
-
command: 'gsmSignal',
|
|
793
|
-
payloadParams: {required: ['signalStrength']},
|
|
794
|
-
deprecated: true,
|
|
795
|
-
},
|
|
796
|
-
},
|
|
797
|
-
'/session/:sessionId/appium/device/gsm_voice': {
|
|
798
|
-
POST: {command: 'gsmVoice', payloadParams: {required: ['state']}, deprecated: true},
|
|
799
|
-
},
|
|
800
|
-
'/session/:sessionId/appium/device/power_capacity': {
|
|
801
|
-
POST: {command: 'powerCapacity', payloadParams: {required: ['percent']}, deprecated: true},
|
|
802
|
-
},
|
|
803
|
-
'/session/:sessionId/appium/device/power_ac': {
|
|
804
|
-
POST: {command: 'powerAC', payloadParams: {required: ['state']}, deprecated: true},
|
|
805
|
-
},
|
|
806
|
-
'/session/:sessionId/appium/device/network_speed': {
|
|
807
|
-
POST: {command: 'networkSpeed', payloadParams: {required: ['netspeed']}, deprecated: true},
|
|
808
|
-
},
|
|
809
|
-
'/session/:sessionId/appium/device/keyevent': {
|
|
810
|
-
POST: {
|
|
811
|
-
command: 'keyevent',
|
|
812
|
-
payloadParams: {required: ['keycode'], optional: ['metastate']},
|
|
813
|
-
deprecated: true,
|
|
814
|
-
},
|
|
815
|
-
},
|
|
816
|
-
'/session/:sessionId/appium/device/current_activity': {
|
|
817
|
-
GET: {command: 'getCurrentActivity', deprecated: true},
|
|
818
|
-
},
|
|
819
|
-
'/session/:sessionId/appium/device/current_package': {
|
|
820
|
-
GET: {command: 'getCurrentPackage', deprecated: true},
|
|
821
|
-
},
|
|
822
|
-
'/session/:sessionId/appium/device/toggle_airplane_mode': {
|
|
823
|
-
POST: {command: 'toggleFlightMode', deprecated: true},
|
|
824
|
-
},
|
|
825
|
-
'/session/:sessionId/appium/device/toggle_data': {
|
|
826
|
-
POST: {command: 'toggleData', deprecated: true},
|
|
827
|
-
},
|
|
828
|
-
'/session/:sessionId/appium/device/toggle_wifi': {
|
|
829
|
-
POST: {command: 'toggleWiFi', deprecated: true},
|
|
830
|
-
},
|
|
831
|
-
'/session/:sessionId/appium/device/toggle_location_services': {
|
|
832
|
-
POST: {command: 'toggleLocationServices', deprecated: true},
|
|
833
|
-
},
|
|
834
|
-
'/session/:sessionId/appium/device/open_notifications': {
|
|
835
|
-
POST: {command: 'openNotifications', deprecated: true},
|
|
836
|
-
},
|
|
837
|
-
'/session/:sessionId/appium/device/start_activity': {
|
|
838
|
-
POST: {
|
|
839
|
-
command: 'startActivity',
|
|
840
|
-
payloadParams: {
|
|
841
|
-
required: ['appPackage', 'appActivity'],
|
|
842
|
-
optional: [
|
|
843
|
-
'appWaitPackage',
|
|
844
|
-
'appWaitActivity',
|
|
845
|
-
'intentAction',
|
|
846
|
-
'intentCategory',
|
|
847
|
-
'intentFlags',
|
|
848
|
-
'optionalIntentArguments',
|
|
849
|
-
'dontStopAppOnReset',
|
|
850
|
-
],
|
|
851
|
-
},
|
|
852
|
-
deprecated: true,
|
|
853
|
-
},
|
|
854
|
-
},
|
|
855
|
-
'/session/:sessionId/appium/device/system_bars': {
|
|
856
|
-
GET: {command: 'getSystemBars', deprecated: true},
|
|
857
|
-
},
|
|
858
|
-
'/session/:sessionId/appium/device/display_density': {
|
|
859
|
-
GET: {command: 'getDisplayDensity', deprecated: true},
|
|
860
|
-
},
|
|
861
|
-
'/session/:sessionId/appium/simulator/touch_id': {
|
|
862
|
-
POST: {command: 'touchId', payloadParams: {required: ['match']}, deprecated: true},
|
|
863
|
-
},
|
|
864
|
-
'/session/:sessionId/appium/simulator/toggle_touch_id_enrollment': {
|
|
865
|
-
POST: {
|
|
866
|
-
command: 'toggleEnrollTouchId',
|
|
867
|
-
payloadParams: {optional: ['enabled']},
|
|
868
|
-
deprecated: true,
|
|
869
|
-
},
|
|
870
|
-
},
|
|
871
|
-
'/session/:sessionId/appium/app/launch': {
|
|
872
|
-
POST: {command: 'launchApp', deprecated: true},
|
|
873
|
-
},
|
|
874
|
-
'/session/:sessionId/appium/app/close': {
|
|
875
|
-
POST: {command: 'closeApp', deprecated: true},
|
|
876
|
-
},
|
|
877
|
-
'/session/:sessionId/appium/app/reset': {
|
|
878
|
-
POST: {command: 'reset', deprecated: true},
|
|
879
|
-
},
|
|
880
|
-
'/session/:sessionId/appium/app/background': {
|
|
881
|
-
POST: {command: 'background', payloadParams: {required: ['seconds']}, deprecated: true},
|
|
882
|
-
},
|
|
883
|
-
'/session/:sessionId/appium/app/end_test_coverage': {
|
|
884
|
-
POST: {
|
|
885
|
-
command: 'endCoverage',
|
|
886
|
-
payloadParams: {required: ['intent', 'path']},
|
|
887
|
-
deprecated: true,
|
|
888
|
-
},
|
|
889
|
-
},
|
|
890
|
-
'/session/:sessionId/appium/app/strings': {
|
|
891
|
-
POST: {
|
|
892
|
-
command: 'getStrings',
|
|
893
|
-
payloadParams: {optional: ['language', 'stringFile']},
|
|
894
|
-
deprecated: true,
|
|
895
|
-
},
|
|
896
|
-
},
|
|
897
|
-
'/session/:sessionId/appium/element/:elementId/value': {
|
|
898
|
-
POST: {
|
|
899
|
-
command: 'setValueImmediate',
|
|
900
|
-
payloadParams: {required: ['text']},
|
|
901
|
-
deprecated: true,
|
|
902
|
-
},
|
|
903
|
-
},
|
|
904
|
-
'/session/:sessionId/appium/element/:elementId/replace_value': {
|
|
905
|
-
POST: {
|
|
906
|
-
command: 'replaceValue',
|
|
907
|
-
payloadParams: {required: ['text']},
|
|
908
|
-
deprecated: true,
|
|
909
|
-
},
|
|
910
|
-
},
|
|
911
|
-
'/session/:sessionId/appium/receive_async_response': {
|
|
912
|
-
POST: {
|
|
913
|
-
command: 'receiveAsyncResponse',
|
|
914
|
-
payloadParams: {required: ['response']},
|
|
915
|
-
deprecated: true,
|
|
916
|
-
},
|
|
917
|
-
},
|
|
918
|
-
'/session/:sessionId/appium/device/set_clipboard': {
|
|
919
|
-
POST: {
|
|
920
|
-
command: 'setClipboard',
|
|
921
|
-
payloadParams: {
|
|
922
|
-
required: ['content'],
|
|
923
|
-
optional: ['contentType', 'label'],
|
|
924
|
-
},
|
|
925
|
-
deprecated: true,
|
|
926
|
-
},
|
|
927
|
-
},
|
|
928
|
-
'/session/:sessionId/appium/device/get_clipboard': {
|
|
929
|
-
POST: {
|
|
930
|
-
command: 'getClipboard',
|
|
931
|
-
payloadParams: {
|
|
932
|
-
optional: ['contentType'],
|
|
933
|
-
},
|
|
934
|
-
deprecated: true,
|
|
935
|
-
},
|
|
936
|
-
},
|
|
937
|
-
// #endregion
|
|
938
|
-
// #region JSONWP
|
|
939
|
-
'/session/:sessionId/log': {
|
|
940
|
-
POST: {command: 'getLog', payloadParams: {required: ['type']}, deprecated: true},
|
|
941
|
-
},
|
|
942
|
-
'/session/:sessionId/log/types': {
|
|
943
|
-
GET: {command: 'getLogTypes', deprecated: true},
|
|
944
|
-
},
|
|
945
|
-
// #endregion
|
|
946
473
|
});
|
|
947
474
|
|
|
948
475
|
// driver command names
|
|
@@ -1014,4 +541,4 @@ function toCommandNameCacheKey(endpoint, method) {
|
|
|
1014
541
|
}
|
|
1015
542
|
|
|
1016
543
|
// driver commands that do not require a session to already exist
|
|
1017
|
-
export const NO_SESSION_ID_COMMANDS = ['createSession', 'getStatus', '
|
|
544
|
+
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
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appium/base-driver",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0-beta.1",
|
|
4
4
|
"description": "Base driver class for Appium drivers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
],
|
|
39
39
|
"scripts": {
|
|
40
40
|
"test": "run-p test:unit test:types",
|
|
41
|
-
"test:e2e": "mocha --timeout 20s --slow 10s \"./test/e2e/**/*.spec.js\"",
|
|
41
|
+
"test:e2e": "mocha --exit --timeout 20s --slow 10s \"./test/e2e/**/*.spec.js\"",
|
|
42
42
|
"test:smoke": "node ./index.js",
|
|
43
43
|
"test:unit": "mocha \"./test/unit/**/*.spec.js\"",
|
|
44
44
|
"test:types": "tsd"
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"@colors/colors": "1.6.0",
|
|
50
50
|
"async-lock": "1.4.1",
|
|
51
51
|
"asyncbox": "3.0.0",
|
|
52
|
-
"axios": "1.
|
|
52
|
+
"axios": "1.9.0",
|
|
53
53
|
"bluebird": "3.7.2",
|
|
54
54
|
"body-parser": "1.20.3",
|
|
55
|
-
"express": "
|
|
55
|
+
"express": "5.0.1",
|
|
56
56
|
"fastest-levenshtein": "1.0.16",
|
|
57
57
|
"http-status-codes": "2.3.0",
|
|
58
58
|
"lodash": "4.17.21",
|
|
@@ -62,20 +62,20 @@
|
|
|
62
62
|
"path-to-regexp": "8.2.0",
|
|
63
63
|
"serve-favicon": "2.5.0",
|
|
64
64
|
"source-map-support": "0.5.21",
|
|
65
|
-
"type-fest": "4.40.0"
|
|
66
|
-
"validate.js": "0.13.1"
|
|
65
|
+
"type-fest": "4.40.0"
|
|
67
66
|
},
|
|
68
67
|
"optionalDependencies": {
|
|
69
68
|
"spdy": "4.0.2"
|
|
70
69
|
},
|
|
71
70
|
"engines": {
|
|
72
|
-
"node": "^
|
|
73
|
-
"npm": ">=
|
|
71
|
+
"node": "^20.9.0 || >=22.11.0",
|
|
72
|
+
"npm": ">=10"
|
|
74
73
|
},
|
|
75
74
|
"publishConfig": {
|
|
76
|
-
"access": "public"
|
|
75
|
+
"access": "public",
|
|
76
|
+
"tag": "beta"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "9bb5f3f706c5ae1c1ed600a8d0c4e9536936c5ff",
|
|
79
79
|
"tsd": {
|
|
80
80
|
"directory": "test/types"
|
|
81
81
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"desired-caps.d.ts","sourceRoot":"","sources":["../../../lib/basedriver/desired-caps.js"],"names":[],"mappings":"AAIA,wBACa,OAAO,aAAa,EAAE,UAAU,GAAG;IAAC,OAAO,EAAE,QAAyB,CAAA;CAAC,CAEhF;cALU,UAAU"}
|