appium-android-driver
Version:
Android UiAutomator and Chrome support for Appium
103 lines • 4.11 kB
TypeScript
import type { Position, StringRecord } from '@appium/types';
import type { AndroidDriver, AndroidDriverCaps } from '../../driver';
import type { UnlockType, FastUnlockOptions } from '../types';
export declare const PIN_UNLOCK = "pin";
export declare const PIN_UNLOCK_KEY_EVENT = "pinWithKeyEvent";
export declare const PASSWORD_UNLOCK = "password";
export declare const PATTERN_UNLOCK = "pattern";
export declare const FINGERPRINT_UNLOCK = "fingerprint";
export declare const KEYCODE_NUMPAD_ENTER = 66;
export declare const UNLOCK_WAIT_TIME = 100;
export declare const INPUT_KEYS_WAIT_TIME = 100;
/**
* Converts an unlock type to a credential type string.
*
* @param unlockType - The unlock type
* @returns The credential type string
* @throws {Error} If the unlock type is not known
*/
export declare function toCredentialType(unlockType: UnlockType): string;
/**
* Validates unlock capabilities and returns them if valid.
*
* @param caps - The capabilities to validate
* @returns The validated capabilities
* @throws {Error} If the capabilities are invalid
*/
export declare function validateUnlockCapabilities<T extends AndroidDriverCaps>(caps: T): T;
/**
* Performs a fast unlock using ADB commands.
*
* @param opts - Fast unlock options with credential and credential type
*/
export declare function fastUnlock(this: AndroidDriver, opts: FastUnlockOptions): Promise<void>;
/**
* Encodes a password by replacing spaces with %s.
*
* @param key - The password key
* @returns The encoded password
*/
export declare function encodePassword(key: string): string;
/**
* Converts a string key to an array of characters.
*
* @param key - The key string
* @returns An array of characters
*/
export declare function stringKeyToArr(key: string): string[];
/**
* Unlocks the device using fingerprint.
*
* @param capabilities - Driver capabilities containing unlockKey
*/
export declare function fingerprintUnlock(this: AndroidDriver, capabilities: AndroidDriverCaps): Promise<void>;
/**
* Unlocks the device using PIN by clicking on-screen buttons.
*
* @param capabilities - Driver capabilities containing unlockKey
*/
export declare function pinUnlock(this: AndroidDriver, capabilities: AndroidDriverCaps): Promise<void>;
/**
* Unlocks the device using PIN by sending key events.
*
* @param capabilities - Driver capabilities containing unlockKey
*/
export declare function pinUnlockWithKeyEvent(this: AndroidDriver, capabilities: AndroidDriverCaps): Promise<void>;
/**
* Unlocks the device using password.
*
* @param capabilities - Driver capabilities containing unlockKey
*/
export declare function passwordUnlock(this: AndroidDriver, capabilities: AndroidDriverCaps): Promise<void>;
/**
* Calculates the position of a pattern key based on the initial position and piece size.
*
* @param key - The pattern key number (1-9)
* @param initPos - The initial position of the pattern view
* @param piece - The size of each pattern piece
* @returns The calculated position for the key
*/
export declare function getPatternKeyPosition(key: number, initPos: Position, piece: number): Position;
/**
* Generates pointer actions for pattern unlock gesture.
*
* @param keys - Array of pattern keys (string or number)
* @param initPos - The initial position of the pattern view
* @param piece - The size of each pattern piece
* @returns An array of W3C action objects for pattern unlock
*/
export declare function getPatternActions(keys: string[] | number[], initPos: Position, piece: number): StringRecord[];
/**
* Verifies that the device has been unlocked.
*
* @param timeoutMs - Optional timeout in milliseconds (default: 2000)
* @throws {Error} If the device fails to unlock within the timeout
*/
export declare function verifyUnlock(this: AndroidDriver, timeoutMs?: number | null): Promise<void>;
/**
* Unlocks the device using pattern gesture.
*
* @param capabilities - Driver capabilities containing unlockKey
*/
export declare function patternUnlock(this: AndroidDriver, capabilities: AndroidDriverCaps): Promise<void>;
//# sourceMappingURL=helpers.d.ts.map