appium-xcuitest-driver
Version:
Appium driver for iOS using XCUITest for backend
67 lines • 2.98 kB
TypeScript
import type { AppiumLogger } from '@appium/types';
import type { Simulator } from 'appium-ios-simulator';
import type { LogEntry } from '../../commands/types';
import type { RemoteXPCFacade } from '../remote-xpc';
import { IOSLog } from './ios-log';
/**
* Options for {@link IOSCrashLog}.
*/
export interface IOSCrashLogOptions {
/** UDID of a real device (omit with `sim` for Simulator crash logs). */
udid?: string;
/** Simulator instance; required for simulator-side collection. */
sim?: Simulator;
log: AppiumLogger;
/**
* For real devices: per-session RemoteXPC facade for {@link CrashReportsClient}.
*/
remoteXPCFacade?: RemoteXPCFacade | null;
}
type TSerializedEntry = [string, number];
/**
* Collects iOS/tvOS crash logs for BiDi `log.entryAdded` / classic log APIs.
*
* - **Simulator:** reads `~/Library/Logs/DiagnosticReports` and filters by simulator UDID.
* - **Real device:** uses RemoteXPC (`appium-ios-remotexpc`) when `useRemoteXPC` is true; if the client
* cannot be created, collection is skipped and errors are logged (no session failure).
*/
export declare class IOSCrashLog extends IOSLog<TSerializedEntry, TSerializedEntry> {
private readonly _udid;
private readonly _remoteXPCFacade;
private _realDeviceClient;
private readonly _logDir;
private readonly _sim;
private _recentCrashFiles;
private _started;
/**
* @param opts - Provide `udid` for a real device or `sim` for a Simulator (mutually exclusive by usage).
*/
constructor(opts: IOSCrashLogOptions);
get isCapturing(): boolean;
/** Records the current crash file snapshot so only new reports appear in {@link IOSCrashLog.getLogs}. */
startCapture(): Promise<void>;
/** Stops polling and closes any real-device {@link CrashReportsClient}. */
stopCapture(): Promise<void>;
/**
* @returns New crash log entries since the last successful poll (bounded by {@link MAX_RECENT_ITEMS}).
*/
getLogs(): Promise<LogEntry[]>;
protected _serializeEntry(value: TSerializedEntry): TSerializedEntry;
protected _deserializeEntry(value: TSerializedEntry): LogEntry;
/** Reads crash file contents and {@link IOSLog.broadcast}s them as `[text, mtime]` tuples. */
private _serializeCrashes;
/**
* Lazily creates a {@link CrashReportsClient} and lists `.ips` basenames on the device.
*
* @returns Empty array if RemoteXPC setup or listing fails (logged). The client is reset after
* listing errors so a later poll can recreate it. Never throws to callers.
*/
private _gatherFromRealDevice;
/** Glob diagnostic reports and keep files whose content references the simulator UDID. */
private _gatherFromSimulator;
/** Dispatches to real-device RemoteXPC listing or simulator filesystem globbing. */
private _listCrashFiles;
private _isRealDevice;
}
export default IOSCrashLog;
//# sourceMappingURL=ios-crash-log.d.ts.map