From 4b362df4d07ea8cae39859821cda341513ea57cd Mon Sep 17 00:00:00 2001 From: Sergio Neves Barros Date: Mon, 4 Nov 2013 18:28:22 +0000 Subject: [PATCH] Added bundleId for simulator build and did a cleanup for isSafariLauncherApp flag --- lib/appium.js | 6 +++++- lib/devices/ios/ios.js | 3 +-- reset.sh | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/appium.js b/lib/appium.js index 3d344e2e858..f0c8e39400e 100644 --- a/lib/appium.js +++ b/lib/appium.js @@ -40,6 +40,7 @@ var Appium = function(args) { this.commandTimeoutMs = this.defCommandTimeoutMs; this.origCommandTimeoutMs = this.commandTimeoutMs; this.commandTimeout = null; + this.isSafariLauncherApp = false; }; Appium.prototype.attachTo = function(rest, cb) { @@ -244,10 +245,12 @@ Appium.prototype.configureApp = function(desiredCaps, hasAppInCaps, cb) { } else if (this.isIos() && appPath.toLowerCase() === "safari") { if (this.args.udid) { this.desiredCapabilities.safari = true; + this.isSafariLauncherApp = true; this.configureLocalApp("./build/SafariLauncher/SafariLauncher.zip", origin, cb); } else { if (parseFloat(this.desiredCapabilities.version) >= 7) { this.configureSafariForLauncher(desiredCaps, function() { + this.isSafariLauncherApp = true; this.configureLocalApp("./build/SafariLauncher/SafariLauncherSim.zip", origin, cb); }.bind(this)); } else { @@ -527,6 +530,7 @@ Appium.prototype.initDevice = function() { , startingOrientation: this.desiredCapabilities.deviceOrientation || this.args.orientation , robotPort: this.args.robotPort , robotAddress: this.args.robotAddress + , isSafariLauncherApp: this.isSafariLauncherApp }; this.device = ios(iosOpts); } else if (this.isAndroid()) { @@ -657,7 +661,7 @@ Appium.prototype.stop = function(cb) { } logger.info('Shutting down appium session...'); - if (this.device.isSafariLauncherApp === true) { + if (this.isSafariLauncherApp === true) { this.device.leaveWebView(function() { if (this.device.udid === null) { this.device.instruments.shutdown(function() { diff --git a/lib/devices/ios/ios.js b/lib/devices/ios/ios.js index ff89da0530b..f4572aeef4c 100644 --- a/lib/devices/ios/ios.js +++ b/lib/devices/ios/ios.js @@ -63,8 +63,7 @@ var IOS = function(args) { this.onPageChangeCb = null; this.useRobot = args.robotPort > 0; this.robotUrl = this.useRobot ? "http://" + args.robotAddress + ":" + args.robotPort + "" : null; - var safariLauncherAppName = "/safarilauncher.app"; - this.isSafariLauncherApp = args.app !== null && (typeof args.app !== "undefined") && (args.app.toLowerCase().indexOf(safariLauncherAppName, args.app.length - safariLauncherAppName.length) !== -1); + this.isSafariLauncherApp = args.isSafariLauncherApp; this.capabilities = { version: '6.0' , webStorageEnabled: false diff --git a/reset.sh b/reset.sh index c82a9b3db68..33fc75983dd 100755 --- a/reset.sh +++ b/reset.sh @@ -160,7 +160,9 @@ reset_ios() { echo "* Cloning/updating SafariLauncher" run_cmd git submodule update --init submodules/SafariLauncher echo "* Building SafariLauncher" - run_cmd $grunt buildSafariLauncherApp:iphonesimulator + run_cmd rm -f submodules/Safarilauncher/target.xcconfig + echo "BUNDLE_ID = com.bytearc.SafariLauncher" >> submodules/Safarilauncher/target.xcconfig + run_cmd $grunt buildSafariLauncherApp:iphonesimulator:"target.xcconfig" echo "* Copying SafariLauncher to build" run_cmd rm -rf build/SafariLauncher run_cmd mkdir -p build/SafariLauncher