diff --git a/docs/en/writing-running-appium/caps.md b/docs/en/writing-running-appium/caps.md index 526a53e5e..0de66bf2f 100644 --- a/docs/en/writing-running-appium/caps.md +++ b/docs/en/writing-running-appium/caps.md @@ -50,6 +50,7 @@ |`intentCategory`| Intent category which will be used to start activity (default `android.intent.category.LAUNCHER`)| e.g. `android.intent.category.LAUNCHER`, `android.intent.category.APP_CONTACTS` |`intentFlags`| Flags that will be used to start activity (default `0x10200000`)| e.g. `0x10200000` |`optionalIntentArguments`| Additional intent arguments that will be used to start activity. See [Intent arguments](http://developer.android.com/tools/help/adb.html#IntentSpec) | e.g. `--esn `, `--ez `, etc. +|`stopAppOnReset`| Stops the process of the app under test, before starting the app using adb. If the app under test is created by another anchor app, setting this false, allows the process of the anchor app to be still alive, during the start of the test app using adb, default `true`| `true` or `false`| |`unicodeKeyboard`| Enable Unicode input, default `false`| `true` or `false`| |`resetKeyboard`| Reset keyboard to its original state, after running Unicode tests with `unicodeKeyboard` capability. Ignored if used alone. Default `false`| `true` or `false`| |`noSign`| Skip checking and signing of app with debug keys, will work only with UiAutomator and not with selendroid, default `false`| `true` or `false`| diff --git a/lib/devices/android/android-common.js b/lib/devices/android/android-common.js index a91926a19..51dec75d1 100644 --- a/lib/devices/android/android-common.js +++ b/lib/devices/android/android-common.js @@ -123,7 +123,7 @@ androidCommon.background = function (secs, cb) { waitActivity: activity, optionalIntentArguments: this.args.optionalIntentArguments, retry: true, - stopApp: false + stopApp: this.args.stopAppOnReset }, onStart); }.bind(this), secs * 1000); }.bind(this)); diff --git a/lib/devices/android/android.js b/lib/devices/android/android.js index fc6433a39..673524efc 100644 --- a/lib/devices/android/android.js +++ b/lib/devices/android/android.js @@ -393,7 +393,8 @@ Android.prototype.startApp = function (args, cb) { flags: args.intentFlags, waitPkg: args.appWaitPackage, waitActivity: args.appWaitActivity, - optionalIntentArguments: args.optionalIntentArguments + optionalIntentArguments: args.optionalIntentArguments, + stopApp: args.stopAppOnReset }, cb); } }; diff --git a/lib/devices/android/selendroid.js b/lib/devices/android/selendroid.js index 1b4f3eb62..4bca91e91 100644 --- a/lib/devices/android/selendroid.js +++ b/lib/devices/android/selendroid.js @@ -388,6 +388,7 @@ Selendroid.prototype.createSession = function (cb) { waitPkg: this.args.appWaitPackage, waitActivity: this.args.appWaitActivity, optionalIntentArguments: this.args.optionalIntentArguments, + stopApp: this.args.stopAppOnReset, retry: false }, onStart); } diff --git a/lib/server/capabilities.js b/lib/server/capabilities.js index 5d0f258f3..2ce76da10 100644 --- a/lib/server/capabilities.js +++ b/lib/server/capabilities.js @@ -67,6 +67,7 @@ var androidCaps = [ , 'resetKeyboard' , 'noSign' , 'ignoreUnimportantViews' +, 'stopAppOnReset' ]; var iosCaps = [ diff --git a/lib/server/parser.js b/lib/server/parser.js index 8244a2490..0aa96e4de 100644 --- a/lib/server/parser.js +++ b/lib/server/parser.js @@ -607,6 +607,13 @@ var args = [ , example: "0x10200000" , help: "(Android-only) Additional intent arguments that will be used to " + "start activity" + }], + + [['--stop-app-on-reset'], { + dest: 'stopAppOnReset' + , defaultValue: true + , required: false + , help: "(Android-only) Stops the app before restart" }] ];