appium-uiautomator2-driver
Version:
UiAutomator2 integration for Appium
47 lines • 2.1 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.mobileInstallMultipleApks = mobileInstallMultipleApks;
exports.mobileBackgroundApp = mobileBackgroundApp;
const lodash_1 = __importDefault(require("lodash"));
const bluebird_1 = __importDefault(require("bluebird"));
const driver_1 = require("appium/driver");
const extensions_1 = require("../extensions");
/**
* Install multiple APKs with `install-multiple` option.
* @this {AndroidUiautomator2Driver}
* @param {string[]} apks The list of APKs to install. Each APK should be a path to a apk
* or downloadable URL as HTTP/HTTPS.
* @param {import('./types').InstallOptions} [options] Installation options.
* @throws {Error} if an error occured while installing the given APKs.
* @returns {Promise<void>}
*/
async function mobileInstallMultipleApks(apks, options) {
if (!lodash_1.default.isArray(apks) || lodash_1.default.isEmpty(apks)) {
throw new driver_1.errors.InvalidArgumentError('No apks are given to install');
}
const configuredApks = await bluebird_1.default.all(apks.map((app) => this.helpers.configureApp(app, [extensions_1.APK_EXTENSION])));
await this.adb.installMultipleApks(configuredApks, options);
}
/**
* Puts the app to background and waits the given number of seconds then restores the app
* if necessary. The call is blocking.
*
* @this {AndroidUiautomator2Driver}
* @param {number} [seconds=-1] The amount of seconds to wait between putting the app to background and restoring it.
* Any negative value means to not restore the app after putting it to background.
* @returns {Promise<void>}
*/
async function mobileBackgroundApp(seconds = -1) {
await this.background(seconds);
}
/**
* @typedef {import('../driver').AndroidUiautomator2Driver} AndroidUiautomator2Driver
*/
/**
* @template [T=any]
* @typedef {import('@appium/types').StringRecord<T>} StringRecord
*/
//# sourceMappingURL=app-management.js.map