diff --git a/docs/server-args.md b/docs/server-args.md index ffc680d07..d305a4b0d 100644 --- a/docs/server-args.md +++ b/docs/server-args.md @@ -19,7 +19,7 @@ All flags are optional, but some are required in conjunction with certain others |`-k`, `--keep-artifacts`|false|(IOS-only) Keep Instruments trace directories|| |`-r`, `--backend-retries`|3|(iOS-only) How many times to retry launching Instruments before saying it crashed or timed out|`--backend-retries 3`| |`--session-override`|false|Enables session override (clobbering)|| -|`--full-reset`|false|(iOS) Delete the entire simulator folder. (Android) Reset app state by uninstalling app instead of clearing app data|| +|`--full-reset`|false|(iOS) Delete the entire simulator folder. (Android) Reset app state by uninstalling app instead of clearing app data. On Android, this will also remove the app after the session is complete.|| |`--no-reset`|false|Don't reset app state between sessions (IOS: don't delete app plist files; Android: don't uninstall app before new session)|| |`-l`, `--pre-launch`|false|Pre-launch the application before allowing the first session (Requires --app and, for Android, --app-pkg and --app-activity)|| |`-lt`, `--launch-timeout`|90000|(iOS-only) how long in ms to wait for Instruments to launch|| @@ -49,7 +49,7 @@ All flags are optional, but some are required in conjunction with certain others |`-ra`, `--robot-address`|0.0.0.0|IP Address of robot|`--robot-address 0.0.0.0`| |`-rp`, `--robot-port`|-1|port for robot|`--robot-port 4242`| |`--selendroid-port`|8080|Local port used for communication with Selendroid|`--selendroid-port 8080`| -|`--chromedriver-port`|9515|(Android-only) Local port used for running ChromeDriver|`--chromedriver-port 9515`| +|`--chromedriver-port`|9515|Port upon which ChromeDriver will run|`--chromedriver-port 9515`| |`--use-keystore`|false|(Android-only) When set the keystore will be used to sign apks.|| |`--keystore-path`|/Users/user/.android/debug.keystore|(Android-only) Path to keystore|| |`--keystore-password`|android|(Android-only) Password to keystore|| diff --git a/lib/devices/android/android.js b/lib/devices/android/android.js index 10af24496..c739cb095 100644 --- a/lib/devices/android/android.js +++ b/lib/devices/android/android.js @@ -319,6 +319,16 @@ Android.prototype.requestXmlCompression = function (cb) { Android.prototype.stop = function (cb) { this.shuttingDown = true; + var completeShutdown = function (cb) { + if (this.adb) { + this.adb.goToHome(function () { + this.shutdown(cb); + }.bind(this)); + } else { + this.shutdown(cb); + } + }.bind(this); + if (this.opts.fullReset) { logger.info("Removing app from device"); this.uninstallApp(function (err) { @@ -327,16 +337,13 @@ Android.prototype.stop = function (cb) { // process logger.warn(err); } + completeShutdown(cb); }); + } else { + completeShutdown(cb); } - if (this.adb) { - this.adb.goToHome(function () { - this.shutdown(cb); - }.bind(this)); - } else { - this.shutdown(cb); - } + }; Android.prototype.cleanup = function () { diff --git a/lib/devices/android/selendroid.js b/lib/devices/android/selendroid.js index 2a5412d26..f21b0dbfc 100644 --- a/lib/devices/android/selendroid.js +++ b/lib/devices/android/selendroid.js @@ -169,6 +169,14 @@ Selendroid.prototype.checkSelendroidCerts = function (cb) { }; Selendroid.prototype.stop = function (cb) { + + var completeShutdown = function (cb) { + logger.info("Stopping selendroid server"); + this.deleteSession(function (err) { + cb(err ? 1 : 0); + }); + }.bind(this); + if (this.opts.fullReset) { logger.info("Removing app from device"); this.uninstallApp(function (err) { @@ -177,13 +185,13 @@ Selendroid.prototype.stop = function (cb) { // process logger.warn(err); } + completeShutdown(cb); }); + } else { + completeShutdown(cb); } - logger.info("Stopping selendroid server"); - this.deleteSession(function (err) { - cb(err ? 1 : 0); - }); + }; Selendroid.prototype.keyevent = function (keycode, metastate, cb) {