Make fullReset clear app on session stop as well

This commit is contained in:
Sam Park
2014-02-04 09:45:09 -08:00
parent 736b72bda2
commit 72ac77544b
4 changed files with 28 additions and 2 deletions
+2
View File
@@ -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
+12
View File
@@ -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);
+11
View File
@@ -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);
+3 -2
View File
@@ -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
}],