diff --git a/lib/appium.js b/lib/appium.js index 8baf925f7..bf95ea971 100644 --- a/lib/appium.js +++ b/lib/appium.js @@ -602,6 +602,7 @@ Appium.prototype.initDevice = function () { , reset: !this.args.noReset , fastReset: this.fastReset , fastClear: this.desiredCapabilities.fastClear + , fullReset: this.fullReset , useKeystore: this.args.useKeystore , keystorePath: this.args.keystorePath , keystorePassword: this.args.keystorePassword @@ -631,6 +632,7 @@ Appium.prototype.initDevice = function () { , reset: !this.args.noReset , systemPort: this.args.selendroidPort , fastReset: this.fastReset + , fullReset: this.fullReset , useKeystore: this.args.useKeystore , keystorePath: this.args.keystorePath , keystorePassword: this.args.keystorePassword diff --git a/lib/devices/android/android.js b/lib/devices/android/android.js index 7b2bcb413..10af24496 100644 --- a/lib/devices/android/android.js +++ b/lib/devices/android/android.js @@ -318,6 +318,18 @@ Android.prototype.requestXmlCompression = function (cb) { Android.prototype.stop = function (cb) { this.shuttingDown = true; + + if (this.opts.fullReset) { + logger.info("Removing app from device"); + this.uninstallApp(function (err) { + if (err) { + // simply warn on error here, because we don't want to stop the shutdown + // process + logger.warn(err); + } + }); + } + if (this.adb) { this.adb.goToHome(function () { this.shutdown(cb); diff --git a/lib/devices/android/selendroid.js b/lib/devices/android/selendroid.js index b47088b1c..2a5412d26 100644 --- a/lib/devices/android/selendroid.js +++ b/lib/devices/android/selendroid.js @@ -169,6 +169,17 @@ Selendroid.prototype.checkSelendroidCerts = function (cb) { }; Selendroid.prototype.stop = function (cb) { + if (this.opts.fullReset) { + logger.info("Removing app from device"); + this.uninstallApp(function (err) { + if (err) { + // simply warn on error here, because we don't want to stop the shutdown + // process + logger.warn(err); + } + }); + } + logger.info("Stopping selendroid server"); this.deleteSession(function (err) { cb(err ? 1 : 0); diff --git a/lib/server/parser.js b/lib/server/parser.js index da6bdede6..dd2a9f02a 100644 --- a/lib/server/parser.js +++ b/lib/server/parser.js @@ -98,8 +98,9 @@ var args = [ , dest: 'fullReset' , action: 'storeTrue' , required: false - , help: '(iOS) Delete the entire simulator folder. (Android) Reset app state by uninstalling app instead of ' + - 'clearing app data' + , help: '(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.' , nargs: 0 }],