UNPKG

appium-android-driver

Version:

Android UiAutomator and Chrome support for Appium

194 lines 6.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fingerprint = fingerprint; exports.mobileFingerprint = mobileFingerprint; exports.sendSMS = sendSMS; exports.mobileSendSms = mobileSendSms; exports.gsmCall = gsmCall; exports.mobileGsmCall = mobileGsmCall; exports.gsmSignal = gsmSignal; exports.mobileGsmSignal = mobileGsmSignal; exports.gsmVoice = gsmVoice; exports.mobileGsmVoice = mobileGsmVoice; exports.powerAC = powerAC; exports.mobilePowerAc = mobilePowerAc; exports.powerCapacity = powerCapacity; exports.mobilePowerCapacity = mobilePowerCapacity; exports.networkSpeed = networkSpeed; exports.mobileNetworkSpeed = mobileNetworkSpeed; exports.sensorSet = sensorSet; const support_1 = require("@appium/support"); const utils_1 = require("./utils"); const driver_1 = require("appium/driver"); /** * @deprecated Use mobile: extension * @this {import('../../driver').AndroidDriver} * @param {string|number} fingerprintId * @returns {Promise<void>} */ async function fingerprint(fingerprintId) { utils_1.requireEmulator.bind(this)('fingerprint is only available for emulators'); await this.adb.fingerprint(String(fingerprintId)); } /** * @this {import('../../driver').AndroidDriver} * @param {string | number} fingerprintId The value is the `finger_id` for the finger that was "scanned". It is a * unique integer that you assign for each virtual fingerprint. When the app * is running you can run this same command each time the emulator prompts you * for a fingerprint, you can run the adb command and pass it the `finger_id` * to simulate the fingerprint scan. * @returns {Promise<void>} */ async function mobileFingerprint(fingerprintId) { await this.fingerprint(fingerprintId); } /** * @deprecated Use mobile: extension * @this {import('../../driver').AndroidDriver} * @param {string} phoneNumber * @param {string} message * @returns {Promise<void>} */ async function sendSMS(phoneNumber, message) { utils_1.requireEmulator.bind(this)('sendSMS is only available for emulators'); await this.adb.sendSMS(phoneNumber, message); } /** * @this {import('../../driver').AndroidDriver} * @param {string} phoneNumber The phone number to send SMS to * @param {string} message The message payload * @returns {Promise<void>} */ async function mobileSendSms(phoneNumber, message) { await this.sendSMS(phoneNumber, message); } /** * @deprecated Use mobile: extension * @this {import('../../driver').AndroidDriver} * @param {string} phoneNumber * @param {string} action * @returns {Promise<void>} */ async function gsmCall(phoneNumber, action) { utils_1.requireEmulator.bind(this)('gsmCall is only available for emulators'); await this.adb.gsmCall(phoneNumber, /** @type {any} */ (action)); } /** * @this {import('../../driver').AndroidDriver} * @param {string} phoneNumber The phone number to call to * @param {import('../types').GsmAction} action Action to take * @returns {Promise<void>} */ async function mobileGsmCall(phoneNumber, action) { await this.gsmCall(phoneNumber, action); } /** * @deprecated Use mobile: extension * @this {import('../../driver').AndroidDriver} * @param {import('../types').GsmSignalStrength} signalStrengh * @returns {Promise<void>} */ async function gsmSignal(signalStrengh) { utils_1.requireEmulator.bind(this)('gsmSignal is only available for emulators'); await this.adb.gsmSignal(signalStrengh); } /** * @this {import('../../driver').AndroidDriver} * @param {import('../types').GsmSignalStrength} strength The signal strength value * @returns {Promise<void>} */ async function mobileGsmSignal(strength) { await this.gsmSignal(strength); } /** * @deprecated Use mobile: extension * @this {import('../../driver').AndroidDriver} * @param {import('../types').GsmVoiceState} state * @returns {Promise<void>} */ async function gsmVoice(state) { utils_1.requireEmulator.bind(this)('gsmVoice is only available for emulators'); await this.adb.gsmVoice(state); } /** * @this {import('../../driver').AndroidDriver} * @param {import('../types').GsmVoiceState} state * @returns {Promise<void>} */ async function mobileGsmVoice(state) { await this.gsmVoice(state); } /** * @deprecated Use mobile: extension * @this {import('../../driver').AndroidDriver} * @param {import('../types').PowerACState} state * @returns {Promise<void>} */ async function powerAC(state) { utils_1.requireEmulator.bind(this)('powerAC is only available for emulators'); await this.adb.powerAC(state); } /** * @this {import('../../driver').AndroidDriver} * @param {import('../types').PowerACState} state * @returns {Promise<void>} */ async function mobilePowerAc(state) { await this.powerAC(state); } /** * @deprecated Use mobile: extension * @this {import('../../driver').AndroidDriver} * @param {number} batteryPercent * @returns {Promise<void>} */ async function powerCapacity(batteryPercent) { utils_1.requireEmulator.bind(this)('powerCapacity is only available for emulators'); await this.adb.powerCapacity(batteryPercent); } /** * @this {import('../../driver').AndroidDriver} * @param {number} percent Percentage value in range `[0, 100]` * @return {Promise<void>} */ async function mobilePowerCapacity(percent) { await this.powerCapacity(percent); } /** * @deprecated Use mobile: extension * @this {import('../../driver').AndroidDriver} * @param {import('../types').NetworkSpeed} networkSpeed * @returns {Promise<void>} */ async function networkSpeed(networkSpeed) { utils_1.requireEmulator.bind(this)('networkSpeed is only available for emulators'); await this.adb.networkSpeed(networkSpeed); } /** * @this {import('../../driver').AndroidDriver} * @param {import('../types').NetworkSpeed} speed * @returns {Promise<void>} */ async function mobileNetworkSpeed(speed) { await this.networkSpeed(speed); } /** * @this {import('../../driver').AndroidDriver} * @param {string} sensorType Sensor type as declared in `adb.SENSORS` * @param {string} value Value to set to the sensor * @returns {Promise<void>} */ async function sensorSet(sensorType, value) { utils_1.requireEmulator.bind(this)('sensorSet is only available for emulators'); if (!support_1.util.hasValue(sensorType)) { throw new driver_1.errors.InvalidArgumentError(`'sensorType' argument is required`); } if (!support_1.util.hasValue(value)) { throw new driver_1.errors.InvalidArgumentError(`'value' argument is required`); } await this.adb.sensorSet(sensorType, /** @type {any} */ (value)); } /** * @typedef {import('appium-adb').ADB} ADB */ //# sourceMappingURL=emulator-actions.js.map