appium-android-driver 12.4.8 → 12.4.9

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 CHANGED
@@ -1,3 +1,9 @@
1
+ ## [12.4.9](https://github.com/appium/appium-android-driver/compare/v12.4.8...v12.4.9) (2025-12-19)
2
+
3
+ ### Miscellaneous Chores
4
+
5
+ * Migrate command modules to typescript (part3) ([#1040](https://github.com/appium/appium-android-driver/issues/1040)) ([ebc73ba](https://github.com/appium/appium-android-driver/commit/ebc73bac7433c552c41bc241bfec535c30b3b157))
6
+
1
7
  ## [12.4.8](https://github.com/appium/appium-android-driver/compare/v12.4.7...v12.4.8) (2025-12-19)
2
8
 
3
9
  ### Miscellaneous Chores
@@ -1,26 +1,28 @@
1
+ import type { Location } from '@appium/types';
2
+ import type { AndroidDriver } from '../driver';
1
3
  /**
2
- * @this {import('../driver').AndroidDriver}
3
- * @param {import('@appium/types').Location} location
4
- * @returns {Promise<import('@appium/types').Location>}
4
+ * Sets the device geolocation.
5
+ *
6
+ * @param location The geolocation object containing latitude, longitude, and altitude.
7
+ * @returns Promise that resolves to the current geolocation after setting it.
5
8
  */
6
- export function setGeoLocation(this: import("../driver").AndroidDriver, location: import("@appium/types").Location): Promise<import("@appium/types").Location>;
9
+ export declare function setGeoLocation(this: AndroidDriver, location: Location): Promise<Location>;
7
10
  /**
8
11
  * Set the device geolocation.
9
12
  *
10
- * @this {import('../driver').AndroidDriver}
11
- * @param {number} latitude Valid latitude value.
12
- * @param {number} longitude Valid longitude value.
13
- * @param {number} [altitude] Valid altitude value.
14
- * @param {number} [satellites] Number of satellites being tracked (1-12). Available for emulators.
15
- * @param {number} [speed] Valid speed value.
13
+ * @param latitude Valid latitude value.
14
+ * @param longitude Valid longitude value.
15
+ * @param altitude Valid altitude value.
16
+ * @param satellites Number of satellites being tracked (1-12). Available for emulators.
17
+ * @param speed Valid speed value.
16
18
  * https://developer.android.com/reference/android/location/Location#setSpeed(float)
17
- * @param {number} [bearing] Valid bearing value. Available for real devices.
19
+ * @param bearing Valid bearing value. Available for real devices.
18
20
  * https://developer.android.com/reference/android/location/Location#setBearing(float)
19
- * @param {number} [accuracy] Valid accuracy value. Available for real devices.
21
+ * @param accuracy Valid accuracy value. Available for real devices.
20
22
  * https://developer.android.com/reference/android/location/Location#setAccuracy(float),
21
23
  * https://developer.android.com/reference/android/location/Criteria
22
24
  */
23
- export function mobileSetGeolocation(this: import("../driver").AndroidDriver, latitude: number, longitude: number, altitude?: number, satellites?: number, speed?: number, bearing?: number, accuracy?: number): Promise<void>;
25
+ export declare function mobileSetGeolocation(this: AndroidDriver, latitude: number, longitude: number, altitude?: number, satellites?: number, speed?: number, bearing?: number, accuracy?: number): Promise<void>;
24
26
  /**
25
27
  * Sends an async request to refresh the GPS cache.
26
28
  *
@@ -28,43 +30,49 @@ export function mobileSetGeolocation(this: import("../driver").AndroidDriver, la
28
30
  * installed. In case the vanilla LocationManager is used the device API level
29
31
  * must be at version 30 (Android R) or higher.
30
32
  *
31
- * @this {import('../driver').AndroidDriver}
32
- * @param {number} [timeoutMs] The maximum number of milliseconds
33
+ * @param timeoutMs The maximum number of milliseconds
33
34
  * to block until GPS cache is refreshed. Providing zero or a negative
34
35
  * value to it skips waiting completely.
35
36
  * 20000ms by default.
36
- * @returns {Promise<void>}
37
+ * @returns Promise that resolves when the GPS cache refresh is initiated.
37
38
  */
38
- export function mobileRefreshGpsCache(this: import("../driver").AndroidDriver, timeoutMs?: number): Promise<void>;
39
+ export declare function mobileRefreshGpsCache(this: AndroidDriver, timeoutMs?: number): Promise<void>;
39
40
  /**
40
- * @this {import('../driver').AndroidDriver}
41
- * @returns {Promise<import('@appium/types').Location>}
41
+ * Gets the current device geolocation.
42
+ *
43
+ * @returns Promise that resolves to the current geolocation object.
42
44
  */
43
- export function getGeoLocation(this: import("../driver").AndroidDriver): Promise<import("@appium/types").Location>;
45
+ export declare function getGeoLocation(this: AndroidDriver): Promise<Location>;
44
46
  /**
45
- * @this {import('../driver').AndroidDriver}
46
- * @returns {Promise<import('@appium/types').Location>}
47
+ * Gets the current device geolocation.
48
+ *
49
+ * @returns Promise that resolves to the current geolocation object.
47
50
  */
48
- export function mobileGetGeolocation(this: import("../driver").AndroidDriver): Promise<import("@appium/types").Location>;
51
+ export declare function mobileGetGeolocation(this: AndroidDriver): Promise<Location>;
49
52
  /**
50
- * @this {import('../driver').AndroidDriver}
51
- * @returns {Promise<boolean>}
53
+ * Checks if location services are enabled.
54
+ *
55
+ * @returns Promise that resolves to `true` if location services are enabled, `false` otherwise.
52
56
  */
53
- export function isLocationServicesEnabled(this: import("../driver").AndroidDriver): Promise<boolean>;
57
+ export declare function isLocationServicesEnabled(this: AndroidDriver): Promise<boolean>;
54
58
  /**
55
- * @this {import('../driver').AndroidDriver}
56
- * @returns {Promise<void>}
59
+ * Toggles the location services state.
60
+ *
61
+ * @returns Promise that resolves when the location services state is toggled.
57
62
  */
58
- export function toggleLocationServices(this: import("../driver").AndroidDriver): Promise<void>;
63
+ export declare function toggleLocationServices(this: AndroidDriver): Promise<void>;
59
64
  /**
60
- * @this {import('../driver').AndroidDriver}
61
- * @returns {Promise<void>}
65
+ * Resets the geolocation to the default state.
66
+ *
67
+ * @returns Promise that resolves when the geolocation is reset.
68
+ * @throws {Error} If called on an emulator (geolocation reset does not work on emulators).
62
69
  */
63
- export function mobileResetGeolocation(this: import("../driver").AndroidDriver): Promise<void>;
70
+ export declare function mobileResetGeolocation(this: AndroidDriver): Promise<void>;
64
71
  /**
65
- * @this {import('../driver').AndroidDriver}
66
- * @param {string} appId
67
- * @returns {Promise<void>}
72
+ * Sets the mock location permission for a specific app.
73
+ *
74
+ * @param appId The application package identifier.
75
+ * @returns Promise that resolves when the mock location permission is set.
68
76
  */
69
- export function setMockLocationApp(this: import("../driver").AndroidDriver, appId: string): Promise<void>;
77
+ export declare function setMockLocationApp(this: AndroidDriver, appId: string): Promise<void>;
70
78
  //# sourceMappingURL=geolocation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"geolocation.d.ts","sourceRoot":"","sources":["../../../lib/commands/geolocation.js"],"names":[],"mappings":"AAeA;;;;GAIG;AACH,kFAHW,OAAO,eAAe,EAAE,QAAQ,GAC9B,OAAO,CAAC,OAAO,eAAe,EAAE,QAAQ,CAAC,CAiBrD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wFAZW,MAAM,aACN,MAAM,aACN,MAAM,eACN,MAAM,UACN,MAAM,YAEN,MAAM,aAEN,MAAM,iBAsBhB;AAED;;;;;;;;;;;;;GAaG;AACH,2FANW,MAAM,GAIJ,OAAO,CAAC,IAAI,CAAC,CAIzB;AAED;;;GAGG;AACH,yEAFa,OAAO,CAAC,OAAO,eAAe,EAAE,QAAQ,CAAC,CASrD;AAED;;;GAGG;AACH,+EAFa,OAAO,CAAC,OAAO,eAAe,EAAE,QAAQ,CAAC,CAIrD;AAED;;;GAGG;AACH,oFAFa,OAAO,CAAC,OAAO,CAAC,CAI5B;AAED;;;GAGG;AACH,iFAFa,OAAO,CAAC,IAAI,CAAC,CAUzB;AAED;;;GAGG;AACH,iFAFa,OAAO,CAAC,IAAI,CAAC,CAOzB;AAID;;;;GAIG;AACH,mFAHW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAgCzB"}
1
+ {"version":3,"file":"geolocation.d.ts","sourceRoot":"","sources":["../../../lib/commands/geolocation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAG5C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,WAAW,CAAC;AAU7C;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,aAAa,EACnB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,QAAQ,CAAC,CAenB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,aAAa,EACnB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,MAAM,EACnB,KAAK,CAAC,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAUf;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,aAAa,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAEf;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,QAAQ,CAAC,CAOnB;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,QAAQ,CAAC,CAEnB;AAED;;;;GAIG;AACH,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,OAAO,CAAC,CAElB;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,IAAI,CAAC,CAQf;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,IAAI,CAAC,CAKf;AAID;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CA6Bf"}
@@ -26,9 +26,10 @@ const app_management_1 = require("./app-management");
26
26
  const GEO_EPSILON = Number.MIN_VALUE;
27
27
  const MOCK_APP_IDS_STORE = '/data/local/tmp/mock_apps.json';
28
28
  /**
29
- * @this {import('../driver').AndroidDriver}
30
- * @param {import('@appium/types').Location} location
31
- * @returns {Promise<import('@appium/types').Location>}
29
+ * Sets the device geolocation.
30
+ *
31
+ * @param location The geolocation object containing latitude, longitude, and altitude.
32
+ * @returns Promise that resolves to the current geolocation after setting it.
32
33
  */
33
34
  async function setGeoLocation(location) {
34
35
  await this.settingsApp.setGeoLocation(location, this.isEmulator());
@@ -36,7 +37,7 @@ async function setGeoLocation(location) {
36
37
  return await this.getGeoLocation();
37
38
  }
38
39
  catch (e) {
39
- this.log.warn(`Could not get the current geolocation info: ${ /** @type {Error} */(e).message}`);
40
+ this.log.warn(`Could not get the current geolocation info: ${e.message}`);
40
41
  this.log.warn(`Returning the default zero'ed values`);
41
42
  return {
42
43
  latitude: GEO_EPSILON,
@@ -48,16 +49,15 @@ async function setGeoLocation(location) {
48
49
  /**
49
50
  * Set the device geolocation.
50
51
  *
51
- * @this {import('../driver').AndroidDriver}
52
- * @param {number} latitude Valid latitude value.
53
- * @param {number} longitude Valid longitude value.
54
- * @param {number} [altitude] Valid altitude value.
55
- * @param {number} [satellites] Number of satellites being tracked (1-12). Available for emulators.
56
- * @param {number} [speed] Valid speed value.
52
+ * @param latitude Valid latitude value.
53
+ * @param longitude Valid longitude value.
54
+ * @param altitude Valid altitude value.
55
+ * @param satellites Number of satellites being tracked (1-12). Available for emulators.
56
+ * @param speed Valid speed value.
57
57
  * https://developer.android.com/reference/android/location/Location#setSpeed(float)
58
- * @param {number} [bearing] Valid bearing value. Available for real devices.
58
+ * @param bearing Valid bearing value. Available for real devices.
59
59
  * https://developer.android.com/reference/android/location/Location#setBearing(float)
60
- * @param {number} [accuracy] Valid accuracy value. Available for real devices.
60
+ * @param accuracy Valid accuracy value. Available for real devices.
61
61
  * https://developer.android.com/reference/android/location/Location#setAccuracy(float),
62
62
  * https://developer.android.com/reference/android/location/Criteria
63
63
  */
@@ -69,7 +69,7 @@ async function mobileSetGeolocation(latitude, longitude, altitude, satellites, s
69
69
  satellites,
70
70
  speed,
71
71
  bearing,
72
- accuracy
72
+ accuracy,
73
73
  }, this.isEmulator());
74
74
  }
75
75
  /**
@@ -79,19 +79,19 @@ async function mobileSetGeolocation(latitude, longitude, altitude, satellites, s
79
79
  * installed. In case the vanilla LocationManager is used the device API level
80
80
  * must be at version 30 (Android R) or higher.
81
81
  *
82
- * @this {import('../driver').AndroidDriver}
83
- * @param {number} [timeoutMs] The maximum number of milliseconds
82
+ * @param timeoutMs The maximum number of milliseconds
84
83
  * to block until GPS cache is refreshed. Providing zero or a negative
85
84
  * value to it skips waiting completely.
86
85
  * 20000ms by default.
87
- * @returns {Promise<void>}
86
+ * @returns Promise that resolves when the GPS cache refresh is initiated.
88
87
  */
89
88
  async function mobileRefreshGpsCache(timeoutMs) {
90
89
  await this.settingsApp.refreshGeoLocationCache(timeoutMs);
91
90
  }
92
91
  /**
93
- * @this {import('../driver').AndroidDriver}
94
- * @returns {Promise<import('@appium/types').Location>}
92
+ * Gets the current device geolocation.
93
+ *
94
+ * @returns Promise that resolves to the current geolocation object.
95
95
  */
96
96
  async function getGeoLocation() {
97
97
  const { latitude, longitude, altitude } = await this.settingsApp.getGeoLocation();
@@ -102,22 +102,25 @@ async function getGeoLocation() {
102
102
  };
103
103
  }
104
104
  /**
105
- * @this {import('../driver').AndroidDriver}
106
- * @returns {Promise<import('@appium/types').Location>}
105
+ * Gets the current device geolocation.
106
+ *
107
+ * @returns Promise that resolves to the current geolocation object.
107
108
  */
108
109
  async function mobileGetGeolocation() {
109
110
  return await this.getGeoLocation();
110
111
  }
111
112
  /**
112
- * @this {import('../driver').AndroidDriver}
113
- * @returns {Promise<boolean>}
113
+ * Checks if location services are enabled.
114
+ *
115
+ * @returns Promise that resolves to `true` if location services are enabled, `false` otherwise.
114
116
  */
115
117
  async function isLocationServicesEnabled() {
116
118
  return (await this.adb.getLocationProviders()).includes('gps');
117
119
  }
118
120
  /**
119
- * @this {import('../driver').AndroidDriver}
120
- * @returns {Promise<void>}
121
+ * Toggles the location services state.
122
+ *
123
+ * @returns Promise that resolves when the location services state is toggled.
121
124
  */
122
125
  async function toggleLocationServices() {
123
126
  this.log.info('Toggling location services');
@@ -127,8 +130,10 @@ async function toggleLocationServices() {
127
130
  await this.adb.toggleGPSLocationProvider(!isGpsEnabled);
128
131
  }
129
132
  /**
130
- * @this {import('../driver').AndroidDriver}
131
- * @returns {Promise<void>}
133
+ * Resets the geolocation to the default state.
134
+ *
135
+ * @returns Promise that resolves when the geolocation is reset.
136
+ * @throws {Error} If called on an emulator (geolocation reset does not work on emulators).
132
137
  */
133
138
  async function mobileResetGeolocation() {
134
139
  if (this.isEmulator()) {
@@ -138,9 +143,10 @@ async function mobileResetGeolocation() {
138
143
  }
139
144
  // #region Internal helpers
140
145
  /**
141
- * @this {import('../driver').AndroidDriver}
142
- * @param {string} appId
143
- * @returns {Promise<void>}
146
+ * Sets the mock location permission for a specific app.
147
+ *
148
+ * @param appId The application package identifier.
149
+ * @returns Promise that resolves when the mock location permission is set.
144
150
  */
145
151
  async function setMockLocationApp(appId) {
146
152
  try {
@@ -151,7 +157,6 @@ async function setMockLocationApp(appId) {
151
157
  return;
152
158
  }
153
159
  try {
154
- /** @type {string[]} */
155
160
  let pkgIds = [];
156
161
  if (await this.adb.fileExists(MOCK_APP_IDS_STORE)) {
157
162
  try {
@@ -178,8 +183,9 @@ async function setMockLocationApp(appId) {
178
183
  }
179
184
  }
180
185
  /**
181
- * @this {import('../driver').AndroidDriver}
182
- * @returns {Promise<void>}
186
+ * Resets the mock location permissions for all apps.
187
+ *
188
+ * @returns Promise that resolves when the mock location permissions are reset.
183
189
  */
184
190
  async function resetMockLocation() {
185
191
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"geolocation.js","sourceRoot":"","sources":["../../../lib/commands/geolocation.js"],"names":[],"mappings":";;;;;AAoBA,wCAeC;AAkBD,oDAkBC;AAgBD,sDAEC;AAMD,wCAOC;AAMD,oDAEC;AAMD,8DAEC;AAMD,wDAQC;AAMD,wDAKC;AASD,gDA8BC;AAtLD,oDAAuB;AACvB,6CAA4C;AAC5C,0DAA6B;AAC7B,wDAAyB;AACzB,2DAAsD;AACtD,qDAAuD;AAEvD,mDAAmD;AACnD,yEAAyE;AACzE,6DAA6D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BAA8B"}
@@ -1,3 +1,20 @@
1
+ import type { EventEmitter } from 'node:events';
2
+ import { type LogEntry } from '../utils';
3
+ import type { AndroidDriver } from '../driver';
4
+ export declare const supportedLogTypes: {
5
+ readonly logcat: {
6
+ readonly description: "Logs for Android applications on real device and emulators via ADB";
7
+ readonly getter: (self: AndroidDriver) => LogEntry[];
8
+ };
9
+ readonly bugreport: {
10
+ readonly description: "'adb bugreport' output for advanced issues diagnostic";
11
+ readonly getter: (self: AndroidDriver) => Promise<LogEntry[]>;
12
+ };
13
+ readonly server: {
14
+ readonly description: "Appium server logs";
15
+ readonly getter: (self: AndroidDriver) => LogEntry[];
16
+ };
17
+ };
1
18
  /**
2
19
  * Starts Android logcat broadcast websocket on the same host and port
3
20
  * where Appium server is running at `/ws/session/:sessionId:/appium/logcat` endpoint. The method
@@ -6,66 +23,45 @@
6
23
  * Each connected websocket listener will receive logcat log lines
7
24
  * as soon as they are visible to Appium.
8
25
  *
9
- * @this {import('../driver').AndroidDriver}
10
- * @returns {Promise<void>}
26
+ * @returns Promise that resolves when the logcat broadcasting websocket is started.
11
27
  */
12
- export function mobileStartLogsBroadcast(this: import("../driver").AndroidDriver): Promise<void>;
13
- export class mobileStartLogsBroadcast {
14
- _logcatWebsocketListener: ((logRecord: import("appium-adb").LogEntry) => void) | undefined;
15
- }
28
+ export declare function mobileStartLogsBroadcast(this: AndroidDriver): Promise<void>;
16
29
  /**
17
30
  * Stops the previously started logcat broadcasting wesocket server.
18
31
  * This method will return immediately if no server is running.
19
32
  *
20
- * @this {import('../driver').AndroidDriver}
21
- * @returns {Promise<void>}
33
+ * @returns Promise that resolves when the logcat broadcasting websocket is stopped.
22
34
  */
23
- export function mobileStopLogsBroadcast(this: import("../driver").AndroidDriver): Promise<void>;
35
+ export declare function mobileStopLogsBroadcast(this: AndroidDriver): Promise<void>;
24
36
  /**
25
- * @this {import('../driver').AndroidDriver}
26
- * @returns {Promise<string[]>}
37
+ * Gets the list of available log types.
38
+ *
39
+ * @returns Promise that resolves to an array of log type names.
27
40
  */
28
- export function getLogTypes(this: import("../driver").AndroidDriver): Promise<string[]>;
41
+ export declare function getLogTypes(this: AndroidDriver): Promise<string[]>;
42
+ export interface BiDiListenerProperties {
43
+ type: string;
44
+ srcEventName?: string;
45
+ context?: string;
46
+ entryTransformer?: (x: LogEntry) => LogEntry;
47
+ }
48
+ export type LogListener = (logEntry: LogEntry) => any;
29
49
  /**
50
+ * Assigns a BiDi log listener to an event emitter.
51
+ *
30
52
  * https://w3c.github.io/webdriver-bidi/#event-log-entryAdded
31
53
  *
32
- * @template {import('node:events').EventEmitter} EE
33
- * @this {import('../driver').AndroidDriver}
34
- * @param {EE} logEmitter
35
- * @param {BiDiListenerProperties} properties
36
- * @returns {[EE, LogListener]}
54
+ * @template EE The event emitter type.
55
+ * @param logEmitter The event emitter to attach the listener to.
56
+ * @param properties The BiDi listener properties.
57
+ * @returns A tuple containing the event emitter and the listener function.
37
58
  */
38
- export function assignBiDiLogListener<EE extends import("node:events").EventEmitter>(this: import("../driver").AndroidDriver, logEmitter: EE, properties: BiDiListenerProperties): [EE, LogListener];
59
+ export declare function assignBiDiLogListener<EE extends EventEmitter>(this: AndroidDriver, logEmitter: EE, properties: BiDiListenerProperties): [EE, LogListener];
39
60
  /**
40
- * @this {import('../driver').AndroidDriver}
41
- * @param {string} logType
42
- * @returns {Promise<any>}
61
+ * Gets logs of a specific type.
62
+ *
63
+ * @param logType The type of logs to retrieve.
64
+ * @returns Promise that resolves to the logs for the specified type.
43
65
  */
44
- export function getLog(this: import("../driver").AndroidDriver, logType: string): Promise<any>;
45
- export namespace supportedLogTypes {
46
- namespace logcat {
47
- let description: string;
48
- function getter(self: import("../driver").AndroidDriver): import("appium-adb").LogEntry[];
49
- }
50
- namespace bugreport {
51
- let description_1: string;
52
- export { description_1 as description };
53
- export function getter_1(self: import("../driver").AndroidDriver): Promise<import("appium-adb").LogEntry[]>;
54
- export { getter_1 as getter };
55
- }
56
- namespace server {
57
- let description_2: string;
58
- export { description_2 as description };
59
- export function getter_2(self: import("../driver").AndroidDriver): import("appium-adb").LogEntry[];
60
- export { getter_2 as getter };
61
- }
62
- }
63
- export type ADB = import("appium-adb").ADB;
64
- export type BiDiListenerProperties = {
65
- type: string;
66
- srcEventName?: string | undefined;
67
- context?: string | undefined;
68
- entryTransformer?: ((x: any) => import("../utils").LogEntry) | undefined;
69
- };
70
- export type LogListener = (logEntry: import("../utils").LogEntry) => any;
66
+ export declare function getLog(this: AndroidDriver, logType: string): Promise<any>;
71
67
  //# sourceMappingURL=log.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../lib/commands/log.js"],"names":[],"mappings":"AAkDA;;;;;;;;;;GAUG;AACH,mFAFa,OAAO,CAAC,IAAI,CAAC,CAwDzB;;IA3BK,2FAIC;;AAyBP;;;;;;GAMG;AACH,kFAFa,OAAO,CAAC,IAAI,CAAC,CAczB;AAED;;;GAGG;AACH,sEAFa,OAAO,CAAC,MAAM,EAAE,CAAC,CAc7B;AAED;;;;;;;;GAQG;AACH,sCANkD,EAAE,SAAvC,OAAQ,aAAa,EAAE,YAAa,uDAEtC,EAAE,cACF,sBAAsB,GACpB,CAAC,EAAE,EAAE,WAAW,CAAC,CAe7B;AAED;;;;GAIG;AACH,yEAHW,MAAM,GACJ,OAAO,CAAC,GAAG,CAAC,CAUxB;;;;QA5KW,sBAHG,OAAO,WAAW,EAAE,aAAa,mCAGmB;;;;;QASvD,+BAHG,OAAO,WAAW,EAAE,aAAa,4CAO3C;;;;;;QASO,+BAHG,OAAO,WAAW,EAAE,aAAa,mCAM3C;;;;kBAkKQ,OAAO,YAAY,EAAE,GAAG;;UAKvB,MAAM;;;oCAGS,OAAO,UAAU,EAAE,QAAQ;;0BAG1C,CAAC,QAAQ,EAAE,OAAO,UAAU,EAAE,QAAQ,KAAK,GAAG"}
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../lib/commands/log.ts"],"names":[],"mapp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: 'Logs for Android applications on real device and emulators via ADB',
23
- /**
24
- *
25
- * @param {import('../driver').AndroidDriver} self
26
- * @returns
27
- */
28
- getter: (self) => /** @type {ADB} */ (self.adb).getLogcatLogs(),
23
+ getter: (self) => self.adb.getLogcatLogs(),
29
24
  },
30
25
  bugreport: {
31
26
  description: `'adb bugreport' output for advanced issues diagnostic`,
32
- /**
33
- *
34
- * @param {import('../driver').AndroidDriver} self
35
- * @returns
36
- */
37
27
  getter: async (self) => {
38
- const output = await /** @type {ADB} */ (self.adb).bugreport();
28
+ const output = await self.adb.bugreport();
39
29
  const timestamp = Date.now();
40
30
  return output.split(node_os_1.default.EOL).map((x) => (0, utils_1.toLogRecord)(timestamp, x));
41
31
  },
42
32
  },
43
33
  server: {
44
34
  description: 'Appium server logs',
45
- /**
46
- *
47
- * @param {import('../driver').AndroidDriver} self
48
- * @returns
49
- */
50
35
  getter: (self) => {
51
36
  self.assertFeatureEnabled(utils_1.GET_SERVER_LOGS_FEATURE);
52
37
  return self.log.unwrap().record.map(utils_1.nativeLogEntryToSeleniumEntry);
@@ -61,12 +46,11 @@ exports.supportedLogTypes = {
61
46
  * Each connected websocket listener will receive logcat log lines
62
47
  * as soon as they are visible to Appium.
63
48
  *
64
- * @this {import('../driver').AndroidDriver}
65
- * @returns {Promise<void>}
49
+ * @returns Promise that resolves when the logcat broadcasting websocket is started.
66
50
  */
67
51
  async function mobileStartLogsBroadcast() {
68
- const server = /** @type {import('@appium/types').AppiumServer} */ (this.server);
69
- const pathname = WEBSOCKET_ENDPOINT(/** @type {string} */ (this.sessionId));
52
+ const server = this.server;
53
+ const pathname = WEBSOCKET_ENDPOINT(this.sessionId);
70
54
  if (!lodash_1.default.isEmpty(await server.getWebSocketHandlers(pathname))) {
71
55
  this.log.debug(`The logcat broadcasting web socket server is already listening at ${pathname}`);
72
56
  return;
@@ -80,7 +64,7 @@ async function mobileStartLogsBroadcast() {
80
64
  wss.on('connection', (ws, req) => {
81
65
  if (req) {
82
66
  const remoteIp = lodash_1.default.isEmpty(req.headers['x-forwarded-for'])
83
- ? req.connection?.remoteAddress
67
+ ? req.socket.remoteAddress
84
68
  : req.headers['x-forwarded-for'];
85
69
  this.log.debug(`Established a new logcat listener web socket connection from ${remoteIp}`);
86
70
  }
@@ -113,18 +97,17 @@ async function mobileStartLogsBroadcast() {
113
97
  this.log.debug(closeMsg);
114
98
  });
115
99
  });
116
- await server.addWebSocketHandler(pathname, /** @type {import('@appium/types').WSServer} */ (wss));
100
+ await server.addWebSocketHandler(pathname, wss);
117
101
  }
118
102
  /**
119
103
  * Stops the previously started logcat broadcasting wesocket server.
120
104
  * This method will return immediately if no server is running.
121
105
  *
122
- * @this {import('../driver').AndroidDriver}
123
- * @returns {Promise<void>}
106
+ * @returns Promise that resolves when the logcat broadcasting websocket is stopped.
124
107
  */
125
108
  async function mobileStopLogsBroadcast() {
126
- const pathname = WEBSOCKET_ENDPOINT(/** @type {string} */ (this.sessionId));
127
- const server = /** @type {import('@appium/types').AppiumServer} */ (this.server);
109
+ const pathname = WEBSOCKET_ENDPOINT(this.sessionId);
110
+ const server = this.server;
128
111
  if (lodash_1.default.isEmpty(await server.getWebSocketHandlers(pathname))) {
129
112
  return;
130
113
  }
@@ -133,30 +116,32 @@ async function mobileStopLogsBroadcast() {
133
116
  await server.removeWebSocketHandler(pathname);
134
117
  }
135
118
  /**
136
- * @this {import('../driver').AndroidDriver}
137
- * @returns {Promise<string[]>}
119
+ * Gets the list of available log types.
120
+ *
121
+ * @returns Promise that resolves to an array of log type names.
138
122
  */
139
123
  async function getLogTypes() {
140
124
  // XXX why doesn't `super` work here?
141
125
  const nativeLogTypes = await driver_1.BaseDriver.prototype.getLogTypes.call(this);
142
126
  if (this.isWebContext()) {
143
- const webLogTypes = /** @type {string[]} */ (await /** @type {import('appium-chromedriver').Chromedriver} */ (this.chromedriver).jwproxy.command('/log/types', 'GET'));
127
+ const webLogTypes = await this.chromedriver.jwproxy.command('/log/types', 'GET');
144
128
  return [...nativeLogTypes, ...webLogTypes];
145
129
  }
146
130
  return nativeLogTypes;
147
131
  }
148
132
  /**
133
+ * Assigns a BiDi log listener to an event emitter.
134
+ *
149
135
  * https://w3c.github.io/webdriver-bidi/#event-log-entryAdded
150
136
  *
151
- * @template {import('node:events').EventEmitter} EE
152
- * @this {import('../driver').AndroidDriver}
153
- * @param {EE} logEmitter
154
- * @param {BiDiListenerProperties} properties
155
- * @returns {[EE, LogListener]}
137
+ * @template EE The event emitter type.
138
+ * @param logEmitter The event emitter to attach the listener to.
139
+ * @param properties The BiDi listener properties.
140
+ * @returns A tuple containing the event emitter and the listener function.
156
141
  */
157
142
  function assignBiDiLogListener(logEmitter, properties) {
158
143
  const { type, context = helpers_1.NATIVE_WIN, srcEventName = 'output', entryTransformer, } = properties;
159
- const listener = (/** @type {import('../utils').LogEntry} */ logEntry) => {
144
+ const listener = (logEntry) => {
160
145
  const finalEntry = entryTransformer ? entryTransformer(logEntry) : logEntry;
161
146
  this.eventEmitter.emit(constants_1.BIDI_EVENT_NAME, (0, models_1.makeLogEntryAddedEvent)(finalEntry, context, type));
162
147
  };
@@ -164,33 +149,24 @@ function assignBiDiLogListener(logEmitter, properties) {
164
149
  return [logEmitter, listener];
165
150
  }
166
151
  /**
167
- * @this {import('../driver').AndroidDriver}
168
- * @param {string} logType
169
- * @returns {Promise<any>}
152
+ * Gets logs of a specific type.
153
+ *
154
+ * @param logType The type of logs to retrieve.
155
+ * @returns Promise that resolves to the logs for the specified type.
170
156
  */
171
157
  async function getLog(logType) {
172
158
  if (this.isWebContext() && !lodash_1.default.keys(this.supportedLogTypes).includes(logType)) {
173
- return await /** @type {import('appium-chromedriver').Chromedriver} */ (this.chromedriver).jwproxy.command('/log', 'POST', { type: logType });
159
+ return await this.chromedriver.jwproxy.command('/log', 'POST', { type: logType });
174
160
  }
175
- // XXX why doesn't `super` work here?
176
161
  return await driver_1.BaseDriver.prototype.getLog.call(this, logType);
177
162
  }
178
163
  // #region Internal helpers
179
164
  /**
180
- * @param {string} sessionId
181
- * @returns {string}
165
+ * Generates the websocket endpoint path for logcat broadcasting.
166
+ *
167
+ * @param sessionId The session ID.
168
+ * @returns The websocket endpoint path.
182
169
  */
183
170
  const WEBSOCKET_ENDPOINT = (sessionId) => `${driver_1.DEFAULT_WS_PATHNAME_PREFIX}/session/${sessionId}/appium/device/logcat`;
184
171
  // #endregion
185
- /**
186
- * @typedef {import('appium-adb').ADB} ADB
187
- */
188
- /**
189
- * @typedef {Object} BiDiListenerProperties
190
- * @property {string} type
191
- * @property {string} [srcEventName='output']
192
- * @property {string} [context=NATIVE_WIN]
193
- * @property {(x: Object) => import('../utils').LogEntry} [entryTransformer]
194
- */
195
- /** @typedef {(logEntry: import('../utils').LogEntry) => any} LogListener */
196
172
  //# sourceMappingURL=log.js.map