UNPKG

appium-xcuitest-driver

Version:

Appium driver for iOS using XCUITest for backend

176 lines 9.5 kB
import type { XCUITestDriver } from '../driver'; import type { AppState } from './enum'; import type { AppInfoMapping } from '../types'; /** * Installs the given application to the device under test. * * Please ensure the app is built for a correct architecture and is signed with a proper developer signature (for real devices) prior to calling this. * @param app - See docs for `appium:app` capability * @param timeoutMs - The maximum time to wait until app install is finished (in ms) on real devices. * If not provided, then the value of `appium:appPushTimeout` capability is used. If the capability is not provided then the default is 240000ms (4 minutes). * @param checkVersion - If the application installation follows currently installed application's version status if provided. * No checking occurs if no this option. * @privateRemarks Link to capability docs */ export declare function mobileInstallApp(this: XCUITestDriver, app: string, timeoutMs?: number, checkVersion?: boolean): Promise<void>; /** * Checks whether the given application is installed on the device under test. * Offload app is handled as not installed. * * @param bundleId - The bundle identifier of the application to be checked * @returns `true` if the application is installed; `false` otherwise */ export declare function mobileIsAppInstalled(this: XCUITestDriver, bundleId: string): Promise<boolean>; /** * Removes/uninstalls the given application from the device under test. * Offload app data could also be removed. * * @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 mobileRemoveApp(this: XCUITestDriver, bundleId: string): Promise<boolean>; /** * Executes the given app on the device under test. * * If the app is already running it will be activated. If the app is not installed or cannot be launched then an exception is thrown. * @param bundleId - The bundle identifier of the application to be launched * @param args - One or more command line arguments for the app. If the app is already running then this argument is ignored. * @param environment - Environment variables mapping for the app. If the app is already running then this argument is ignored. */ export declare function mobileLaunchApp(this: XCUITestDriver, bundleId: string, args?: string | string[], environment?: Record<string, any>): Promise<void>; /** * Terminates the given app on the device under test. * * This command performs termination via [XCTest's `terminate`](https://developer.apple.com/documentation/xctest/xcuiapplication/1500637-terminate) API. If the app is not installed an exception is thrown. If the app is not running then nothing is done. * @param bundleId - The bundle identifier of the application to be terminated * @returns `true` if the app has been terminated successfully; `false` otherwise */ export declare function mobileTerminateApp(this: XCUITestDriver, bundleId: string): Promise<boolean>; /** * Activate the given app on the device under test. * * This pushes the app to the foreground if it is running in the background. An exception is thrown if the app is not install or isn't running. Nothing is done if the app is already in the foreground. * * @param bundleId - The bundle identifier of the application to be activated */ export declare function mobileActivateApp(this: XCUITestDriver, bundleId: string): Promise<void>; /** * Kill the given app on the real device under test by instruments service. * * If the app is not running or kill failed, then nothing is done. * * @param bundleId - The bundle identifier of the application to be killed * @returns `true` if the app has been killed successfully; `false` otherwise * @group Real Device Only */ export declare function mobileKillApp(this: XCUITestDriver, bundleId: string): Promise<boolean>; /** * Queries the state of an installed application from the device under test. * * If the app with the given `bundleId` is not installed, an exception will be thrown. * * @param bundleId - The bundle identifier of the application to be queried * @returns The actual application state code * @see https://developer.apple.com/documentation/xctest/xcuiapplicationstate?language=objc */ export declare function mobileQueryAppState(this: XCUITestDriver, bundleId: string): Promise<AppState>; /** * Installs the given application to the device under test. * * This is a wrapper around {@linkcode mobileInstallApp mobile: installApp}. * * @param appPath - Path to the application bundle or .ipa/.app file * @param opts - Installation options * @param opts.timeoutMs - Maximum time to wait for installation to complete (in milliseconds) * @param opts.strategy - If `true`, checks the version before installing and skips if already installed */ export declare function installApp(this: XCUITestDriver, appPath: string, opts?: { timeoutMs?: number; strategy?: boolean; }): Promise<void>; /** * Activates the given app on the device under test. * * This is a wrapper around {@linkcode mobileLaunchApp mobile: launchApp}. If the app is already * running, it will be activated (brought to foreground). If the app is not installed or cannot * be launched, an exception is thrown. * * @param bundleId - The bundle identifier of the application to be activated * @param opts - Launch options * @param opts.environment - Environment variables mapping for the app * @param opts.arguments - Command line arguments for the app */ export declare function activateApp(this: XCUITestDriver, bundleId: string, opts?: { environment?: Record<string, any>; arguments?: string[]; }): Promise<void>; /** * Checks whether the given application is installed on the device under test. * * This is a wrapper around {@linkcode mobileIsAppInstalled mobile: isAppInstalled}. * Offload apps are treated as not installed. * * @param bundleId - The bundle identifier of the application to be checked * @returns `true` if the application is installed; `false` otherwise */ export declare function isAppInstalled(this: XCUITestDriver, bundleId: string): Promise<boolean>; /** * Terminates the given app on the device under test. * * This is a wrapper around {@linkcode mobileTerminateApp mobile: terminateApp}. * The command performs termination via XCTest's `terminate` API. If the app is not installed, * an exception is thrown. If the app is not running, nothing is done. * * @param bundleId - The bundle identifier of the application to be terminated * @returns `true` if the app has been terminated successfully; `false` otherwise */ export declare function terminateApp(this: XCUITestDriver, bundleId: string): Promise<boolean>; /** * Queries the state of an installed application from the device under test. * * This is a wrapper around {@linkcode mobileQueryAppState mobile: queryAppState}. * If the app with the given `bundleId` is not installed, an exception will be thrown. * * @param bundleId - The bundle identifier of the application to be queried * @returns The actual application state code * @see https://developer.apple.com/documentation/xctest/xcuiapplicationstate?language=objc */ export declare function queryAppState(this: XCUITestDriver, bundleId: string): Promise<AppState>; /** * List applications installed on the real device under test * * Read [Pushing/Pulling files](https://appium.io/docs/en/writing-running-appium/ios/ios-xctest-file-movement/) for more details. * @param applicationType - The type of applications to list (default: 'User'). * @param returnAttributes - Array of attribute names to return for each app (e.g., ["CFBundleIdentifier", "CFBundleName"]). * If not provided, all available attributes are returned. * @returns An object mapping bundle identifiers to app properties (e.g., CFBundleName, CFBundleVersion, etc.). * @remarks Having `UIFileSharingEnabled` set to `true` in the app properties means the app supports file upload/download in its `documents` container. * @group Real Device Only */ export declare function mobileListApps(this: XCUITestDriver, applicationType?: 'User' | 'System', returnAttributes?: string[]): Promise<AppInfoMapping>; /** * Deletes application data files, so it could start from the clean state next time * it is launched. * This API only works on a Simulator. * * @param bundleId Application bundle identifier * @returns true if any files from the app's data container have been deleted */ export declare function mobileClearApp(this: XCUITestDriver, bundleId: string): Promise<boolean>; /** * Closes the app (simulates device home button press). * * It is possible to restore the app after a timeout or keep it minimized based on the parameter value. * * @param seconds - Timeout configuration. Accepts: * - A positive number (seconds): app will be restored after the specified number of seconds * - A negative number or zero: app will not be restored (kept minimized) * - `undefined` or `null`: app will not be restored (kept minimized) * - An object with `timeout` property: * - `{timeout: 5000}`: app will be restored after 5 seconds (timeout in milliseconds) * - `{timeout: null}` or `{timeout: -2}`: app will not be restored */ export declare function background(this: XCUITestDriver, seconds?: number | { timeout?: number | null; }): Promise<void>; //# sourceMappingURL=app-management.d.ts.map