Skip to content

Commit

Permalink
Merge pull request appium#1414 from snevesbarros/fix_1411_null_session
Browse files Browse the repository at this point in the history
fix for 1411: added bundleId to sim build and did safariLauncher flag cleanup
  • Loading branch information
jlipps committed Nov 4, 2013
2 parents 428de35 + 4b362df commit 00cedf5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion lib/appium.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -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() {
Expand Down
3 changes: 1 addition & 2 deletions lib/devices/ios/ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion reset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 00cedf5

Please sign in to comment.