UNPKG

appium-flutter-driver

Version:
57 lines 2.79 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createSession = exports.reConnectFlutterDriver = void 0; const lodash_1 = __importDefault(require("lodash")); const android_1 = require("./android"); const ios_1 = require("./ios"); const platform_1 = require("../platform"); const reConnectFlutterDriver = async function (caps) { // setup proxies - if platformName is not empty, make it less case sensitive if (!caps.platformName) { this.log.errorAndThrow(`No platformName was given`); } switch (lodash_1.default.toLower(caps.platformName)) { case platform_1.PLATFORM.IOS: this.socket = await (0, ios_1.connectIOSSession)(this, this.proxydriver, caps); break; case platform_1.PLATFORM.ANDROID: this.socket = await (0, android_1.connectAndroidSession)(this, this.proxydriver, caps); break; default: this.log.errorAndThrow(`Unsupported platformName: ${caps.platformName}. ` + `Only the following platforms are supported: ${lodash_1.default.keys(platform_1.PLATFORM)}`); } }; exports.reConnectFlutterDriver = reConnectFlutterDriver; const createSession = async function (sessionId, caps, ...args) { try { // setup proxies - if platformName is not empty, make it less case sensitive switch (lodash_1.default.toLower(caps.platformName)) { case platform_1.PLATFORM.IOS: [this.proxydriver, this.socket] = await (0, ios_1.startIOSSession)(this, caps, ...args); this.proxydriver.relaxedSecurityEnabled = this.relaxedSecurityEnabled; this.proxydriver.denyInsecure = this.denyInsecure; this.proxydriver.allowInsecure = this.allowInsecure; break; case platform_1.PLATFORM.ANDROID: [this.proxydriver, this.socket] = await (0, android_1.startAndroidSession)(this, caps, ...args); this.proxydriver.relaxedSecurityEnabled = this.relaxedSecurityEnabled; this.proxydriver.denyInsecure = this.denyInsecure; this.proxydriver.allowInsecure = this.allowInsecure; break; default: this.log.errorAndThrow(`Unsupported platformName: ${caps.platformName}. ` + `Only the following platforms are supported: ${lodash_1.default.keys(platform_1.PLATFORM)}`); } return [sessionId, this.opts]; } catch (e) { await this.deleteSession(); throw e; } }; exports.createSession = createSession; //# sourceMappingURL=session.js.map