appium-uiautomator2-driver 3.6.1 → 3.7.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.
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @this {AndroidUiautomator2Driver}
3
+ * @returns {Promise<string>} Base64-encoded content of the clipboard
4
+ * or an empty string if the clipboard is empty.
5
+ */
6
+ export async function getClipboard() {
7
+ return String(
8
+ (await this.adb.getApiLevel()) < 29
9
+ ? await this.uiautomator2.jwproxy.command(
10
+ '/appium/device/get_clipboard',
11
+ 'POST',
12
+ {}
13
+ )
14
+ : await this.settingsApp.getClipboard()
15
+ );
16
+ }
17
+
18
+ /**
19
+ * @this {AndroidUiautomator2Driver}
20
+ * @returns {Promise<string>} Base64-encoded content of the clipboard
21
+ * or an empty string if the clipboard is empty.
22
+ */
23
+ export async function mobileGetClipboard() {
24
+ return await this.getClipboard();
25
+ }
26
+
27
+ /**
28
+ * @this {AndroidUiautomator2Driver}
29
+ * @param {string} content Base64-encoded clipboard payload
30
+ * @param {'plaintext'} [contentType='plaintext'] Only a single
31
+ * content type is supported, which is 'plaintext'
32
+ * @param {string} [label] Optinal label to identify the current
33
+ * clipboard payload
34
+ * @returns {Promise<void>}
35
+ */
36
+ export async function setClipboard(content, contentType, label) {
37
+ await this.uiautomator2.jwproxy.command(
38
+ '/appium/device/set_clipboard',
39
+ 'POST',
40
+ {content, contentType, label}
41
+ );
42
+ }
43
+
44
+ /**
45
+ * @this {AndroidUiautomator2Driver}
46
+ * @param {import('./types').SetClipboardOpts} opts
47
+ * @returns {Promise<void>}
48
+ */
49
+ export async function mobileSetClipboard(opts) {
50
+ await this.setClipboard(opts.content, opts.contentType, opts.label);
51
+ }
52
+
53
+ /**
54
+ * @typedef {import('../driver').AndroidUiautomator2Driver} AndroidUiautomator2Driver
55
+ */
@@ -49,6 +49,9 @@ export function mobileCommandsMapping() {
49
49
  scheduleAction: 'mobileScheduleAction',
50
50
  getActionHistory: 'mobileGetActionHistory',
51
51
  unscheduleAction: 'mobileUnscheduleAction',
52
+
53
+ setClipboard: 'mobileSetClipboard',
54
+ getClipboard: 'mobileGetClipboard',
52
55
  };
53
56
  }
54
57
 
@@ -40,22 +40,6 @@ export async function setOrientation(orientation) {
40
40
  );
41
41
  }
42
42
 
43
- /**
44
- * @this {AndroidUiautomator2Driver}
45
- * @returns {Promise<string>}
46
- */
47
- export async function getClipboard() {
48
- return String(
49
- (await this.adb.getApiLevel()) < 29
50
- ? await this.uiautomator2.jwproxy.command(
51
- '/appium/device/get_clipboard',
52
- 'POST',
53
- {}
54
- )
55
- : await this.settingsApp.getClipboard()
56
- );
57
- }
58
-
59
43
  /**
60
44
  * @this {AndroidUiautomator2Driver}
61
45
  * @returns {Promise<void>}
@@ -471,3 +471,18 @@ export interface ActionResult {
471
471
  export interface ActionArgs {
472
472
  name: string;
473
473
  }
474
+
475
+ export interface SetClipboardOpts {
476
+ /**
477
+ * Base64-encoded clipboard payload
478
+ */
479
+ content: string;
480
+ /**
481
+ * Only a single content type is supported, which is 'plaintext'
482
+ */
483
+ contentType?: 'plaintext';
484
+ /**
485
+ * Optinal label to identify the current clipboard payload
486
+ */
487
+ label?: string;
488
+ }
package/lib/driver.ts CHANGED
@@ -61,6 +61,12 @@ import {
61
61
  import {
62
62
  mobileGetBatteryInfo,
63
63
  } from './commands/battery';
64
+ import {
65
+ getClipboard,
66
+ mobileGetClipboard,
67
+ setClipboard,
68
+ mobileSetClipboard,
69
+ } from './commands/clipboard';
64
70
  import {
65
71
  active,
66
72
  getAttribute,
@@ -111,7 +117,6 @@ import {
111
117
  getPageSource,
112
118
  getOrientation,
113
119
  setOrientation,
114
- getClipboard,
115
120
  openNotifications,
116
121
  suspendChromedriverProxy,
117
122
  mobileGetDeviceInfo,
@@ -1054,11 +1059,15 @@ class AndroidUiautomator2Driver
1054
1059
  getPageSource = getPageSource;
1055
1060
  getOrientation = getOrientation;
1056
1061
  setOrientation = setOrientation;
1057
- getClipboard = getClipboard;
1058
1062
  openNotifications = openNotifications;
1059
1063
  suspendChromedriverProxy = suspendChromedriverProxy as any;
1060
1064
  mobileGetDeviceInfo = mobileGetDeviceInfo;
1061
1065
 
1066
+ getClipboard = getClipboard;
1067
+ mobileGetClipboard = mobileGetClipboard;
1068
+ setClipboard = setClipboard;
1069
+ mobileSetClipboard = mobileSetClipboard;
1070
+
1062
1071
  setUrl = setUrl;
1063
1072
  mobileDeepLink = mobileDeepLink;
1064
1073
  back = back;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "appium-uiautomator2-driver",
3
- "version": "3.6.1",
3
+ "version": "3.7.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "appium-uiautomator2-driver",
9
- "version": "3.6.1",
9
+ "version": "3.7.0",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "appium-adb": "^12.2.0",
@@ -801,9 +801,9 @@
801
801
  }
802
802
  },
803
803
  "node_modules/@types/node": {
804
- "version": "20.14.8",
805
- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.8.tgz",
806
- "integrity": "sha512-DO+2/jZinXfROG7j7WKFn/3C6nFwxy2lLpgLjEXJz+0XKphZlTLJ14mo8Vfg8X5BWN6XjyESXq+LcYdT7tR3bA==",
804
+ "version": "20.14.9",
805
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.9.tgz",
806
+ "integrity": "sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==",
807
807
  "dependencies": {
808
808
  "undici-types": "~5.26.4"
809
809
  }
@@ -1072,11 +1072,11 @@
1072
1072
  }
1073
1073
  },
1074
1074
  "node_modules/appium-android-driver": {
1075
- "version": "9.7.0",
1076
- "resolved": "https://registry.npmjs.org/appium-android-driver/-/appium-android-driver-9.7.0.tgz",
1077
- "integrity": "sha512-0XWMOuuA8uzMcHturqYwfECnY6imfPzXuPxs75/XfUuyDCkVE7zHoAQaYJes3Q3A6tE9MEMTvmY3GKyjJR6koQ==",
1075
+ "version": "9.7.2",
1076
+ "resolved": "https://registry.npmjs.org/appium-android-driver/-/appium-android-driver-9.7.2.tgz",
1077
+ "integrity": "sha512-AxguUmVx3YqFOMBjIeWqA8mAiRMk9/pJXjlS/SQc8dezS4v8YSvuNP1fjihrndq70HDrQJ6ciW46nGug1i3BWw==",
1078
1078
  "dependencies": {
1079
- "@appium/support": "^4.2.0",
1079
+ "@appium/support": "^5.0.3",
1080
1080
  "@colors/colors": "^1.6.0",
1081
1081
  "appium-adb": "^12.3.0",
1082
1082
  "appium-chromedriver": "^5.5.1",
@@ -1103,133 +1103,10 @@
1103
1103
  "appium": "^2.0.0"
1104
1104
  }
1105
1105
  },
1106
- "node_modules/appium-android-driver/node_modules/@appium/schema": {
1107
- "version": "0.5.0",
1108
- "resolved": "https://registry.npmjs.org/@appium/schema/-/schema-0.5.0.tgz",
1109
- "integrity": "sha512-HFed9HtFU6+kLdVyp/xpS/Wfcge8PuMS37LJVShviT6OuzHOYvNFx1/y8+KMa/l0Npvll5eafdfHmUsWlRnUAA==",
1110
- "dependencies": {
1111
- "@types/json-schema": "7.0.15",
1112
- "json-schema": "0.4.0",
1113
- "source-map-support": "0.5.21"
1114
- },
1115
- "engines": {
1116
- "node": "^14.17.0 || ^16.13.0 || >=18.0.0",
1117
- "npm": ">=8"
1118
- }
1119
- },
1120
- "node_modules/appium-android-driver/node_modules/@appium/support": {
1121
- "version": "4.5.0",
1122
- "resolved": "https://registry.npmjs.org/@appium/support/-/support-4.5.0.tgz",
1123
- "integrity": "sha512-9pr8sjnvQud3gBaF/RGj1FdySPjcOuDuKE5w4rfYht/HHlnC3GkfNtQG1FH4rqAIbkOk72HoFr4eaQrQV/cc3g==",
1124
- "dependencies": {
1125
- "@appium/logger": "^1.3.0",
1126
- "@appium/tsconfig": "^0.3.3",
1127
- "@appium/types": "^0.19.2",
1128
- "@colors/colors": "1.6.0",
1129
- "@types/archiver": "6.0.2",
1130
- "@types/base64-stream": "1.0.5",
1131
- "@types/find-root": "1.1.4",
1132
- "@types/jsftp": "2.1.5",
1133
- "@types/klaw": "3.0.6",
1134
- "@types/lockfile": "1.0.4",
1135
- "@types/mv": "2.1.4",
1136
- "@types/ncp": "2.0.8",
1137
- "@types/pluralize": "0.0.33",
1138
- "@types/semver": "7.5.8",
1139
- "@types/shell-quote": "1.7.5",
1140
- "@types/supports-color": "8.1.3",
1141
- "@types/teen_process": "2.0.4",
1142
- "@types/uuid": "9.0.8",
1143
- "@types/which": "3.0.4",
1144
- "archiver": "7.0.1",
1145
- "axios": "1.7.2",
1146
- "base64-stream": "1.0.0",
1147
- "bluebird": "3.7.2",
1148
- "bplist-creator": "0.1.1",
1149
- "bplist-parser": "0.3.2",
1150
- "form-data": "4.0.0",
1151
- "get-stream": "6.0.1",
1152
- "glob": "10.4.1",
1153
- "jsftp": "2.1.3",
1154
- "klaw": "4.1.0",
1155
- "lockfile": "1.0.4",
1156
- "lodash": "4.17.21",
1157
- "log-symbols": "4.1.0",
1158
- "moment": "2.30.1",
1159
- "mv": "2.1.1",
1160
- "ncp": "2.0.0",
1161
- "opencv-bindings": "4.5.5",
1162
- "pkg-dir": "5.0.0",
1163
- "plist": "3.1.0",
1164
- "pluralize": "8.0.0",
1165
- "read-pkg": "5.2.0",
1166
- "resolve-from": "5.0.0",
1167
- "sanitize-filename": "1.6.3",
1168
- "semver": "7.6.2",
1169
- "shell-quote": "1.8.1",
1170
- "source-map-support": "0.5.21",
1171
- "supports-color": "8.1.1",
1172
- "teen_process": "2.1.4",
1173
- "type-fest": "4.19.0",
1174
- "uuid": "9.0.1",
1175
- "which": "4.0.0",
1176
- "yauzl": "3.1.3"
1177
- },
1178
- "engines": {
1179
- "node": "^14.17.0 || ^16.13.0 || >=18.0.0",
1180
- "npm": ">=8"
1181
- },
1182
- "optionalDependencies": {
1183
- "sharp": "0.33.4"
1184
- }
1185
- },
1186
- "node_modules/appium-android-driver/node_modules/@appium/types": {
1187
- "version": "0.19.2",
1188
- "resolved": "https://registry.npmjs.org/@appium/types/-/types-0.19.2.tgz",
1189
- "integrity": "sha512-u4oHR8TaFK3uyptgOT26/u3zQU5N6vh652OHIpRDJ78EDWgCWXLfIA6YdF8tA8YMrvZHhRpX9om04+9l8wSXyA==",
1190
- "dependencies": {
1191
- "@appium/logger": "^1.3.0",
1192
- "@appium/schema": "^0.5.0",
1193
- "@appium/tsconfig": "^0.3.3",
1194
- "@types/express": "4.17.21",
1195
- "@types/ws": "8.5.10",
1196
- "type-fest": "4.19.0"
1197
- },
1198
- "engines": {
1199
- "node": "^14.17.0 || ^16.13.0 || >=18.0.0",
1200
- "npm": ">=8"
1201
- }
1202
- },
1203
- "node_modules/appium-android-driver/node_modules/teen_process": {
1204
- "version": "2.1.4",
1205
- "resolved": "https://registry.npmjs.org/teen_process/-/teen_process-2.1.4.tgz",
1206
- "integrity": "sha512-TEaxCYk/aCBsNBCZmgUNXqtCWq8RX94nGoyYYu7YiNR+RnmawMFshTkYe1SFhiNCX6FsYb6wL/irs6NhvfoF5g==",
1207
- "dependencies": {
1208
- "bluebird": "^3.7.2",
1209
- "lodash": "^4.17.21",
1210
- "shell-quote": "^1.8.1",
1211
- "source-map-support": "^0.x"
1212
- },
1213
- "engines": {
1214
- "node": "^16.13.0 || >=18.0.0",
1215
- "npm": ">=8"
1216
- }
1217
- },
1218
- "node_modules/appium-android-driver/node_modules/type-fest": {
1219
- "version": "4.19.0",
1220
- "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.19.0.tgz",
1221
- "integrity": "sha512-CN2l+hWACRiejlnr68vY0/7734Kzu+9+TOslUXbSCQ1ruY9XIHDBSceVXCcHm/oXrdzhtLMMdJEKfemf1yXiZQ==",
1222
- "engines": {
1223
- "node": ">=16"
1224
- },
1225
- "funding": {
1226
- "url": "https://github.com/sponsors/sindresorhus"
1227
- }
1228
- },
1229
1106
  "node_modules/appium-chromedriver": {
1230
- "version": "5.6.61",
1231
- "resolved": "https://registry.npmjs.org/appium-chromedriver/-/appium-chromedriver-5.6.61.tgz",
1232
- "integrity": "sha512-PO2HioadxOE+yijz+YgPbWxAbPJn0H0mW1tTvpWz45x9kTWMgXY5lXAv9jSZsSF2iTx8DOxInUltEBr9dPIjLw==",
1107
+ "version": "5.6.62",
1108
+ "resolved": "https://registry.npmjs.org/appium-chromedriver/-/appium-chromedriver-5.6.62.tgz",
1109
+ "integrity": "sha512-kl5IVK1bRpihAHW2O3DBF0xuWzorraRh1q0/+a/Tlfd6KFCB0mF1HBDW/CnT3g8asZvQaftu3o6nKlKXaYeuHQ==",
1233
1110
  "hasInstallScript": true,
1234
1111
  "dependencies": {
1235
1112
  "@appium/base-driver": "^9.1.0",
@@ -1376,9 +1253,9 @@
1376
1253
  }
1377
1254
  },
1378
1255
  "node_modules/appium-uiautomator2-server": {
1379
- "version": "7.0.14",
1380
- "resolved": "https://registry.npmjs.org/appium-uiautomator2-server/-/appium-uiautomator2-server-7.0.14.tgz",
1381
- "integrity": "sha512-EfR+ifutelJBBeGYMANIhuX9ClXqsaXoQR0fssJotnTay3htvJuMvELUVHrMT5aQnzEG70Xfz2W67cgjcqGFVQ==",
1256
+ "version": "7.0.15",
1257
+ "resolved": "https://registry.npmjs.org/appium-uiautomator2-server/-/appium-uiautomator2-server-7.0.15.tgz",
1258
+ "integrity": "sha512-exTM7AAH7wL9flaLrHmP7zplgUPAMj3dfpfGpa5wWcZbpUVUqKMxxZLi1ZY2stmCIPTGoYWuAF4h2T9f1Qe2DQ==",
1382
1259
  "engines": {
1383
1260
  "node": ">=14",
1384
1261
  "npm": ">=8"
@@ -3179,9 +3056,9 @@
3179
3056
  "optional": true
3180
3057
  },
3181
3058
  "node_modules/minimatch": {
3182
- "version": "9.0.4",
3183
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz",
3184
- "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==",
3059
+ "version": "9.0.5",
3060
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
3061
+ "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
3185
3062
  "dependencies": {
3186
3063
  "brace-expansion": "^2.0.1"
3187
3064
  },
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "automated testing",
8
8
  "android"
9
9
  ],
10
- "version": "3.6.1",
10
+ "version": "3.7.0",
11
11
  "bugs": {
12
12
  "url": "https://github.com/appium/appium-uiautomator2-driver/issues"
13
13
  },