appium-android-driver
Version:
Android UiAutomator and Chrome support for Appium
166 lines • 5.25 kB
JavaScript
;
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
*/
async function fingerprint(fingerprintId) {
utils_1.requireEmulator.bind(this)('fingerprint is only available for emulators');
await this.adb.fingerprint(String(fingerprintId));
}
/**
* Simulates a fingerprint scan on the emulator.
*
* @param 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.
*/
async function mobileFingerprint(fingerprintId) {
await this.fingerprint(fingerprintId);
}
/**
* @deprecated Use mobile: extension
*/
async function sendSMS(phoneNumber, message) {
utils_1.requireEmulator.bind(this)('sendSMS is only available for emulators');
await this.adb.sendSMS(phoneNumber, message);
}
/**
* Sends an SMS message to the emulator.
*
* @param phoneNumber - The phone number to send SMS to
* @param message - The message payload
*/
async function mobileSendSms(phoneNumber, message) {
await this.sendSMS(phoneNumber, message);
}
/**
* @deprecated Use mobile: extension
*/
async function gsmCall(phoneNumber, action) {
utils_1.requireEmulator.bind(this)('gsmCall is only available for emulators');
await this.adb.gsmCall(phoneNumber, action);
}
/**
* Simulates a GSM call on the emulator.
*
* @param phoneNumber - The phone number to call to
* @param action - Action to take
*/
async function mobileGsmCall(phoneNumber, action) {
await this.gsmCall(phoneNumber, action);
}
/**
* @deprecated Use mobile: extension
*/
async function gsmSignal(signalStrength) {
utils_1.requireEmulator.bind(this)('gsmSignal is only available for emulators');
await this.adb.gsmSignal(signalStrength);
}
/**
* Sets the GSM signal strength on the emulator.
*
* @param strength - The signal strength value
*/
async function mobileGsmSignal(strength) {
await this.gsmSignal(strength);
}
/**
* @deprecated Use mobile: extension
*/
async function gsmVoice(state) {
utils_1.requireEmulator.bind(this)('gsmVoice is only available for emulators');
await this.adb.gsmVoice(state);
}
/**
* Sets the GSM voice state on the emulator.
*
* @param state - The voice state
*/
async function mobileGsmVoice(state) {
await this.gsmVoice(state);
}
/**
* @deprecated Use mobile: extension
*/
async function powerAC(state) {
utils_1.requireEmulator.bind(this)('powerAC is only available for emulators');
await this.adb.powerAC(state);
}
/**
* Sets the power AC state on the emulator.
*
* @param state - The AC power state
*/
async function mobilePowerAc(state) {
await this.powerAC(state);
}
/**
* @deprecated Use mobile: extension
*/
async function powerCapacity(batteryPercent) {
utils_1.requireEmulator.bind(this)('powerCapacity is only available for emulators');
await this.adb.powerCapacity(batteryPercent);
}
/**
* Sets the battery capacity on the emulator.
*
* @param percent - Percentage value in range `[0, 100]`
*/
async function mobilePowerCapacity(percent) {
await this.powerCapacity(percent);
}
/**
* @deprecated Use mobile: extension
*/
async function networkSpeed(networkSpeed) {
utils_1.requireEmulator.bind(this)('networkSpeed is only available for emulators');
await this.adb.networkSpeed(networkSpeed);
}
/**
* Sets the network speed on the emulator.
*
* @param speed - The network speed value
*/
async function mobileNetworkSpeed(speed) {
await this.networkSpeed(speed);
}
/**
* Sets a sensor value on the emulator.
*
* @param sensorType - Sensor type as declared in `adb.SENSORS`
* @param value - Value to set to the sensor
* @throws {errors.InvalidArgumentError} If sensorType or value is not provided
*/
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, value);
}
//# sourceMappingURL=emulator-actions.js.map