UNPKG

appium-xcuitest-driver

Version:

Appium driver for iOS using XCUITest for backend

29 lines 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.mobileGetBatteryInfo = mobileGetBatteryInfo; const battery_info_client_1 = require("../device/battery-info-client"); const helpers_1 = require("./helpers"); /** * Reads the battery information from the device under test. * * This endpoint only returns reliable result on real devices. * * @returns Battery information with advanced details */ async function mobileGetBatteryInfo() { let batteryInfoFromShimService = {}; if ((0, helpers_1.isIos18OrNewer)(this.opts) && this.isRealDevice()) { try { batteryInfoFromShimService = await new battery_info_client_1.BatteryInfoClient(this.device.udid).getAdvancedInfo(); } catch (err) { this.log.error(`Failed to get battery info from DiagnosticsService: ${err.message}`); } } const batteryInfoFromWda = await this.proxyCommand('/wda/batteryInfo', 'GET'); return { ...batteryInfoFromWda, advanced: batteryInfoFromShimService, }; } //# sourceMappingURL=battery.js.map