appium-xcuitest-driver
Version:
Appium driver for iOS using XCUITest for backend
41 lines • 2.08 kB
TypeScript
import type { XCUITestDriver } from '../driver';
import type { Location } from '@appium/types';
import type { LocationWithAltitude } from './types';
/**
* Returns the geographic location of the device under test.
*
* Location Services for WDA must be set to 'Always' for reliable readings from the device
* (`/wda/device/location`). Latitude, longitude, and altitude may still be zero briefly after
* enabling Always, while the device updates its fix.
*
* On iOS 17 and newer, if `mobile:setSimulatedLocation` was used earlier in the session, this
* command may return that simulated position via `mobile:getSimulatedLocation` before falling
* back to the device endpoint above.
*
* @returns Coordinates with altitude
* @throws {Error} If WDA returns an error (for example, tvOS may report unsupported).
*/
export declare function getGeoLocation(this: XCUITestDriver): Promise<LocationWithAltitude>;
/**
* Sets the geographic location of the device under test.
*
* On a simulator, coordinates are passed to the simulator API. On a real device running
* iOS 17 or newer, this uses `mobile:setSimulatedLocation` (XCTest session simulated location).
* On older real devices, it uses the legacy lockdown simulate-location service.
*
* @param location - Must include `latitude` and `longitude` (each coerced with `Number()`).
*/
export declare function setGeoLocation(this: XCUITestDriver, location: Partial<Location>): Promise<Location>;
/**
* Resets simulated or legacy location state.
*
* - iOS 17 and newer: `mobile:resetSimulatedLocation` (simulator or real device).
* - Real device, older iOS: legacy simulate-location session over lockdown (UDID required).
* - Simulator, older iOS: not supported.
*
* @throws {errors.NotImplementedError} When the target is a simulator on iOS < 17.
* @throws {errors.InvalidArgumentError} When the legacy path runs without a UDID.
* @throws {Error} When the underlying reset fails.
*/
export declare function mobileResetLocationService(this: XCUITestDriver): Promise<void>;
//# sourceMappingURL=location.d.ts.map