appium-xcuitest-driver
Version:
Appium driver for iOS using XCUITest for backend
204 lines • 8.71 kB
TypeScript
/**
* @typedef {Object} ProcessInfo
* @property {number} processIdentifier
* @property {string} executable
*/
/**
* @typedef {Object} AppInfo
* @property {boolean} appClip
* @property {boolean} builtByDeveloper
* @property {string} bundleIdentifier
* @property {string} bundleVersion
* @property {boolean} defaultApp
* @property {boolean} hidden
* @property {boolean} internalApp
* @property {string} name
* @property {boolean} removable
* @property {string} url
* @property {string} version
*/
/**
* @typedef {Object} ExecuteOptions
* @property {boolean} [logStdout=false]
* @property {boolean} [asJson=true]
* @property {boolean} [asynchronous=false]
* @property {string[]|string} [subcommandOptions]
* @property {number} [timeout]
*/
/**
* @typedef {{asynchronous: true}} TAsyncOpts
*/
/**
* @typedef {Object} ListFilesOptions
* @property {string} [username] The username of the user we should target. Only relevant for certain domains.
* @property {string} [subdirectory] A subdirectory within the domain. If not specified, defaults to the root.
*/
/**
* @typedef {Object} PullFileOptions
* @property {string} [username] The username of the user we should target. Only relevant for certain domains.
* @property {string} domainType The file service domain. Valid values are: temporary, rootStaging, appDataContainer, appGroupDataContainer,
* systemCrashLogs. You must specify a valid domain and identifier pair. Each domain is accompanied by an identifier
* that provides additional context. For example, if the domain is an app data container, the identifier is the bundle
* ID of the app. For temporary directories and root staging areas, the identifier is a unique client-provided string
* which is used to get your own space, separate from those of other clients.
* @property {string} domainIdentifier A unique string used to provide additional context to the domain.
* @property {number} [timeout=120000] The timeout for pulling a file in milliseconds.
*/
/**
* An option for launchApp method by devicectl.
* @typedef {Object} LaunchAppOptions
* @property {import('@appium/types').StringRecord<string|number>} [env] Bundle id to Environment variables for the launching app process.
* @property {boolean} [terminateExisting=false] Whether terminating the already running app.
*/
export class Devicectl {
/**
* @since Xcode 15, iOS 17
* @param {string} udid
* @param {import('@appium/types').AppiumLogger} log
*/
constructor(udid: string, log: import("@appium/types").AppiumLogger);
udid: string;
log: import("@appium/types").AppiumLogger;
/**
* @template {ExecuteOptions} TExecOpts
* @param {string[]} subcommand
* @param {TExecOpts} [opts]
* @return {Promise<TExecOpts extends TAsyncOpts ? import('teen_process').SubProcess : import('teen_process').TeenProcessExecResult>}
*/
execute<TExecOpts extends ExecuteOptions>(subcommand: string[], opts?: TExecOpts): Promise<TExecOpts extends TAsyncOpts ? import("teen_process").SubProcess : import("teen_process").TeenProcessExecResult<any>>;
/**
* Simulates memory warning for the process with the given PID
*
* @param {number|string} pid The process identifier to simulate the Low Memory warning for
* @return {Promise<void>}
*/
sendMemoryWarning(pid: number | string): Promise<void>;
/**
* Lists running processes on the device
*
* @returns {Promise<ProcessInfo[]>}
*/
listProcesses(): Promise<ProcessInfo[]>;
/**
* Lists files at a specified path on the device
*
* @param {string} domainType The file service domain. Valid values are: temporary, rootStaging, appDataContainer, appGroupDataContainer,
* systemCrashLogs. You must specify a valid domain and identifier pair. Each domain is accompanied by an identifier
* that provides additional context. For example, if the domain is an app data container, the identifier is the bundle
* ID of the app. For temporary directories and root staging areas, the identifier is a unique client-provided string
* which is used to get your own space, separate from those of other clients.
* @param {string} domainIdentifier A unique string used to provide additional context to the domain.
* @param {ListFilesOptions} [opts={}]
* @returns {Promise<string[]>} List of file names (could be empty)
*/
listFiles(domainType: string, domainIdentifier: string, opts?: ListFilesOptions): Promise<string[]>;
/**
* Pulls a file from the specified path on the device to a local file system
*
* @param {string} from The item which should be copied.
* @param {string} to The location to which the item should be copied.
* @param {PullFileOptions} opts
* @returns {Promise<string>} The destination path (same as `to`)
*/
pullFile(from: string, to: string, opts: PullFileOptions): Promise<string>;
/**
* Send POSIX signal to the running process
*
* @param {number|string} pid The process identifier to send a signal to
* @param {number|string} signal The signal to send to a process. See 'man signal' for a list of signals
* @returns {Promise<void>}
*/
sendSignalToProcess(pid: number | string, signal: number | string): Promise<void>;
/**
* Retrieves the list of installed apps from the device
*
* @param {string?} [bundleId=null] Provide the target bundle identifier
* to speed up the lookup.
* @returns {Promise<AppInfo[]>} Empty array is returned if no matching apps are found
*/
listApps(bundleId?: string | null): Promise<AppInfo[]>;
/**
* Launch the given bundle id application with the given environment variable.
* This method is over devicectl command, this it may take additional seconds to launch the app.
* Please use via WDA or via appium-ios-device as primary method to launch app if possible.
*
* @param {string} bundleId Bundle id to launch.
* @param {LaunchAppOptions} opts launching app with devicectl command options.
* @returns {Promise<void>}
* @throws {Error} If the launching app command fails. For example, the given bundle id did not exist.
*/
launchApp(bundleId: string, opts: LaunchAppOptions): Promise<void>;
}
export type ProcessInfo = {
processIdentifier: number;
executable: string;
};
export type AppInfo = {
appClip: boolean;
builtByDeveloper: boolean;
bundleIdentifier: string;
bundleVersion: string;
defaultApp: boolean;
hidden: boolean;
internalApp: boolean;
name: string;
removable: boolean;
url: string;
version: string;
};
export type ExecuteOptions = {
logStdout?: boolean | undefined;
asJson?: boolean | undefined;
asynchronous?: boolean | undefined;
subcommandOptions?: string | string[] | undefined;
timeout?: number | undefined;
};
export type TAsyncOpts = {
asynchronous: true;
};
export type ListFilesOptions = {
/**
* The username of the user we should target. Only relevant for certain domains.
*/
username?: string | undefined;
/**
* A subdirectory within the domain. If not specified, defaults to the root.
*/
subdirectory?: string | undefined;
};
export type PullFileOptions = {
/**
* The username of the user we should target. Only relevant for certain domains.
*/
username?: string | undefined;
/**
* The file service domain. Valid values are: temporary, rootStaging, appDataContainer, appGroupDataContainer,
* systemCrashLogs. You must specify a valid domain and identifier pair. Each domain is accompanied by an identifier
* that provides additional context. For example, if the domain is an app data container, the identifier is the bundle
* ID of the app. For temporary directories and root staging areas, the identifier is a unique client-provided string
* which is used to get your own space, separate from those of other clients.
*/
domainType: string;
/**
* A unique string used to provide additional context to the domain.
*/
domainIdentifier: string;
/**
* The timeout for pulling a file in milliseconds.
*/
timeout?: number | undefined;
};
/**
* An option for launchApp method by devicectl.
*/
export type LaunchAppOptions = {
/**
* Bundle id to Environment variables for the launching app process.
*/
env?: import("@appium/types").StringRecord<string | number> | undefined;
/**
* Whether terminating the already running app.
*/
terminateExisting?: boolean | undefined;
};
//# sourceMappingURL=devicectl.d.ts.map