appium-flutter-driver
Version:
Appium Flutter driver
28 lines • 1.21 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.launchApp = void 0;
const appium_ios_device_1 = require("appium-ios-device");
const logger_1 = require("./../logger");
/**
* Launch the given bundle id via instrument service.
*/
const launchApp = async (udid, bundleId, args = [], env = {}) => {
let instrumentService;
try {
instrumentService = await appium_ios_device_1.services.startInstrumentService(udid);
logger_1.log.info(`Launching app ${bundleId} with arguments ${JSON.stringify(args)} and env ${JSON.stringify(env)} on device ${udid}`);
await instrumentService.callChannel(appium_ios_device_1.INSTRUMENT_CHANNEL.PROCESS_CONTROL, 'launchSuspendedProcessWithDevicePath:bundleIdentifier:environment:arguments:options:', '', bundleId, env, args, { StartSuspendedKey: 0, KillExisting: 1 });
return true;
}
catch (err) {
logger_1.log.warn(`Failed to launch '${bundleId}'. Original error: ${err.stderr || err.message}`);
return false;
}
finally {
if (instrumentService) {
instrumentService.close();
}
}
};
exports.launchApp = launchApp;
//# sourceMappingURL=app.js.map