From cd69e64ca71617d370e3884d0d098abaeecf8066 Mon Sep 17 00:00:00 2001 From: sebv Date: Fri, 4 Jul 2014 22:26:38 +0800 Subject: [PATCH] deviceString improvements --- lib/devices/ios/ios.js | 26 ++++++++++++++++++++++---- submodules/appium-instruments | 2 +- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/lib/devices/ios/ios.js b/lib/devices/ios/ios.js index a5f8024c5..deb460798 100644 --- a/lib/devices/ios/ios.js +++ b/lib/devices/ios/ios.js @@ -830,14 +830,20 @@ IOS.prototype.getDeviceString = function () { var isTall = isiPhone; var isRetina = this.xcodeVersion[0] !== '4'; var is64bit = false; - if (this.args.deviceName) { - var device = this.args.deviceName.toLowerCase(); + var deviceName = this.args.deviceName; + var fixDevice = true; + if (deviceName && deviceName[0] === '='){ + deviceName = deviceName.substring(1); + fixDevice = false; + } + if (deviceName) { + var device = deviceName.toLowerCase(); if (device.indexOf("iphone") !== -1) { isiPhone = true; } else if (device.indexOf("ipad") !== -1) { isiPhone = false; } - if (this.args.deviceName !== this.args.platformName) { + if (deviceName !== this.args.platformName) { isTall = isiPhone && (device.indexOf("4-inch") !== -1); isRetina = (device.indexOf("retina") !== -1); is64bit = (device.indexOf("64-bit") !== -1); @@ -856,7 +862,7 @@ IOS.prototype.getDeviceString = function () { if (isiPhone) { if (isRetina && isTall) { iosDeviceString += is64bit ? " (4-inch 64-bit)" : " (4-inch)"; - } else if (this.args.deviceName.toLowerCase().indexOf("3.5") !== -1) { + } else if (deviceName.toLowerCase().indexOf("3.5") !== -1) { iosDeviceString += " (3.5-inch)"; } } else { @@ -867,6 +873,18 @@ IOS.prototype.getDeviceString = function () { iosDeviceString += " - Simulator - iOS " + (this.args.platformVersion || this.iOSSDKVersion); } + if (fixDevice) { + // Some device config are broken in 5.1 + var CONFIG_FIX = { + 'iPhone - Simulator - iOS 7.1': 'iPhone Retina (4-inch 64-bit) - Simulator - iOS 7.1', + 'iPad - Simulator - iOS 7.1': 'iPad Retina (64-bit) - Simulator - iOS 7.1' + }; + if (CONFIG_FIX[iosDeviceString]) { + iosDeviceString = CONFIG_FIX[iosDeviceString]; + logger.debug("Fixing device was changed from:\"", iosDeviceString, "\" to:\"", + CONFIG_FIX[iosDeviceString] + "\""); + } + } return iosDeviceString; }; diff --git a/submodules/appium-instruments b/submodules/appium-instruments index f4838f4e3..b6742230e 160000 --- a/submodules/appium-instruments +++ b/submodules/appium-instruments @@ -1 +1 @@ -Subproject commit f4838f4e333630b52f815aa5a521a015bad558ba +Subproject commit b6742230ea83672e8c4627b2ec5eec3b33861025