appium-xcuitest-driver
Version:
Appium driver for iOS using XCUITest for backend
66 lines • 2.86 kB
TypeScript
import type { XCUITestDriver } from '../driver';
import type { LogEntry, LogListener } from './types';
import type { LogDefRecord } from '@appium/types';
import type { EventEmitter } from 'node:events';
type XCUITestDriverLogTypes = keyof typeof SUPPORTED_LOG_TYPES;
interface BiDiListenerProperties {
type: string;
srcEventName?: string;
context?: string;
entryTransformer?: (x: any) => LogEntry;
}
/**
* @privateRemarks The return types for these getters should be specified
*/
declare const SUPPORTED_LOG_TYPES: LogDefRecord;
export declare const supportedLogTypes: LogDefRecord;
/**
* Extracts logs of the specified type from the logs container.
*
* @param logType - The type of log to extract
* @param logsContainer - Container holding log objects
* @returns The extracted logs
* @throws {Error} If logs are not available or the log type is not found
*/
export declare function extractLogs(this: XCUITestDriver, logType: XCUITestDriverLogTypes, logsContainer?: Partial<Record<XCUITestDriverLogTypes, {
getLogs(): Promise<any>;
}>>): Promise<any>;
/**
* Starts capturing iOS system logs.
*
* Initializes and starts capturing syslog and crashlog. Optionally starts Safari console and network logs
* if the corresponding capabilities are enabled.
*
* @returns `true` if syslog capture started successfully; `false` otherwise
*/
export declare function startLogCapture(this: XCUITestDriver): Promise<boolean>;
/**
* Starts an iOS system logs broadcast websocket.
*
* The websocket listens on the same host and port as Appium. The endpoint created is `/ws/session/:sessionId:/appium/syslog`.
*
* If the websocket is already running, this command does nothing.
*
* Each connected websocket listener will receive syslog lines as soon as they are visible to Appium.
* @see https://appiumpro.com/editions/55-using-mobile-execution-commands-to-continuously-stream-device-logs-with-appium
*/
export declare function mobileStartLogsBroadcast(this: XCUITestDriver): Promise<void>;
/**
* Stops the syslog broadcasting websocket server previously started by `mobile: startLogsBroadcast`.
*
* If no websocket server is running, this command does nothing.
*/
export declare function mobileStopLogsBroadcast(this: XCUITestDriver): Promise<void>;
/**
* Assigns a BiDi log listener to the given log emitter.
*
* https://w3c.github.io/webdriver-bidi/#event-log-entryAdded
*
* @template EE extends EventEmitter
* @param logEmitter - The event emitter to attach the listener to
* @param properties - Configuration for the BiDi listener
* @returns A tuple containing the log emitter and the listener function
*/
export declare function assignBiDiLogListener<EE extends EventEmitter>(this: XCUITestDriver, logEmitter: EE, properties: BiDiListenerProperties): [EE, LogListener];
export {};
//# sourceMappingURL=log.d.ts.map