fix launchAndQuit to actually wait for safari dirs if we need them

This commit is contained in:
Jonathan Lipps
2014-06-23 15:01:50 -07:00
parent a18df98f56
commit 11b403e33c
4 changed files with 14 additions and 7 deletions

View File

@@ -526,7 +526,7 @@ IOS.prototype.setLocale = function (cb) {
if ((this.args.language || this.args.locale || this.args.calendarFormat) && this.args.udid === null) {
if (!settings.simDirsExist(this.iOSSDKVersion)) {
this.instantLaunchAndQuit(setLoc);
this.instantLaunchAndQuit(false, setLoc);
} else {
setLoc();
}
@@ -598,18 +598,25 @@ IOS.prototype.setPreferences = function (cb) {
logger.debug("Setting iOS and app preferences");
if (!settings.simDirsExist(this.iOSSDKVersion) ||
(needToSetSafari && !settings.safari7DirsExist(this.iOSSDKVersion))) {
this.instantLaunchAndQuit(setPrefs);
this.instantLaunchAndQuit(needToSetSafari, setPrefs);
} else {
setPrefs();
}
};
IOS.prototype.instantLaunchAndQuit = function (cb) {
IOS.prototype.instantLaunchAndQuit = function (needSafariDirs, cb) {
logger.debug("Sim files for the " + this.iOSSDKVersion + " SDK do not yet exist, launching the sim " +
"to populate the applications and preference dirs");
var condition = function () {
return settings.simDirsExist(this.iOSSDKVersion);
var simDirsExist = settings.simDirsExist(this.iOSSDKVersion);
var safariDirsExist = settings.safari7DirsExist(this.iOSSDKVersion);
var okToGo = simDirsExist && (!needSafariDirs || safariDirsExist);
if (!okToGo) {
logger.debug("We launched the simulator but the required dirs don't " +
"yet exist. Waiting some more...");
}
return okToGo;
}.bind(this);
this.setDeviceAndLaunchSimulator(function (err) {

View File

@@ -142,7 +142,7 @@ var getSafari7Dirs = function (sdk) {
if (safariDir) {
safariDirs.push(safariDir);
} else {
logger.warn("Could not find MobileSafari in sim applications at " +
logger.info("Could not find MobileSafari in sim applications at " +
appsDir);
}
});

View File

@@ -43,7 +43,7 @@
"adm-zip": "~0.4.4",
"appium-adb": "1.2.0",
"appium-atoms": "~0.0.5",
"appium-instruments": "~1.1.1",
"appium-instruments": "~1.1.2",
"appium-uiauto": "~1.2.1",
"argparse": "~0.1.15",
"async": "~0.9.0",