appium-xcuitest-driver
Version:
Appium driver for iOS using XCUITest for backend
68 lines • 3.26 kB
TypeScript
import type { AppiumLogger } from '@appium/types';
import type { RemoteXPCFacade } from './remote-xpc';
/** Options for {@link DeviceConnectionsFactory.requestConnection}. */
interface RequestConnectionOptions {
usePortForwarding?: boolean;
devicePort?: number | null;
remoteXPCFacade?: RemoteXPCFacade | null;
}
/**
* Manages cached local device connections and optional TCP port forwarding to real iOS devices.
*
* Forwarding may use `appium-ios-remotexpc` on iOS 18+ (usbmux or tunnel) with fallback to
* `appium-ios-device` {@linkcode utilities.connectPort}
*/
export declare class DeviceConnectionsFactory {
private readonly log;
/** Shared across factory instances so parallel sessions coordinate the same local ports. */
private static _connectionsMapping;
/**
* @param log - Logger for this factory
*/
constructor(log: AppiumLogger);
/**
* Lists cache keys (`udid:localPort`) matching the given filters.
*
* @param udid - If set, only keys whose UDID prefix matches
* @param port - If set, only keys whose local port suffix matches
* @param strict - If true and both `udid` and `port` are set, only the exact `udid:port` key;
* otherwise keys matching either filter are included
* @returns Matching connection keys (empty if both `udid` and `port` are omitted)
*/
listConnections(udid?: string | null, port?: number | null, strict?: boolean): string[];
/**
* Registers a connection for the device, optionally starting local TCP forwarding to `devicePort`.
*
* When `usePortForwarding` is true, ensures the local port is free (may release stale forwarders)
* then starts forwarding. When false, only records an empty cache entry for the key.
*
* @param udid - Device UDID
* @param port - Local port on the host
* @param options - Forwarding options; `devicePort` is used when `usePortForwarding` is true
* (eligible RemoteXPC sessions may use tunnel/usbmux forwarding; otherwise legacy applies)
* @throws If `usePortForwarding` is true but `devicePort` is not an integer
* @throws If the local port is still in use after attempting cleanup
*/
requestConnection(udid?: string | null, port?: number | null, options?: RequestConnectionOptions): Promise<void>;
/**
* Removes matching entries from the cache and stops any associated port forwarders.
*
* @param udid - If set, only connections for this device; use with `port` for a single exact key
* @param port - If set, only connections on this local port
*/
releaseConnection(udid?: string | null, port?: number | null): Promise<void>;
private _warnMissingRequestConnectionParams;
private _ensureForwardingPortIsFree;
private _startAndRegisterPortForwarder;
private _udidAsToken;
private _portAsToken;
private _toKey;
/**
* Stops forwarders for the given keys. Snapshots `portForwarder` references before any `await`
* so `releaseConnection` can delete mapping entries only after stops complete (no stale reads).
*/
private _releaseProxiedConnections;
private _createPortForwarder;
}
export {};
//# sourceMappingURL=device-connections-factory.d.ts.map