appium-uiautomator2-driver 6.5.0 → 6.6.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.
@@ -102,29 +102,6 @@ export async function mobileResetAccessibilityCache() {
102
102
  );
103
103
  }
104
104
 
105
- /**
106
- * Gets a list of windows on all displays.
107
- * For Android API 30+ (R), uses getWindowsOnAllDisplays().
108
- * For older APIs, uses getWindows().
109
- * @this {AndroidUiautomator2Driver}
110
- * @param {import('./types').WindowFilters} [filters] Optional filters to apply to the window list.
111
- * All filters are applied with AND logic (all must match).
112
- * @param {boolean} [skipScreenshots] Whether to skip taking screenshots for each window. Defaults to false.
113
- * @returns {Promise<Array<import('./types').WindowInfo>>} Array of window information objects
114
- */
115
- export async function mobileListWindows(filters, skipScreenshots) {
116
- return /** @type {Array<import('./types').WindowInfo>} */ (
117
- await this.uiautomator2.jwproxy.command(
118
- '/appium/list_windows',
119
- 'POST',
120
- {
121
- filters,
122
- skipScreenshots,
123
- }
124
- )
125
- );
126
- }
127
-
128
105
  /**
129
106
  * @template [T=any]
130
107
  * @typedef {import('@appium/types').StringRecord<T>} StringRecord
@@ -132,3 +132,53 @@ export interface WindowInfo {
132
132
  */
133
133
  screenshot: string | null;
134
134
  }
135
+
136
+ export interface DisplayMetrics {
137
+ /**
138
+ * Display width in pixels
139
+ */
140
+ widthPixels: number;
141
+ /**
142
+ * Display height in pixels
143
+ */
144
+ heightPixels: number;
145
+ /**
146
+ * Display density (logical density factor)
147
+ */
148
+ density: number;
149
+ /**
150
+ * Display density in DPI
151
+ */
152
+ densityDpi: number;
153
+ /**
154
+ * Scaled density factor for fonts
155
+ */
156
+ scaledDensity: number;
157
+ /**
158
+ * Exact physical pixels per inch of the screen in the X dimension
159
+ */
160
+ xdpi: number;
161
+ /**
162
+ * Exact physical pixels per inch of the screen in the Y dimension
163
+ */
164
+ ydpi: number;
165
+ }
166
+
167
+ export interface DisplayInfo {
168
+ /**
169
+ * Display identifier (logical display ID)
170
+ */
171
+ id: number;
172
+ /**
173
+ * Physical display identifier (may be null). Returned as a string to avoid JavaScript number precision issues with large values.
174
+ */
175
+ physicalId: string | null;
176
+ /**
177
+ * Display metrics containing size and density information
178
+ */
179
+ metrics: DisplayMetrics;
180
+ /**
181
+ * Whether this is the default display
182
+ */
183
+ isDefault: boolean;
184
+ }
@@ -0,0 +1,35 @@
1
+ import type {AndroidUiautomator2Driver} from '../driver';
2
+ import type {WindowFilters, WindowInfo, DisplayInfo} from './types';
3
+
4
+ /**
5
+ * Gets a list of windows on all displays.
6
+ * For Android API 30+ (R), uses getWindowsOnAllDisplays().
7
+ * For older APIs, uses getWindows().
8
+ */
9
+ export async function mobileListWindows(
10
+ this: AndroidUiautomator2Driver,
11
+ filters?: WindowFilters,
12
+ skipScreenshots?: boolean
13
+ ): Promise<WindowInfo[]> {
14
+ return await this.uiautomator2.jwproxy.command(
15
+ '/appium/list_windows',
16
+ 'POST',
17
+ {
18
+ filters,
19
+ skipScreenshots,
20
+ }
21
+ ) as WindowInfo[];
22
+ }
23
+
24
+ /**
25
+ * Gets a list of all displays available on the device.
26
+ */
27
+ export async function mobileListDisplays(
28
+ this: AndroidUiautomator2Driver
29
+ ): Promise<DisplayInfo[]> {
30
+ return await this.uiautomator2.jwproxy.command(
31
+ '/appium/list_displays',
32
+ 'POST',
33
+ {}
34
+ ) as DisplayInfo[];
35
+ }
package/lib/driver.ts CHANGED
@@ -113,8 +113,11 @@ import {
113
113
  suspendChromedriverProxy,
114
114
  mobileGetDeviceInfo,
115
115
  mobileResetAccessibilityCache,
116
- mobileListWindows,
117
116
  } from './commands/misc';
117
+ import {
118
+ mobileListWindows,
119
+ mobileListDisplays,
120
+ } from './commands/windows';
118
121
  import {
119
122
  setUrl,
120
123
  mobileDeepLink,
@@ -1059,6 +1062,7 @@ class AndroidUiautomator2Driver
1059
1062
  mobileGetDeviceInfo = mobileGetDeviceInfo;
1060
1063
  mobileResetAccessibilityCache = mobileResetAccessibilityCache;
1061
1064
  mobileListWindows = mobileListWindows;
1065
+ mobileListDisplays = mobileListDisplays;
1062
1066
 
1063
1067
  getClipboard = getClipboard;
1064
1068
  setClipboard = setClipboard;
@@ -270,4 +270,8 @@ export const executeMethodMap = {
270
270
  optional: ['filters', 'skipScreenshots'],
271
271
  },
272
272
  },
273
+
274
+ 'mobile: listDisplays': {
275
+ command: 'mobileListDisplays',
276
+ },
273
277
  } as const satisfies ExecuteMethodMap<any>;
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "appium-uiautomator2-driver",
3
- "version": "6.5.0",
3
+ "version": "6.6.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "appium-uiautomator2-driver",
9
- "version": "6.5.0",
9
+ "version": "6.6.0",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "appium-adb": "^14.0.0",
13
13
  "appium-android-driver": "^12.3.0",
14
- "appium-uiautomator2-server": "^9.6.1",
14
+ "appium-uiautomator2-server": "^9.7.1",
15
15
  "asyncbox": "^3.0.0",
16
16
  "axios": "^1.12.2",
17
17
  "bluebird": "^3.5.1",
@@ -656,9 +656,9 @@
656
656
  }
657
657
  },
658
658
  "node_modules/appium-uiautomator2-server": {
659
- "version": "9.6.2",
660
- "resolved": "https://registry.npmjs.org/appium-uiautomator2-server/-/appium-uiautomator2-server-9.6.2.tgz",
661
- "integrity": "sha512-rjCP15vwP9ePlIjpW/CxzfZ5FUXqkvVTA1zf3BcJwl7+B+ic/QVopxOyVJMhofjNatwp44Pua9kUwtdkGycltg==",
659
+ "version": "9.7.1",
660
+ "resolved": "https://registry.npmjs.org/appium-uiautomator2-server/-/appium-uiautomator2-server-9.7.1.tgz",
661
+ "integrity": "sha512-SXBoUMMtQAuBT5wsi1xNTx0t7kXwCeW/akZoBOGO3H2GCB32MWEL1fGkkVC1izljK2yHwItNmbR7ceUkOOx3jg==",
662
662
  "license": "Apache-2.0",
663
663
  "engines": {
664
664
  "node": "^20.19.0 || ^22.12.0 || >=24.0.0",
@@ -1776,9 +1776,9 @@
1776
1776
  "license": "MIT"
1777
1777
  },
1778
1778
  "node_modules/finalhandler": {
1779
- "version": "2.1.0",
1780
- "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.0.tgz",
1781
- "integrity": "sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q==",
1779
+ "version": "2.1.1",
1780
+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz",
1781
+ "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==",
1782
1782
  "license": "MIT",
1783
1783
  "dependencies": {
1784
1784
  "debug": "^4.4.0",
@@ -1789,7 +1789,11 @@
1789
1789
  "statuses": "^2.0.1"
1790
1790
  },
1791
1791
  "engines": {
1792
- "node": ">= 0.8"
1792
+ "node": ">= 18.0.0"
1793
+ },
1794
+ "funding": {
1795
+ "type": "opencollective",
1796
+ "url": "https://opencollective.com/express"
1793
1797
  }
1794
1798
  },
1795
1799
  "node_modules/find-up": {
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "automated testing",
8
8
  "android"
9
9
  ],
10
- "version": "6.5.0",
10
+ "version": "6.6.0",
11
11
  "bugs": {
12
12
  "url": "https://github.com/appium/appium-uiautomator2-driver/issues"
13
13
  },
@@ -58,7 +58,7 @@
58
58
  "dependencies": {
59
59
  "appium-adb": "^14.0.0",
60
60
  "appium-android-driver": "^12.3.0",
61
- "appium-uiautomator2-server": "^9.6.1",
61
+ "appium-uiautomator2-server": "^9.7.1",
62
62
  "asyncbox": "^3.0.0",
63
63
  "axios": "^1.12.2",
64
64
  "bluebird": "^3.5.1",