UNPKG

appium-xcuitest-driver

Version:

Appium driver for iOS using XCUITest for backend

141 lines 6.07 kB
import type { XCUITestDriver } from '../driver'; import type { Viewport, ScreenInfo, ButtonName } from './types'; import type { Size, Rect } from '@appium/types'; /** * Gets the currently active element. * * In web context, returns the active element from the DOM. * In native context, returns the active element from the current view. * * @returns The active element */ export declare function active(this: XCUITestDriver): Promise<any>; /** * Trigger a touch/fingerprint match or match failure. * * @param match - Whether the match should be a success or failure */ export declare function touchId(this: XCUITestDriver, match?: boolean): Promise<void>; /** * Toggle whether the device is enrolled in the touch ID program. * * @param isEnabled - Whether to enable or disable the touch ID program */ export declare function toggleEnrollTouchId(this: XCUITestDriver, isEnabled?: boolean): Promise<void>; /** * Get the window size. * * @returns The window size (width and height) */ export declare function getWindowSize(this: XCUITestDriver): Promise<Size>; /** * Retrieves the actual device time. * * @param format - The format specifier string. Read the [MomentJS documentation](https://momentjs.com/docs/) to get the full list of supported datetime format specifiers. The default format is `YYYY-MM-DDTHH:mm:ssZ`, which complies to ISO-8601. * @returns Formatted datetime string or the raw command output (if formatting fails) */ export declare function getDeviceTime(this: XCUITestDriver, format?: string): Promise<string>; /** * Retrieves the current device time. * * This is a wrapper around {@linkcode getDeviceTime}. * * @param format - See {@linkcode getDeviceTime.format} * @returns Formatted datetime string or the raw command output if formatting fails */ export declare function mobileGetDeviceTime(this: XCUITestDriver, format?: string): Promise<string>; /** * Gets the window rectangle (position and size). * * For W3C compatibility. In web context, returns the browser window dimensions. * In native context, returns the device window dimensions. * * @returns The window rectangle */ export declare function getWindowRect(this: XCUITestDriver): Promise<Rect>; /** * Removes/uninstalls the given application from the device under test. * * This is a wrapper around {@linkcode mobileRemoveApp mobile: removeApp}. * * @param bundleId - The bundle identifier of the application to be removed * @returns `true` if the application has been removed successfully; `false` otherwise */ export declare function removeApp(this: XCUITestDriver, bundleId: string): Promise<boolean>; /** * Launches the app. * * @deprecated This API has been deprecated and is not supported anymore. * Consider using corresponding 'mobile:' extensions to manage the state of the app under test. * @throws {Error} Always throws an error indicating the API is deprecated */ export declare function launchApp(this: XCUITestDriver): Promise<void>; /** * Closes the app. * * @deprecated This API has been deprecated and is not supported anymore. * Consider using corresponding 'mobile:' extensions to manage the state of the app under test. * @throws {Error} Always throws an error indicating the API is deprecated */ export declare function closeApp(this: XCUITestDriver): Promise<void>; /** * Sets the URL for the current session. * * In web context, navigates to the URL using the remote debugger. * In native context on real devices, uses the proxy command. * In native context on simulators, uses simctl to open the URL. * * @param url - The URL to navigate to */ export declare function setUrl(this: XCUITestDriver, url: string): Promise<void>; /** * Retrieves the viewport dimensions. * * The viewport is the device's screen size with status bar size subtracted if the latter is present/visible. * * @returns The viewport rectangle */ export declare function getViewportRect(this: XCUITestDriver): Promise<Viewport>; /** * Get information about the screen. * * @privateRemarks memoized in constructor * @returns Screen information including dimensions, scale, and status bar size */ export declare function getScreenInfo(this: XCUITestDriver): Promise<ScreenInfo>; /** * Gets the status bar height. * * @returns The height of the status bar in logical pixels */ export declare function getStatusBarHeight(this: XCUITestDriver): Promise<number>; /** * Gets the device pixel ratio. * * @privateRemarks memoized in constructor * @returns The device pixel ratio (scale factor) */ export declare function getDevicePixelRatio(this: XCUITestDriver): Promise<number>; /** * Emulates press action on the given physical device button. * * This executes different methods based on the platform: * * - iOS: [`pressButton:`](https://developer.apple.com/documentation/xctest/xcuidevice/1619052-pressbutton) * - tvOS: [`pressButton:`](https://developer.apple.com/documentation/xctest/xcuiremote/1627475-pressbutton) or [`pressButton:forDuration:`](https://developer.apple.com/documentation/xctest/xcuiremote/1627476-pressbutton) * * Use {@linkcode mobilePerformIoHidEvent} to call a more universal API to perform a button press with duration on any supported device. * * @param name - The name of the button to be pressed * @param durationSeconds - The duration of the button press in seconds (float) */ export declare function mobilePressButton(this: XCUITestDriver, name: ButtonName, durationSeconds?: number): Promise<void>; /** * Process a string as speech and send it to Siri. * * Presents the Siri UI, if it is not currently active, and accepts a string which is then processed as if it were recognized speech. See [the documentation of `activateWithVoiceRecognitionText`](https://developer.apple.com/documentation/xctest/xcuisiriservice/2852140-activatewithvoicerecognitiontext?language=objc) for more details. * * @param text - Text to be sent to Siri */ export declare function mobileSiriCommand(this: XCUITestDriver, text: string): Promise<void>; //# sourceMappingURL=general.d.ts.map