appium-uiautomator2-driver 3.5.6 → 3.5.7

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.
Files changed (71) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/lib/commands/actions.d.ts +3 -3
  3. package/build/lib/commands/actions.d.ts.map +1 -1
  4. package/build/lib/commands/actions.js +5 -6
  5. package/build/lib/commands/actions.js.map +1 -1
  6. package/build/lib/commands/alert.d.ts +1 -1
  7. package/build/lib/commands/alert.d.ts.map +1 -1
  8. package/build/lib/commands/alert.js +5 -6
  9. package/build/lib/commands/alert.js.map +1 -1
  10. package/build/lib/commands/app-management.d.ts +3 -3
  11. package/build/lib/commands/app-management.d.ts.map +1 -1
  12. package/build/lib/commands/app-management.js +2 -3
  13. package/build/lib/commands/app-management.js.map +1 -1
  14. package/build/lib/commands/app-strings.d.ts +3 -3
  15. package/build/lib/commands/app-strings.d.ts.map +1 -1
  16. package/build/lib/commands/app-strings.js +1 -2
  17. package/build/lib/commands/app-strings.js.map +1 -1
  18. package/build/lib/commands/battery.d.ts +3 -3
  19. package/build/lib/commands/battery.d.ts.map +1 -1
  20. package/build/lib/commands/battery.js +1 -2
  21. package/build/lib/commands/battery.js.map +1 -1
  22. package/build/lib/commands/element.d.ts +7 -7
  23. package/build/lib/commands/element.d.ts.map +1 -1
  24. package/build/lib/commands/element.js +16 -17
  25. package/build/lib/commands/element.js.map +1 -1
  26. package/build/lib/commands/execute.d.ts +2 -2
  27. package/build/lib/commands/execute.d.ts.map +1 -1
  28. package/build/lib/commands/execute.js +2 -3
  29. package/build/lib/commands/execute.js.map +1 -1
  30. package/build/lib/commands/find.d.ts +3 -3
  31. package/build/lib/commands/find.d.ts.map +1 -1
  32. package/build/lib/commands/find.js +1 -2
  33. package/build/lib/commands/find.js.map +1 -1
  34. package/build/lib/commands/gestures.d.ts +9 -9
  35. package/build/lib/commands/gestures.d.ts.map +1 -1
  36. package/build/lib/commands/gestures.js +11 -12
  37. package/build/lib/commands/gestures.js.map +1 -1
  38. package/build/lib/commands/keyboard.d.ts +4 -4
  39. package/build/lib/commands/keyboard.d.ts.map +1 -1
  40. package/build/lib/commands/keyboard.js +6 -7
  41. package/build/lib/commands/keyboard.js.map +1 -1
  42. package/build/lib/commands/misc.d.ts +5 -5
  43. package/build/lib/commands/misc.d.ts.map +1 -1
  44. package/build/lib/commands/misc.js +7 -8
  45. package/build/lib/commands/misc.js.map +1 -1
  46. package/build/lib/commands/navigation.d.ts +2 -2
  47. package/build/lib/commands/navigation.d.ts.map +1 -1
  48. package/build/lib/commands/navigation.js +3 -4
  49. package/build/lib/commands/navigation.js.map +1 -1
  50. package/build/lib/commands/screenshot.d.ts +2 -2
  51. package/build/lib/commands/screenshot.d.ts.map +1 -1
  52. package/build/lib/commands/screenshot.js +4 -5
  53. package/build/lib/commands/screenshot.js.map +1 -1
  54. package/build/lib/commands/viewport.d.ts +5 -5
  55. package/build/lib/commands/viewport.d.ts.map +1 -1
  56. package/build/lib/commands/viewport.js +7 -8
  57. package/build/lib/commands/viewport.js.map +1 -1
  58. package/build/lib/css-converter.d.ts +4 -4
  59. package/build/lib/driver.d.ts.map +1 -1
  60. package/build/lib/helpers.d.ts +1 -1
  61. package/build/lib/helpers.d.ts.map +1 -1
  62. package/build/lib/helpers.js +2 -3
  63. package/build/lib/helpers.js.map +1 -1
  64. package/build/lib/uiautomator2.d.ts +39 -2
  65. package/build/lib/uiautomator2.d.ts.map +1 -1
  66. package/build/lib/uiautomator2.js +43 -7
  67. package/build/lib/uiautomator2.js.map +1 -1
  68. package/build/tsconfig.tsbuildinfo +1 -1
  69. package/lib/uiautomator2.js +47 -7
  70. package/npm-shrinkwrap.json +42 -27
  71. package/package.json +1 -1
@@ -97,6 +97,51 @@ class UiAutomator2Server {
97
97
  return resultInfo;
98
98
  }
99
99
 
100
+ /**
101
+ * @typedef {Object} PackageInfo
102
+ * @property {import('appium-adb/build/lib/tools/apk-utils').InstallState} installState
103
+ * @property {string} appPath
104
+ * @property {string} appId
105
+ */
106
+
107
+ /**
108
+ * Checks if server components must be installed from the device under test
109
+ * in scope of the current driver session.
110
+ *
111
+ * For example, if one of servers on the device under test was newer than servers current UIA2 driver wants to
112
+ * use for the session, the UIA2 driver should uninstall the installed ones in order to avoid
113
+ * version mismatch between the UIA2 drier and servers on the device under test.
114
+ * Also, if the device under test has missing servers, current UIA2 driver should uninstall all
115
+ * servers once in order to install proper servers freshly.
116
+ *
117
+ * @param {PackageInfo[]} packagesInfo
118
+ * @returns {boolean} true if any of components is already installed and the other is not installed
119
+ * or the installed one has a newer version.
120
+ */
121
+ shouldUninstallServerPackages(packagesInfo = []) {
122
+ const isAnyComponentInstalled = packagesInfo.some(
123
+ ({installState}) => installState !== this.adb.APP_INSTALL_STATE.NOT_INSTALLED);
124
+ const isAnyComponentNotInstalledOrNewer = packagesInfo.some(({installState}) => [
125
+ this.adb.APP_INSTALL_STATE.NOT_INSTALLED,
126
+ this.adb.APP_INSTALL_STATE.NEWER_VERSION_INSTALLED,
127
+ ].includes(installState));
128
+ return isAnyComponentInstalled && isAnyComponentNotInstalledOrNewer;
129
+ }
130
+
131
+ /**
132
+ * Checks if server components should be installed on the device under test in scope of the current driver session.
133
+ *
134
+ * @param {PackageInfo[]} packagesInfo
135
+ * @returns {boolean} true if any of components is not installed or older than currently installed in order to
136
+ * install or upgrade the servers on the device under test.
137
+ */
138
+ shouldInstallServerPackages(packagesInfo = []) {
139
+ return packagesInfo.some(({installState}) => [
140
+ this.adb.APP_INSTALL_STATE.NOT_INSTALLED,
141
+ this.adb.APP_INSTALL_STATE.OLDER_VERSION_INSTALLED,
142
+ ].includes(installState));
143
+ }
144
+
100
145
  /**
101
146
  * Installs the apks on to the device or emulator.
102
147
  *
@@ -116,15 +161,10 @@ class UiAutomator2Server {
116
161
  );
117
162
 
118
163
  this.log.debug(`Server packages status: ${JSON.stringify(packagesInfo)}`);
119
- // Enforce server packages reinstall if any of the packages is not installed, while the other is
120
- const shouldUninstallServerPackages = (packagesInfo.some(({installState}) => installState === this.adb.APP_INSTALL_STATE.NOT_INSTALLED)
121
- && !packagesInfo.every(({installState}) => installState === this.adb.APP_INSTALL_STATE.NOT_INSTALLED));
164
+ const shouldUninstallServerPackages = this.shouldUninstallServerPackages(packagesInfo);
122
165
  // Install must always follow uninstall. Also, perform the install if
123
166
  // any of server packages is not installed or is outdated
124
- const shouldInstallServerPackages = shouldUninstallServerPackages || packagesInfo.some(({installState}) => [
125
- this.adb.APP_INSTALL_STATE.NOT_INSTALLED,
126
- this.adb.APP_INSTALL_STATE.OLDER_VERSION_INSTALLED,
127
- ].includes(installState));
167
+ const shouldInstallServerPackages = shouldUninstallServerPackages || this.shouldInstallServerPackages(packagesInfo);
128
168
  this.log.info(`Server packages are ${shouldInstallServerPackages ? '' : 'not '}going to be (re)installed`);
129
169
  if (shouldInstallServerPackages && shouldUninstallServerPackages) {
130
170
  this.log.info('Full packages reinstall is going to be performed');
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "appium-uiautomator2-driver",
3
- "version": "3.5.6",
3
+ "version": "3.5.7",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "appium-uiautomator2-driver",
9
- "version": "3.5.6",
9
+ "version": "3.5.7",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "appium-adb": "^12.2.0",
@@ -198,6 +198,18 @@
198
198
  "url": "https://github.com/sponsors/sindresorhus"
199
199
  }
200
200
  },
201
+ "node_modules/@appium/docutils/node_modules/typescript": {
202
+ "version": "5.4.5",
203
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz",
204
+ "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==",
205
+ "bin": {
206
+ "tsc": "bin/tsc",
207
+ "tsserver": "bin/tsserver"
208
+ },
209
+ "engines": {
210
+ "node": ">=14.17"
211
+ }
212
+ },
201
213
  "node_modules/@appium/logger": {
202
214
  "version": "1.4.2",
203
215
  "resolved": "https://registry.npmjs.org/@appium/logger/-/logger-1.4.2.tgz",
@@ -711,9 +723,9 @@
711
723
  }
712
724
  },
713
725
  "node_modules/@types/express-serve-static-core": {
714
- "version": "4.19.3",
715
- "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.3.tgz",
716
- "integrity": "sha512-KOzM7MhcBFlmnlr/fzISFF5vGWVSvN6fTd4T+ExOt08bA/dA5kpSzY52nMsI1KDFmUREpJelPYyuslLRSjjgCg==",
726
+ "version": "4.19.5",
727
+ "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.5.tgz",
728
+ "integrity": "sha512-y6W03tvrACO72aijJ5uF02FRq5cgDR9lUxddQ8vyF+GvmjJQqbzDcJngEjURc+ZsG31VI3hODNZJ2URj86pzmg==",
717
729
  "dependencies": {
718
730
  "@types/node": "*",
719
731
  "@types/qs": "*",
@@ -794,9 +806,9 @@
794
806
  }
795
807
  },
796
808
  "node_modules/@types/node": {
797
- "version": "20.14.5",
798
- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.5.tgz",
799
- "integrity": "sha512-aoRR+fJkZT2l0aGOJhuA8frnCSoNX6W7U2mpNq63+BxBIj5BQFt8rHy627kijCmm63ijdSdwvGgpUsU6MBsZZA==",
809
+ "version": "20.14.7",
810
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.7.tgz",
811
+ "integrity": "sha512-uTr2m2IbJJucF3KUxgnGOZvYbN0QgkGyWxG6973HCpMYFy2KfcgYuIwkJQMQkt1VbBMlvWRbpshFTLxnxCZjKQ==",
800
812
  "dependencies": {
801
813
  "undici-types": "~5.26.4"
802
814
  }
@@ -1043,9 +1055,9 @@
1043
1055
  }
1044
1056
  },
1045
1057
  "node_modules/appium-adb": {
1046
- "version": "12.4.3",
1047
- "resolved": "https://registry.npmjs.org/appium-adb/-/appium-adb-12.4.3.tgz",
1048
- "integrity": "sha512-pN8W6mB4PEUa2615XhmP77gHPx21lGrAzIrTlNweIS+ibNW+gMtfOvEFimtLZ1RXMpWW5GMO7AHSr50ceb92ug==",
1058
+ "version": "12.4.4",
1059
+ "resolved": "https://registry.npmjs.org/appium-adb/-/appium-adb-12.4.4.tgz",
1060
+ "integrity": "sha512-q+vN6NgnUlcWT6FV12ryc1d8bFZSQOtcXpJJuUtgWYwVhebJB8hJE+6mcqUG5LOrcEWLOQXkx1oVQSx+VQosTQ==",
1049
1061
  "dependencies": {
1050
1062
  "@appium/support": "^5.0.3",
1051
1063
  "@devicefarmer/adbkit-apkreader": "^3.2.4",
@@ -1065,9 +1077,9 @@
1065
1077
  }
1066
1078
  },
1067
1079
  "node_modules/appium-android-driver": {
1068
- "version": "9.6.5",
1069
- "resolved": "https://registry.npmjs.org/appium-android-driver/-/appium-android-driver-9.6.5.tgz",
1070
- "integrity": "sha512-7MHHuZwGK+ku1DIHp4pIZdKt/P/MTDnlZqTDhMsxx5D0BQ9OwEd+OGGbUIyktAQOGNPRU2KyH3aeGiYg2XlfSw==",
1080
+ "version": "9.6.6",
1081
+ "resolved": "https://registry.npmjs.org/appium-android-driver/-/appium-android-driver-9.6.6.tgz",
1082
+ "integrity": "sha512-uueJSELy0eOxPa1HEkiuBUHt/oDksUqbw437NMGskHT+XE9QOtEq4nZp4Y5xAHwMsbOgSLowReU0gZl5tk80zQ==",
1071
1083
  "dependencies": {
1072
1084
  "@appium/support": "^4.2.0",
1073
1085
  "@colors/colors": "^1.6.0",
@@ -1220,9 +1232,9 @@
1220
1232
  }
1221
1233
  },
1222
1234
  "node_modules/appium-chromedriver": {
1223
- "version": "5.6.58",
1224
- "resolved": "https://registry.npmjs.org/appium-chromedriver/-/appium-chromedriver-5.6.58.tgz",
1225
- "integrity": "sha512-RkBV1anx42CZbRpw+RuGL2sSgxnzS0Vi+GXrFQjHZzJd4uadjYmv0n5jcUQgCtPT2VGL3SZKYnuyIPTBF8D8HA==",
1235
+ "version": "5.6.60",
1236
+ "resolved": "https://registry.npmjs.org/appium-chromedriver/-/appium-chromedriver-5.6.60.tgz",
1237
+ "integrity": "sha512-WBO/TFF6a2c9h3KvFf4nXE5GiYjcMpQETHHkYhQQDOENo+ybEhr82/rl+soRihMoBJ9uXdTGcyCZ0oGim8iUYQ==",
1226
1238
  "hasInstallScript": true,
1227
1239
  "dependencies": {
1228
1240
  "@appium/base-driver": "^9.1.0",
@@ -2767,9 +2779,9 @@
2767
2779
  }
2768
2780
  },
2769
2781
  "node_modules/io.appium.settings": {
2770
- "version": "5.12.3",
2771
- "resolved": "https://registry.npmjs.org/io.appium.settings/-/io.appium.settings-5.12.3.tgz",
2772
- "integrity": "sha512-8wQxk88UM69AiP8bCZODWtVxm7O7Tt+mTWXObQkFwJrE/xek/idd84Gfe3mkhpSA5Fz451N9Qhm/DVzOIGDCDA==",
2782
+ "version": "5.12.4",
2783
+ "resolved": "https://registry.npmjs.org/io.appium.settings/-/io.appium.settings-5.12.4.tgz",
2784
+ "integrity": "sha512-L/x6a2cM/lPZyTJgshAaMN9G8FsIJYqON7/MJwAUl268oDN/igwxuc8k5RrhK5lYgEbqNEqXktosQIeeOTKozA==",
2773
2785
  "dependencies": {
2774
2786
  "@appium/logger": "^1.3.0",
2775
2787
  "asyncbox": "^3.0.0",
@@ -2798,11 +2810,14 @@
2798
2810
  "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg=="
2799
2811
  },
2800
2812
  "node_modules/is-core-module": {
2801
- "version": "2.13.1",
2802
- "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz",
2803
- "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==",
2813
+ "version": "2.14.0",
2814
+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.14.0.tgz",
2815
+ "integrity": "sha512-a5dFJih5ZLYlRtDc0dZWP7RiKr6xIKzmn/oAYCDvdLThadVgyJwlaoQPmRtMSpz+rk0OGAgIu+TcM9HUF0fk1A==",
2804
2816
  "dependencies": {
2805
- "hasown": "^2.0.0"
2817
+ "hasown": "^2.0.2"
2818
+ },
2819
+ "engines": {
2820
+ "node": ">= 0.4"
2806
2821
  },
2807
2822
  "funding": {
2808
2823
  "url": "https://github.com/sponsors/ljharb"
@@ -4483,9 +4498,9 @@
4483
4498
  }
4484
4499
  },
4485
4500
  "node_modules/typescript": {
4486
- "version": "5.4.5",
4487
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz",
4488
- "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==",
4501
+ "version": "5.5.2",
4502
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.2.tgz",
4503
+ "integrity": "sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==",
4489
4504
  "bin": {
4490
4505
  "tsc": "bin/tsc",
4491
4506
  "tsserver": "bin/tsserver"
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "automated testing",
8
8
  "android"
9
9
  ],
10
- "version": "3.5.6",
10
+ "version": "3.5.7",
11
11
  "bugs": {
12
12
  "url": "https://github.com/appium/appium-uiautomator2-driver/issues"
13
13
  },