appium-xcuitest-driver
Version:
Appium driver for iOS using XCUITest for backend
81 lines • 4.17 kB
TypeScript
import type { AppiumLogger } from '@appium/types';
import type * as RemoteXPCModule from 'appium-ios-remotexpc';
export type RemoteXPCEsmModule = typeof RemoteXPCModule;
export type RemoteXPCServices = RemoteXPCEsmModule['Services'];
export type RemoteXPCTestRunner = RemoteXPCEsmModule['XCTestRunner'];
/** Published driver guide for Remote XPC tunnel setup on real devices (iOS/tvOS 18+). */
export declare const REMOTE_XPC_TUNNEL_SETUP_DOC_LINK = "https://appium.github.io/appium-xcuitest-driver/latest/guides/remotexpc-tunnels-real-devices/";
/** Driver script that starts the tunnel registry (must run with sudo/root). */
export declare const TUNNEL_CREATION_COMMAND = "sudo appium driver run xcuitest tunnel-creation";
/**
* Whether the given error means RemoteXPC tunnel infrastructure is unavailable.
*/
export declare function isTunnelAvailabilityError(err: unknown): boolean;
/**
* User-facing message for tunnel registry / tunnel-entry failures from appium-ios-remotexpc.
*/
export declare function formatTunnelAvailabilityMessage(err: unknown): string;
/**
* Wraps a RemoteXPC connection error with tunnel setup guidance when the cause is tunnel-related.
*/
export declare function wrapRemoteXPCConnectionError(err: unknown, context: string): Error;
/**
* Log line when an optional RemoteXPC feature falls back after a connection failure.
*/
export declare function formatRemoteXPCFallbackLog(feature: string, err: unknown): string;
/**
* Get the RemoteXPC Services module dynamically
*
* This helper centralizes the import of appium-ios-remotexpc to:
* - Provide consistent error handling across all services
* - Give helpful installation instructions when the module is missing
*
* @returns The Services export from appium-ios-remotexpc
* @throws {Error} If the module cannot be imported
*/
export declare function getRemoteXPCServices(): Promise<RemoteXPCServices>;
/**
* Try to load appium-ios-remotexpc without throwing (e.g. for optional features).
* Successful loads share the same cache as {@link getRemoteXPCServices}.
*
* If the package is **not installed** (resolution error for **appium-ios-remotexpc**), subsequent
* calls return `null` without re-importing. Other import failures are recorded via
* {@link getLastRemoteXPCOptionalImportError} and **do not** permanently disable retries.
*/
export declare function tryGetRemoteXPCServices(): Promise<RemoteXPCServices | null>;
/**
* Whether {@link tryGetRemoteXPCServices} has determined that **appium-ios-remotexpc** is not
* installed (same process will not retry optional import).
*/
export declare function isRemoteXPCOptionalDependencyMissing(): boolean;
/**
* Last error from an optional RemoteXPC `import()`, including transient failures. Cleared when a
* load succeeds. When {@link isRemoteXPCOptionalDependencyMissing} is `true`, this matches the
* stored missing-package error.
*/
export declare function getLastRemoteXPCOptionalImportError(): Error | null;
/**
* Full **appium-ios-remotexpc** module after a successful optional load (same `import()` as
* {@link tryGetRemoteXPCServices}). Returns `null` if the package is missing or failed to load.
*/
export declare function tryGetRemoteXPCModule(): Promise<RemoteXPCEsmModule | null>;
/**
* Optional load of **appium-ios-remotexpc** (shared cache) plus the USBMUX vs tunnel branch hint:
* whether `udid` appears in the usbmux device list. Used by lockdown and port forwarding so they
* do not duplicate `import()` + {@link isDeviceListedInUsbmux}.
*
* @returns `null` if the module is not available; otherwise the module and whether to use the
* USBMUX-oriented APIs (`createLockdownServiceByUDID`, `connectViaUsbmux`, …).
*/
export declare function tryGetRemoteXPCUsbMuxStrategy(udid: string, log: AppiumLogger): Promise<{
remotexpc: RemoteXPCEsmModule;
useUsbMuxPath: boolean;
} | null>;
/**
* Get the XCTestRunner class dynamically from appium-ios-remotexpc
*
* @returns The XCTestRunner class
* @throws {Error} If the module cannot be imported
*/
export declare function getXCTestRunnerClass(): Promise<RemoteXPCTestRunner>;
//# sourceMappingURL=remotexpc-utils.d.ts.map