mirror of
https://github.com/appium/appium.git
synced 2026-04-24 20:38:43 -05:00
support pre-launching safari
This commit is contained in:
+14
-10
@@ -64,19 +64,23 @@ Appium.prototype.attachTo = function(rest, cb) {
|
||||
|
||||
Appium.prototype.preLaunch = function(cb) {
|
||||
logger.info("Pre-launching app");
|
||||
if (!this.args.app) {
|
||||
logger.error("Cannot pre-launch app if it isn't passed in via --app");
|
||||
if (!this.args.app && !this.args.safari) {
|
||||
logger.error("Cannot pre-launch app if it isn't passed in via --app or --safari");
|
||||
process.exit();
|
||||
} else {
|
||||
var me = this;
|
||||
var caps = {};
|
||||
this.start(caps, function(err, device) {
|
||||
// since we're prelaunching, it might be a while before the first
|
||||
// command comes in, so let's not have instruments quit on us
|
||||
device.setCommandTimeout(600, function() {
|
||||
me.preLaunched = true;
|
||||
cb(me);
|
||||
});
|
||||
if (err) {
|
||||
cb(err, null);
|
||||
} else {
|
||||
// since we're prelaunching, it might be a while before the first
|
||||
// command comes in, so let's not have instruments quit on us
|
||||
device.setCommandTimeout(600, function() {
|
||||
me.preLaunched = true;
|
||||
cb(null, me);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -198,11 +202,11 @@ Appium.prototype.configure = function(desiredCaps, cb) {
|
||||
logger.warn("Sticking with default app: " + this.args.app);
|
||||
cb(null);
|
||||
}
|
||||
} else if (this.args.safari === true) {
|
||||
this.configureSafari(desiredCaps, cb);
|
||||
} else if (!this.args.app) {
|
||||
cb("No app set; either start appium with --app or pass in an 'app' " +
|
||||
"value in desired capabilities");
|
||||
} else if (this.args.safari === true) {
|
||||
this.configureSafari(desiredCaps, cb);
|
||||
} else {
|
||||
logger.info("Using app from command line: " + this.args.app);
|
||||
cb(null);
|
||||
|
||||
@@ -85,7 +85,13 @@ var main = function(args, readyCb, doneCb) {
|
||||
};
|
||||
if (args.launch) {
|
||||
logger.info("Starting Appium in pre-launch mode".cyan);
|
||||
appiumServer.preLaunch(next);
|
||||
appiumServer.preLaunch(function(err, appiumServer) {
|
||||
if (err) {
|
||||
logger.error("Could not pre-launch appium: " + err);
|
||||
} else {
|
||||
next(appiumServer);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
next(appiumServer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user