appium-uiautomator2-driver 2.45.1 → 3.0.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.
@@ -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
- {"version":3,"file":"touch.js","sourceRoot":"","sources":["../../../lib/commands/touch.js"],"names":[],"mappings":";;;AAAA,4CAAsC;AACtC,0CAAgD;AAEhD;;;;;GAKG;AACI,KAAK,UAAU,OAAO,CAAC,SAAS;IACrC,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CACrC,gBAAgB,EAChB,MAAM,EACN,SAAS,CACV,CAAC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EMENT_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
- */