UNPKG

gst-atom-xcuitest-driver

Version:

ATOM driver for iOS using XCUITest for backend

52 lines (43 loc) 1.04 kB
import { logger } from 'appium-support'; import { IOSLog } from './ios-log'; import { services } from 'gst-atom-ios-device'; const log = logger.getLogger('IOSDeviceLog'); class IOSDeviceLog extends IOSLog { constructor (opts) { super(); this.udid = opts.udid; this.showLogs = !!opts.showLogs; this.service = null; this.opts = opts; } async startCapture () { if (this.service) { return; } var options = { udid: this.udid, usbmuxdRemoteHost: this.opts.usbmuxdRemoteHost, usbmuxdRemotePort: this.opts.usbmuxdRemotePort }; this.service = await services.startSyslogService(options); this.service.start(this.onLog.bind(this)); } onLog (logLine) { this.broadcast(logLine); if (this.showLogs) { log.info(logLine); } } get isCapturing () { return !!this.service; } stopCapture () { if (!this.service) { return; } this.service.close(); this.service = null; } } export { IOSDeviceLog }; export default IOSDeviceLog;