UNPKG

appium-xcuitest-driver

Version:

Appium driver for iOS using XCUITest for backend

40 lines 1.51 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IOSPerformanceLog = void 0; const utils_1 = require("../../utils"); const helpers_1 = require("./helpers"); const line_consuming_log_1 = require("./line-consuming-log"); class IOSPerformanceLog extends line_consuming_log_1.LineConsumingLog { remoteDebugger; _started; constructor(opts) { super({ maxBufferSize: opts.maxEvents ?? helpers_1.MAX_BUFFERED_EVENTS_COUNT, log: opts.log, }); this.remoteDebugger = opts.remoteDebugger; this._started = false; } get isCapturing() { return this._started; } async startCapture() { this.log.debug('Starting performance (Timeline) log capture'); this._clearEntries(); await this.remoteDebugger.startTimeline(this.onTimelineEvent.bind(this)); this._started = true; } async stopCapture() { this.log.debug('Stopping performance (Timeline) log capture'); await this.remoteDebugger.stopTimeline(); this._started = false; } onTimelineEvent(event) { const serializedEntry = JSON.stringify(event); this.broadcast(serializedEntry); this.log.debug(`Received Timeline event: ${(0, utils_1.truncateString)(serializedEntry, { length: helpers_1.MAX_JSON_LOG_LENGTH })}`); } } exports.IOSPerformanceLog = IOSPerformanceLog; exports.default = IOSPerformanceLog; //# sourceMappingURL=ios-performance-log.js.map