UNPKG

appium-xcuitest-driver

Version:

Appium driver for iOS using XCUITest for backend

126 lines 5.82 kB
import _ from 'lodash'; import type { XCUITestDriverOpts, XCUITestDriver } from './driver'; import type { XcodeVersion } from 'appium-xcode'; import type { Simulator } from 'appium-ios-simulator'; import type { HTTPHeaders } from '@appium/types'; import type { Method } from 'axios'; export declare const UDID_AUTO = "auto"; export declare const DEFAULT_TIMEOUT_KEY = "default"; export declare const NATIVE_WIN = "NATIVE_APP"; export declare function getAndCheckXcodeVersion(): Promise<XcodeVersion>; export declare function getAndCheckIosSdkVersion(): Promise<string | null>; export declare function clearLogs(locations: string[]): Promise<void>; export declare function markSystemFilesForCleanup(wda: any): Promise<void>; export declare function clearSystemFiles(wda: any): Promise<void>; export declare function checkAppPresent(app: string): Promise<void>; /** * @typedef {Object} DriverInfo * @property {string} version Driver version string * @property {string} built Driver build timestamp */ export interface DriverInfo { version: string; built: string; } /** * @returns */ export declare const getDriverInfo: (() => Promise<DriverInfo>) & _.MemoizedFunction; export declare function normalizeCommandTimeouts(value: string | Record<string, number>): Record<string, number>; export declare function printUser(): Promise<void>; /** * Get the IDs of processes listening on the particular system port. * It is also possible to apply additional filtering based on the * process command line. * * @param port - The port number. * @param filteringFunc - Optional lambda function, which * receives command line string of the particular process * listening on given port, and is expected to return * either true or false to include/exclude the corresponding PID * from the resulting array. * @returns - the list of matched process ids. */ export declare function getPIDsListeningOnPort(port: string | number, filteringFunc?: ((cmdLine: string) => boolean | Promise<boolean>) | null): Promise<string[]>; /** * @typedef {Object} UploadOptions * * @property {string} [user] - The name of the user for the remote authentication. Only works if `remotePath` is provided. * @property {string} [pass] - The password for the remote authentication. Only works if `remotePath` is provided. * @property {import('axios').Method} [method] - The http multipart upload method name. The 'PUT' one is used by default. * Only works if `remotePath` is provided. * @property {import('@appium/types').HTTPHeaders} [headers] - Additional headers mapping for multipart http(s) uploads * @property {string} [fileFieldName] [file] - The name of the form field, where the file content BLOB should be stored for * http(s) uploads * @property {Record<string, any> | [string, any][]} [formFields] - Additional form fields for multipart http(s) uploads */ export interface UploadOptions { user?: string; pass?: string; method?: Method; headers?: HTTPHeaders; fileFieldName?: string; formFields?: Record<string, any> | [string, any][]; } /** * Encodes the given local file to base64 and returns the resulting string * or uploads it to a remote server using http/https or ftp protocols * if `remotePath` is set * * @param localPath - The path to an existing local file * @param remotePath - The path to the remote location, where * this file should be uploaded * @param uploadOptions - Set of upload options * @returns Either an empty string if the upload was successful or * base64-encoded file representation if `remotePath` is falsy */ export declare function encodeBase64OrUpload(localPath: string, remotePath?: string | null, uploadOptions?: UploadOptions): Promise<string>; /** * Stops and removes all web socket handlers that are listening * in scope of the current session. * * @this {XCUITestDriver} * @returns */ export declare function removeAllSessionWebSocketHandlers(this: XCUITestDriver): Promise<void>; /** * Returns true if the urlString is localhost * @param urlString * @returns Return true if the urlString is localhost */ export declare function isLocalHost(urlString: string): boolean; /** * Normalizes platformVersion to a valid iOS version string * * @param originalVersion - Loose version number, that can be parsed by semver * @return iOS version number in <major>.<minor> format * @throws if the version number cannot be parsed */ export declare function normalizePlatformVersion(originalVersion: string): string; /** * Assert the presence of particular keys in the given object * * @param argNames one or more key names * @param opts the object to check * @returns the same given object */ export declare function requireArgs(argNames: string | string[], opts?: Record<string, any>): Record<string, any>; /** * Asserts that the given driver is running on a Simulator and return * the simlator instance. * * @param action - Description of action */ export declare function assertSimulator(this: XCUITestDriver, action: string): Simulator; /** * Check if platform name is the TV OS one. */ export declare function isTvOs(platformName: string | null | undefined): boolean; /** * Return normalized platform name. */ export declare function normalizePlatformName(platformName: string | null | undefined): string; export declare function shouldSetInitialSafariUrl(opts: XCUITestDriverOpts): boolean; export declare function isIos17OrNewer(opts: XCUITestDriverOpts): boolean; export declare function isIos18OrNewer(opts: XCUITestDriverOpts): boolean; //# sourceMappingURL=utils.d.ts.map