appium-uiautomator2-driver 2.45.1 → 3.0.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/CHANGELOG.md +20 -0
- package/build/lib/commands/actions.d.ts +11 -0
- package/build/lib/commands/actions.d.ts.map +1 -1
- package/build/lib/commands/actions.js +30 -1
- package/build/lib/commands/actions.js.map +1 -1
- package/build/lib/commands/gestures.js +1 -1
- package/build/lib/commands/gestures.js.map +1 -1
- package/build/lib/driver.d.ts +3 -70
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +2 -15
- package/build/lib/driver.js.map +1 -1
- package/build/lib/method-map.d.ts +0 -58
- package/build/lib/method-map.d.ts.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/lib/commands/actions.js +39 -0
- package/lib/commands/gestures.js +1 -1
- package/lib/driver.ts +4 -27
- package/npm-shrinkwrap.json +10 -10
- package/package.json +3 -3
- package/build/lib/commands/touch.d.ts +0 -83
- package/build/lib/commands/touch.d.ts.map +0 -1
- package/build/lib/commands/touch.js +0 -167
- package/build/lib/commands/touch.js.map +0 -1
- package/lib/commands/touch.js +0 -213
package/lib/commands/actions.js
CHANGED
|
@@ -42,6 +42,45 @@ export async function mobileUnscheduleAction(opts) {
|
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* @this {AndroidUiautomator2Driver}
|
|
47
|
+
* @param {import('@appium/types').StringRecord[]} actions
|
|
48
|
+
* @returns {Promise<void>}
|
|
49
|
+
*/
|
|
50
|
+
export async function performActions(actions) {
|
|
51
|
+
// This is mandatory, since Selenium API uses MOUSE as the default pointer type
|
|
52
|
+
const preprocessedActions = actions.map((action) =>
|
|
53
|
+
Object.assign(
|
|
54
|
+
{},
|
|
55
|
+
action,
|
|
56
|
+
action.type === 'pointer'
|
|
57
|
+
? {
|
|
58
|
+
parameters: {
|
|
59
|
+
pointerType: 'touch',
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
: {}
|
|
63
|
+
)
|
|
64
|
+
);
|
|
65
|
+
this.log.debug(`Preprocessed actions: ${JSON.stringify(preprocessedActions, null, ' ')}`);
|
|
66
|
+
await this.uiautomator2.jwproxy.command(
|
|
67
|
+
'/actions',
|
|
68
|
+
'POST',
|
|
69
|
+
{
|
|
70
|
+
actions: preprocessedActions,
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @this {AndroidUiautomator2Driver}
|
|
77
|
+
* @returns {Promise<void>}
|
|
78
|
+
*/
|
|
79
|
+
// eslint-disable-next-line require-await
|
|
80
|
+
export async function releaseActions() {
|
|
81
|
+
this.log.info('On this platform, releaseActions is a no-op');
|
|
82
|
+
}
|
|
83
|
+
|
|
45
84
|
/**
|
|
46
85
|
* @typedef {import('../driver').AndroidUiautomator2Driver} AndroidUiautomator2Driver
|
|
47
86
|
*/
|
package/lib/commands/gestures.js
CHANGED
package/lib/driver.ts
CHANGED
|
@@ -42,6 +42,8 @@ import {
|
|
|
42
42
|
mobileGetActionHistory,
|
|
43
43
|
mobileScheduleAction,
|
|
44
44
|
mobileUnscheduleAction,
|
|
45
|
+
performActions,
|
|
46
|
+
releaseActions,
|
|
45
47
|
} from './commands/actions';
|
|
46
48
|
import {
|
|
47
49
|
getAlertText,
|
|
@@ -126,18 +128,6 @@ import {
|
|
|
126
128
|
getScreenshot,
|
|
127
129
|
getViewportScreenshot,
|
|
128
130
|
} from './commands/screenshot';
|
|
129
|
-
import {
|
|
130
|
-
doSwipe,
|
|
131
|
-
doDrag,
|
|
132
|
-
touchDown,
|
|
133
|
-
touchLongClick,
|
|
134
|
-
touchMove,
|
|
135
|
-
touchUp,
|
|
136
|
-
tap,
|
|
137
|
-
doPerformMultiAction,
|
|
138
|
-
performActions,
|
|
139
|
-
releaseActions,
|
|
140
|
-
} from './commands/touch';
|
|
141
131
|
import {
|
|
142
132
|
getStatusBarHeight,
|
|
143
133
|
getDevicePixelRatio,
|
|
@@ -222,8 +212,6 @@ const NO_PROXY: RouteMatcher[] = [
|
|
|
222
212
|
['POST', new RegExp('^/session/[^/]+/location')],
|
|
223
213
|
['POST', new RegExp('^/session/[^/]+/network_connection')],
|
|
224
214
|
['POST', new RegExp('^/session/[^/]+/timeouts')],
|
|
225
|
-
['POST', new RegExp('^/session/[^/]+/touch/multi/perform')],
|
|
226
|
-
['POST', new RegExp('^/session/[^/]+/touch/perform')],
|
|
227
215
|
['POST', new RegExp('^/session/[^/]+/url')],
|
|
228
216
|
|
|
229
217
|
// MJSONWP commands
|
|
@@ -250,8 +238,6 @@ const CHROME_NO_PROXY: RouteMatcher[] = [
|
|
|
250
238
|
['POST', new RegExp('^/session/[^/]+/appium')],
|
|
251
239
|
['POST', new RegExp('^/session/[^/]+/context')],
|
|
252
240
|
['POST', new RegExp('^/session/[^/]+/orientation')],
|
|
253
|
-
['POST', new RegExp('^/session/[^/]+/touch/multi/perform')],
|
|
254
|
-
['POST', new RegExp('^/session/[^/]+/touch/perform')],
|
|
255
241
|
|
|
256
242
|
// this is needed to make the mobile: commands working in web context
|
|
257
243
|
['POST', new RegExp('^/session/[^/]+/execute$')],
|
|
@@ -1011,6 +997,8 @@ class AndroidUiautomator2Driver
|
|
|
1011
997
|
mobileGetActionHistory = mobileGetActionHistory;
|
|
1012
998
|
mobileScheduleAction = mobileScheduleAction;
|
|
1013
999
|
mobileUnscheduleAction = mobileUnscheduleAction;
|
|
1000
|
+
performActions = performActions;
|
|
1001
|
+
releaseActions = releaseActions;
|
|
1014
1002
|
|
|
1015
1003
|
getAlertText = getAlertText;
|
|
1016
1004
|
mobileAcceptAlert = mobileAcceptAlert;
|
|
@@ -1083,17 +1071,6 @@ class AndroidUiautomator2Driver
|
|
|
1083
1071
|
getScreenshot = getScreenshot;
|
|
1084
1072
|
getViewportScreenshot = getViewportScreenshot;
|
|
1085
1073
|
|
|
1086
|
-
doSwipe = doSwipe;
|
|
1087
|
-
doDrag = doDrag;
|
|
1088
|
-
touchDown = touchDown;
|
|
1089
|
-
touchLongClick = touchLongClick;
|
|
1090
|
-
touchMove = touchMove;
|
|
1091
|
-
touchUp = touchUp;
|
|
1092
|
-
tap = tap;
|
|
1093
|
-
doPerformMultiAction = doPerformMultiAction;
|
|
1094
|
-
performActions = performActions;
|
|
1095
|
-
releaseActions = releaseActions;
|
|
1096
|
-
|
|
1097
1074
|
getStatusBarHeight = getStatusBarHeight;
|
|
1098
1075
|
getDevicePixelRatio = getDevicePixelRatio;
|
|
1099
1076
|
getDisplayDensity = getDisplayDensity;
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium-uiautomator2-driver",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "appium-uiautomator2-driver",
|
|
9
|
-
"version": "
|
|
9
|
+
"version": "3.0.0",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"appium-adb": "^12.0.0",
|
|
13
|
-
"appium-android-driver": "^
|
|
13
|
+
"appium-android-driver": "^9.0.0",
|
|
14
14
|
"appium-chromedriver": "^5.6.28",
|
|
15
|
-
"appium-uiautomator2-server": "^
|
|
15
|
+
"appium-uiautomator2-server": "^7.0.0",
|
|
16
16
|
"asyncbox": "^3.0.0",
|
|
17
17
|
"axios": "^1.6.5",
|
|
18
18
|
"bluebird": "^3.5.1",
|
|
@@ -1073,9 +1073,9 @@
|
|
|
1073
1073
|
}
|
|
1074
1074
|
},
|
|
1075
1075
|
"node_modules/appium-android-driver": {
|
|
1076
|
-
"version": "
|
|
1077
|
-
"resolved": "https://registry.npmjs.org/appium-android-driver/-/appium-android-driver-
|
|
1078
|
-
"integrity": "sha512-
|
|
1076
|
+
"version": "9.0.0",
|
|
1077
|
+
"resolved": "https://registry.npmjs.org/appium-android-driver/-/appium-android-driver-9.0.0.tgz",
|
|
1078
|
+
"integrity": "sha512-AA1IRuG0BFVUPtXEV2YXvcP4QMNMV6WJb2uBPWban8y+i7C7ockMCfKxdGSEHO4c9/gNH+O5G0M7mhCdlvTwtQ==",
|
|
1079
1079
|
"dependencies": {
|
|
1080
1080
|
"@appium/support": "^4.2.0",
|
|
1081
1081
|
"@colors/colors": "^1.6.0",
|
|
@@ -1131,9 +1131,9 @@
|
|
|
1131
1131
|
}
|
|
1132
1132
|
},
|
|
1133
1133
|
"node_modules/appium-uiautomator2-server": {
|
|
1134
|
-
"version": "
|
|
1135
|
-
"resolved": "https://registry.npmjs.org/appium-uiautomator2-server/-/appium-uiautomator2-server-
|
|
1136
|
-
"integrity": "sha512-
|
|
1134
|
+
"version": "7.0.0",
|
|
1135
|
+
"resolved": "https://registry.npmjs.org/appium-uiautomator2-server/-/appium-uiautomator2-server-7.0.0.tgz",
|
|
1136
|
+
"integrity": "sha512-1q4CT/9ryJL8etIAudUS/gtp8RCS02/X+3Xob2EC8FC56wtAPUlgxfzs6y7BN0/iGA4lKv1U6h9yL9dFge4wDg==",
|
|
1137
1137
|
"engines": {
|
|
1138
1138
|
"node": ">=14",
|
|
1139
1139
|
"npm": ">=8"
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"automated testing",
|
|
8
8
|
"android"
|
|
9
9
|
],
|
|
10
|
-
"version": "
|
|
10
|
+
"version": "3.0.0",
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/appium/appium-uiautomator2-driver/issues"
|
|
13
13
|
},
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"appium-adb": "^12.0.0",
|
|
60
|
-
"appium-android-driver": "^
|
|
60
|
+
"appium-android-driver": "^9.0.0",
|
|
61
61
|
"appium-chromedriver": "^5.6.28",
|
|
62
|
-
"appium-uiautomator2-server": "^
|
|
62
|
+
"appium-uiautomator2-server": "^7.0.0",
|
|
63
63
|
"asyncbox": "^3.0.0",
|
|
64
64
|
"axios": "^1.6.5",
|
|
65
65
|
"bluebird": "^3.5.1",
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated
|
|
3
|
-
* @this {AndroidUiautomator2Driver}
|
|
4
|
-
* @param {import('appium-android-driver').SwipeOpts} swipeOpts
|
|
5
|
-
* @returns {Promise<void>}
|
|
6
|
-
*/
|
|
7
|
-
export function doSwipe(this: import("../driver").AndroidUiautomator2Driver, swipeOpts: import('appium-android-driver').SwipeOpts): Promise<void>;
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated
|
|
10
|
-
* @this {AndroidUiautomator2Driver}
|
|
11
|
-
* @param {import('appium-android-driver').DragOpts} dragOpts
|
|
12
|
-
* @returns {Promise<void>}
|
|
13
|
-
*/
|
|
14
|
-
export function doDrag(this: import("../driver").AndroidUiautomator2Driver, dragOpts: import('appium-android-driver').DragOpts): Promise<void>;
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated
|
|
17
|
-
* @this {AndroidUiautomator2Driver}
|
|
18
|
-
* @param {string} element
|
|
19
|
-
* @param {number} x
|
|
20
|
-
* @param {number} y
|
|
21
|
-
* @param {number} duration
|
|
22
|
-
* @returns {Promise<void>}
|
|
23
|
-
*/
|
|
24
|
-
export function touchLongClick(this: import("../driver").AndroidUiautomator2Driver, element: string, x: number, y: number, duration: number): Promise<void>;
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated
|
|
27
|
-
* @this {AndroidUiautomator2Driver}
|
|
28
|
-
* @param {string} element
|
|
29
|
-
* @param {number} x
|
|
30
|
-
* @param {number} y
|
|
31
|
-
* @returns {Promise<void>}
|
|
32
|
-
*/
|
|
33
|
-
export function touchDown(this: import("../driver").AndroidUiautomator2Driver, element: string, x: number, y: number): Promise<void>;
|
|
34
|
-
/**
|
|
35
|
-
* @deprecated
|
|
36
|
-
* @this {AndroidUiautomator2Driver}
|
|
37
|
-
* @param {string} element
|
|
38
|
-
* @param {number} x
|
|
39
|
-
* @param {number} y
|
|
40
|
-
* @returns {Promise<void>}
|
|
41
|
-
*/
|
|
42
|
-
export function touchUp(this: import("../driver").AndroidUiautomator2Driver, element: string, x: number, y: number): Promise<void>;
|
|
43
|
-
/**
|
|
44
|
-
* @deprecated
|
|
45
|
-
* @this {AndroidUiautomator2Driver}
|
|
46
|
-
* @param {string} element
|
|
47
|
-
* @param {number} x
|
|
48
|
-
* @param {number} y
|
|
49
|
-
* @returns {Promise<void>}
|
|
50
|
-
*/
|
|
51
|
-
export function touchMove(this: import("../driver").AndroidUiautomator2Driver, element: string, x: number, y: number): Promise<void>;
|
|
52
|
-
/**
|
|
53
|
-
* @deprecated
|
|
54
|
-
* @this {AndroidUiautomator2Driver}
|
|
55
|
-
* @param {string?} [elementId=null]
|
|
56
|
-
* @param {number?} [x=null]
|
|
57
|
-
* @param {number?} [y=null]
|
|
58
|
-
* @param {number} [count=1]
|
|
59
|
-
* @returns {Promise<void>}
|
|
60
|
-
*/
|
|
61
|
-
export function tap(this: import("../driver").AndroidUiautomator2Driver, elementId?: string | null | undefined, x?: number | null | undefined, y?: number | null | undefined, count?: number | undefined): Promise<void>;
|
|
62
|
-
/**
|
|
63
|
-
* @deprecated
|
|
64
|
-
* @this {AndroidUiautomator2Driver}
|
|
65
|
-
* @param {string} elementId
|
|
66
|
-
* @param {import('appium-android-driver').TouchState[]} states
|
|
67
|
-
* @returns {Promise<void>}
|
|
68
|
-
*/
|
|
69
|
-
export function doPerformMultiAction(this: import("../driver").AndroidUiautomator2Driver, elementId: string, states: import('appium-android-driver').TouchState[]): Promise<void>;
|
|
70
|
-
/**
|
|
71
|
-
* @this {AndroidUiautomator2Driver}
|
|
72
|
-
* @param {import('@appium/types').StringRecord[]} actions
|
|
73
|
-
* @returns {Promise<void>}
|
|
74
|
-
*/
|
|
75
|
-
export function performActions(this: import("../driver").AndroidUiautomator2Driver, actions: import('@appium/types').StringRecord[]): Promise<void>;
|
|
76
|
-
/**
|
|
77
|
-
* @this {AndroidUiautomator2Driver}
|
|
78
|
-
* @returns {Promise<void>}
|
|
79
|
-
*/
|
|
80
|
-
export function releaseActions(this: import("../driver").AndroidUiautomator2Driver): Promise<void>;
|
|
81
|
-
export type UiAutomator2Server = import('../uiautomator2').UiAutomator2Server;
|
|
82
|
-
export type AndroidUiautomator2Driver = import('../driver').AndroidUiautomator2Driver;
|
|
83
|
-
//# sourceMappingURL=touch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"touch.d.ts","sourceRoot":"","sources":["../../../lib/commands/touch.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wFAHW,OAAO,uBAAuB,EAAE,SAAS,GACvC,QAAQ,IAAI,CAAC,CAQzB;AAED;;;;;GAKG;AACH,sFAHW,OAAO,uBAAuB,EAAE,QAAQ,GACtC,QAAQ,IAAI,CAAC,CAQzB;AAED;;;;;;;;GAQG;AACH,6FANW,MAAM,KACN,MAAM,KACN,MAAM,YACN,MAAM,GACJ,QAAQ,IAAI,CAAC,CASzB;AAED;;;;;;;GAOG;AACH,wFALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,QAAQ,IAAI,CAAC,CASzB;AAED;;;;;;;GAOG;AACH,sFALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,QAAQ,IAAI,CAAC,CASzB;AAED;;;;;;;GAOG;AACH,wFALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,QAAQ,IAAI,CAAC,CASzB;AAED;;;;;;;;GAQG;AACH,2MAFa,QAAQ,IAAI,CAAC,CA4BzB;AAED;;;;;;GAMG;AACH,qGAJW,MAAM,UACN,OAAO,uBAAuB,EAAE,UAAU,EAAE,GAC1C,QAAQ,IAAI,CAAC,CAyBzB;AAED;;;;GAIG;AACH,6FAHW,OAAO,eAAe,EAAE,YAAY,EAAE,GACpC,QAAQ,IAAI,CAAC,CA0BzB;AAED;;;GAGG;AAEH,qFAHa,QAAQ,IAAI,CAAC,CAKzB;iCAGY,OAAO,iBAAiB,EAAE,kBAAkB;wCAC5C,OAAO,WAAW,EAAE,yBAAyB"}
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.releaseActions = exports.performActions = exports.doPerformMultiAction = exports.tap = exports.touchMove = exports.touchUp = exports.touchDown = exports.touchLongClick = exports.doDrag = exports.doSwipe = void 0;
|
|
4
|
-
const support_1 = require("appium/support");
|
|
5
|
-
const driver_1 = require("appium/driver");
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated
|
|
8
|
-
* @this {AndroidUiautomator2Driver}
|
|
9
|
-
* @param {import('appium-android-driver').SwipeOpts} swipeOpts
|
|
10
|
-
* @returns {Promise<void>}
|
|
11
|
-
*/
|
|
12
|
-
async function doSwipe(swipeOpts) {
|
|
13
|
-
await this.uiautomator2.jwproxy.command(`/touch/perform`, 'POST', swipeOpts);
|
|
14
|
-
}
|
|
15
|
-
exports.doSwipe = doSwipe;
|
|
16
|
-
/**
|
|
17
|
-
* @deprecated
|
|
18
|
-
* @this {AndroidUiautomator2Driver}
|
|
19
|
-
* @param {import('appium-android-driver').DragOpts} dragOpts
|
|
20
|
-
* @returns {Promise<void>}
|
|
21
|
-
*/
|
|
22
|
-
async function doDrag(dragOpts) {
|
|
23
|
-
await this.uiautomator2.jwproxy.command(`/touch/drag`, 'POST', dragOpts);
|
|
24
|
-
}
|
|
25
|
-
exports.doDrag = doDrag;
|
|
26
|
-
/**
|
|
27
|
-
* @deprecated
|
|
28
|
-
* @this {AndroidUiautomator2Driver}
|
|
29
|
-
* @param {string} element
|
|
30
|
-
* @param {number} x
|
|
31
|
-
* @param {number} y
|
|
32
|
-
* @param {number} duration
|
|
33
|
-
* @returns {Promise<void>}
|
|
34
|
-
*/
|
|
35
|
-
async function touchLongClick(element, x, y, duration) {
|
|
36
|
-
let params = { element, x, y, duration };
|
|
37
|
-
await this.uiautomator2.jwproxy.command(`/touch/longclick`, 'POST', { params });
|
|
38
|
-
}
|
|
39
|
-
exports.touchLongClick = touchLongClick;
|
|
40
|
-
/**
|
|
41
|
-
* @deprecated
|
|
42
|
-
* @this {AndroidUiautomator2Driver}
|
|
43
|
-
* @param {string} element
|
|
44
|
-
* @param {number} x
|
|
45
|
-
* @param {number} y
|
|
46
|
-
* @returns {Promise<void>}
|
|
47
|
-
*/
|
|
48
|
-
async function touchDown(element, x, y) {
|
|
49
|
-
let params = { element, x, y };
|
|
50
|
-
await this.uiautomator2.jwproxy.command(`/touch/down`, 'POST', { params });
|
|
51
|
-
}
|
|
52
|
-
exports.touchDown = touchDown;
|
|
53
|
-
/**
|
|
54
|
-
* @deprecated
|
|
55
|
-
* @this {AndroidUiautomator2Driver}
|
|
56
|
-
* @param {string} element
|
|
57
|
-
* @param {number} x
|
|
58
|
-
* @param {number} y
|
|
59
|
-
* @returns {Promise<void>}
|
|
60
|
-
*/
|
|
61
|
-
async function touchUp(element, x, y) {
|
|
62
|
-
let params = { element, x, y };
|
|
63
|
-
await this.uiautomator2.jwproxy.command(`/touch/up`, 'POST', { params });
|
|
64
|
-
}
|
|
65
|
-
exports.touchUp = touchUp;
|
|
66
|
-
/**
|
|
67
|
-
* @deprecated
|
|
68
|
-
* @this {AndroidUiautomator2Driver}
|
|
69
|
-
* @param {string} element
|
|
70
|
-
* @param {number} x
|
|
71
|
-
* @param {number} y
|
|
72
|
-
* @returns {Promise<void>}
|
|
73
|
-
*/
|
|
74
|
-
async function touchMove(element, x, y) {
|
|
75
|
-
let params = { element, x, y };
|
|
76
|
-
await this.uiautomator2.jwproxy.command(`/touch/move`, 'POST', { params });
|
|
77
|
-
}
|
|
78
|
-
exports.touchMove = touchMove;
|
|
79
|
-
/**
|
|
80
|
-
* @deprecated
|
|
81
|
-
* @this {AndroidUiautomator2Driver}
|
|
82
|
-
* @param {string?} [elementId=null]
|
|
83
|
-
* @param {number?} [x=null]
|
|
84
|
-
* @param {number?} [y=null]
|
|
85
|
-
* @param {number} [count=1]
|
|
86
|
-
* @returns {Promise<void>}
|
|
87
|
-
*/
|
|
88
|
-
async function tap(elementId = null, x = null, y = null, count = 1) {
|
|
89
|
-
const areCoordinatesDefined = support_1.util.hasValue(x) && support_1.util.hasValue(y);
|
|
90
|
-
if (!support_1.util.hasValue(elementId) && !areCoordinatesDefined) {
|
|
91
|
-
throw new Error(`Either element id to tap or both absolute coordinates should be defined`);
|
|
92
|
-
}
|
|
93
|
-
for (let i = 0; i < count; i++) {
|
|
94
|
-
if (support_1.util.hasValue(elementId) && !areCoordinatesDefined) {
|
|
95
|
-
// we are either tapping on the default location of the element
|
|
96
|
-
// or an offset from the top left corner
|
|
97
|
-
await this.uiautomator2.jwproxy.command(`/element/${elementId}/click`, 'POST');
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
await this.uiautomator2.jwproxy.command(`/appium/tap`, 'POST', {
|
|
101
|
-
x,
|
|
102
|
-
y,
|
|
103
|
-
[driver_1.W3C_ELEMENT_KEY]: elementId,
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
exports.tap = tap;
|
|
109
|
-
/**
|
|
110
|
-
* @deprecated
|
|
111
|
-
* @this {AndroidUiautomator2Driver}
|
|
112
|
-
* @param {string} elementId
|
|
113
|
-
* @param {import('appium-android-driver').TouchState[]} states
|
|
114
|
-
* @returns {Promise<void>}
|
|
115
|
-
*/
|
|
116
|
-
async function doPerformMultiAction(elementId, states) {
|
|
117
|
-
let opts;
|
|
118
|
-
if (elementId) {
|
|
119
|
-
opts = {
|
|
120
|
-
elementId,
|
|
121
|
-
actions: states,
|
|
122
|
-
};
|
|
123
|
-
await this.uiautomator2.jwproxy.command('/touch/multi/perform', 'POST', opts);
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
opts = {
|
|
127
|
-
actions: states,
|
|
128
|
-
};
|
|
129
|
-
await this.uiautomator2.jwproxy.command('/touch/multi/perform', 'POST', opts);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
exports.doPerformMultiAction = doPerformMultiAction;
|
|
133
|
-
/**
|
|
134
|
-
* @this {AndroidUiautomator2Driver}
|
|
135
|
-
* @param {import('@appium/types').StringRecord[]} actions
|
|
136
|
-
* @returns {Promise<void>}
|
|
137
|
-
*/
|
|
138
|
-
async function performActions(actions) {
|
|
139
|
-
this.log.debug(`Received the following W3C actions: ${JSON.stringify(actions, null, ' ')}`);
|
|
140
|
-
// This is mandatory, since Selenium API uses MOUSE as the default pointer type
|
|
141
|
-
const preprocessedActions = actions.map((action) => Object.assign({}, action, action.type === 'pointer'
|
|
142
|
-
? {
|
|
143
|
-
parameters: {
|
|
144
|
-
pointerType: 'touch',
|
|
145
|
-
},
|
|
146
|
-
}
|
|
147
|
-
: {}));
|
|
148
|
-
this.log.debug(`Preprocessed actions: ${JSON.stringify(preprocessedActions, null, ' ')}`);
|
|
149
|
-
await this.uiautomator2.jwproxy.command('/actions', 'POST', {
|
|
150
|
-
actions: preprocessedActions,
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
exports.performActions = performActions;
|
|
154
|
-
/**
|
|
155
|
-
* @this {AndroidUiautomator2Driver}
|
|
156
|
-
* @returns {Promise<void>}
|
|
157
|
-
*/
|
|
158
|
-
// eslint-disable-next-line require-await
|
|
159
|
-
async function releaseActions() {
|
|
160
|
-
this.log.info('On this platform, releaseActions is a no-op');
|
|
161
|
-
}
|
|
162
|
-
exports.releaseActions = releaseActions;
|
|
163
|
-
/**
|
|
164
|
-
* @typedef {import('../uiautomator2').UiAutomator2Server} UiAutomator2Server
|
|
165
|
-
* @typedef {import('../driver').AndroidUiautomator2Driver} AndroidUiautomator2Driver
|
|
166
|
-
*/
|
|
167
|
-
//# sourceMappingURL=touch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"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B,CACF,CAAC;AACJ,CAAC;AAxBD,wCAwBC;AAED;;;GAGG;AACH,yCAAyC;AAClC,KAAK,UAAU,cAAc;IAClC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC;AAC/D,CAAC;AAFD,wCAEC;AAED;;;GAGG"}
|
package/lib/commands/touch.js
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { util } from 'appium/support';
|
|
2
|
-
import { W3C_ELEMENT_KEY } from 'appium/driver';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated
|
|
6
|
-
* @this {AndroidUiautomator2Driver}
|
|
7
|
-
* @param {import('appium-android-driver').SwipeOpts} swipeOpts
|
|
8
|
-
* @returns {Promise<void>}
|
|
9
|
-
*/
|
|
10
|
-
export async function doSwipe(swipeOpts) {
|
|
11
|
-
await this.uiautomator2.jwproxy.command(
|
|
12
|
-
`/touch/perform`,
|
|
13
|
-
'POST',
|
|
14
|
-
swipeOpts
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated
|
|
20
|
-
* @this {AndroidUiautomator2Driver}
|
|
21
|
-
* @param {import('appium-android-driver').DragOpts} dragOpts
|
|
22
|
-
* @returns {Promise<void>}
|
|
23
|
-
*/
|
|
24
|
-
export async function doDrag(dragOpts) {
|
|
25
|
-
await this.uiautomator2.jwproxy.command(
|
|
26
|
-
`/touch/drag`,
|
|
27
|
-
'POST',
|
|
28
|
-
dragOpts
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @deprecated
|
|
34
|
-
* @this {AndroidUiautomator2Driver}
|
|
35
|
-
* @param {string} element
|
|
36
|
-
* @param {number} x
|
|
37
|
-
* @param {number} y
|
|
38
|
-
* @param {number} duration
|
|
39
|
-
* @returns {Promise<void>}
|
|
40
|
-
*/
|
|
41
|
-
export async function touchLongClick(element, x, y, duration) {
|
|
42
|
-
let params = {element, x, y, duration};
|
|
43
|
-
await this.uiautomator2.jwproxy.command(
|
|
44
|
-
`/touch/longclick`,
|
|
45
|
-
'POST',
|
|
46
|
-
{params}
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* @deprecated
|
|
52
|
-
* @this {AndroidUiautomator2Driver}
|
|
53
|
-
* @param {string} element
|
|
54
|
-
* @param {number} x
|
|
55
|
-
* @param {number} y
|
|
56
|
-
* @returns {Promise<void>}
|
|
57
|
-
*/
|
|
58
|
-
export async function touchDown(element, x, y) {
|
|
59
|
-
let params = {element, x, y};
|
|
60
|
-
await this.uiautomator2.jwproxy.command(
|
|
61
|
-
`/touch/down`,
|
|
62
|
-
'POST',
|
|
63
|
-
{params}
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* @deprecated
|
|
69
|
-
* @this {AndroidUiautomator2Driver}
|
|
70
|
-
* @param {string} element
|
|
71
|
-
* @param {number} x
|
|
72
|
-
* @param {number} y
|
|
73
|
-
* @returns {Promise<void>}
|
|
74
|
-
*/
|
|
75
|
-
export async function touchUp(element, x, y) {
|
|
76
|
-
let params = {element, x, y};
|
|
77
|
-
await this.uiautomator2.jwproxy.command(
|
|
78
|
-
`/touch/up`,
|
|
79
|
-
'POST',
|
|
80
|
-
{params}
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* @deprecated
|
|
86
|
-
* @this {AndroidUiautomator2Driver}
|
|
87
|
-
* @param {string} element
|
|
88
|
-
* @param {number} x
|
|
89
|
-
* @param {number} y
|
|
90
|
-
* @returns {Promise<void>}
|
|
91
|
-
*/
|
|
92
|
-
export async function touchMove(element, x, y) {
|
|
93
|
-
let params = {element, x, y};
|
|
94
|
-
await this.uiautomator2.jwproxy.command(
|
|
95
|
-
`/touch/move`,
|
|
96
|
-
'POST',
|
|
97
|
-
{params}
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* @deprecated
|
|
103
|
-
* @this {AndroidUiautomator2Driver}
|
|
104
|
-
* @param {string?} [elementId=null]
|
|
105
|
-
* @param {number?} [x=null]
|
|
106
|
-
* @param {number?} [y=null]
|
|
107
|
-
* @param {number} [count=1]
|
|
108
|
-
* @returns {Promise<void>}
|
|
109
|
-
*/
|
|
110
|
-
export async function tap(elementId = null, x = null, y = null, count = 1) {
|
|
111
|
-
const areCoordinatesDefined = util.hasValue(x) && util.hasValue(y);
|
|
112
|
-
if (!util.hasValue(elementId) && !areCoordinatesDefined) {
|
|
113
|
-
throw new Error(`Either element id to tap or both absolute coordinates should be defined`);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
for (let i = 0; i < count; i++) {
|
|
117
|
-
if (util.hasValue(elementId) && !areCoordinatesDefined) {
|
|
118
|
-
// we are either tapping on the default location of the element
|
|
119
|
-
// or an offset from the top left corner
|
|
120
|
-
await this.uiautomator2.jwproxy.command(
|
|
121
|
-
`/element/${elementId}/click`,
|
|
122
|
-
'POST'
|
|
123
|
-
);
|
|
124
|
-
} else {
|
|
125
|
-
await this.uiautomator2.jwproxy.command(
|
|
126
|
-
`/appium/tap`,
|
|
127
|
-
'POST',
|
|
128
|
-
{
|
|
129
|
-
x,
|
|
130
|
-
y,
|
|
131
|
-
[W3C_ELEMENT_KEY]: elementId,
|
|
132
|
-
}
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* @deprecated
|
|
140
|
-
* @this {AndroidUiautomator2Driver}
|
|
141
|
-
* @param {string} elementId
|
|
142
|
-
* @param {import('appium-android-driver').TouchState[]} states
|
|
143
|
-
* @returns {Promise<void>}
|
|
144
|
-
*/
|
|
145
|
-
export async function doPerformMultiAction(elementId, states) {
|
|
146
|
-
let opts;
|
|
147
|
-
if (elementId) {
|
|
148
|
-
opts = {
|
|
149
|
-
elementId,
|
|
150
|
-
actions: states,
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
await this.uiautomator2.jwproxy.command(
|
|
154
|
-
'/touch/multi/perform',
|
|
155
|
-
'POST',
|
|
156
|
-
opts
|
|
157
|
-
);
|
|
158
|
-
} else {
|
|
159
|
-
opts = {
|
|
160
|
-
actions: states,
|
|
161
|
-
};
|
|
162
|
-
await this.uiautomator2.jwproxy.command(
|
|
163
|
-
'/touch/multi/perform',
|
|
164
|
-
'POST',
|
|
165
|
-
opts
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* @this {AndroidUiautomator2Driver}
|
|
172
|
-
* @param {import('@appium/types').StringRecord[]} actions
|
|
173
|
-
* @returns {Promise<void>}
|
|
174
|
-
*/
|
|
175
|
-
export async function performActions(actions) {
|
|
176
|
-
this.log.debug(`Received the following W3C actions: ${JSON.stringify(actions, null, ' ')}`);
|
|
177
|
-
// This is mandatory, since Selenium API uses MOUSE as the default pointer type
|
|
178
|
-
const preprocessedActions = actions.map((action) =>
|
|
179
|
-
Object.assign(
|
|
180
|
-
{},
|
|
181
|
-
action,
|
|
182
|
-
action.type === 'pointer'
|
|
183
|
-
? {
|
|
184
|
-
parameters: {
|
|
185
|
-
pointerType: 'touch',
|
|
186
|
-
},
|
|
187
|
-
}
|
|
188
|
-
: {}
|
|
189
|
-
)
|
|
190
|
-
);
|
|
191
|
-
this.log.debug(`Preprocessed actions: ${JSON.stringify(preprocessedActions, null, ' ')}`);
|
|
192
|
-
await this.uiautomator2.jwproxy.command(
|
|
193
|
-
'/actions',
|
|
194
|
-
'POST',
|
|
195
|
-
{
|
|
196
|
-
actions: preprocessedActions,
|
|
197
|
-
}
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* @this {AndroidUiautomator2Driver}
|
|
203
|
-
* @returns {Promise<void>}
|
|
204
|
-
*/
|
|
205
|
-
// eslint-disable-next-line require-await
|
|
206
|
-
export async function releaseActions() {
|
|
207
|
-
this.log.info('On this platform, releaseActions is a no-op');
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* @typedef {import('../uiautomator2').UiAutomator2Server} UiAutomator2Server
|
|
212
|
-
* @typedef {import('../driver').AndroidUiautomator2Driver} AndroidUiautomator2Driver
|
|
213
|
-
*/
|