From 1aeee167c7bdf157e5ca742eef42fd3f92ecb5ef Mon Sep 17 00:00:00 2001 From: Jamie Edge Date: Sat, 21 Jun 2014 12:22:20 +0100 Subject: [PATCH] Added arguments for intent options. --- docs/en/server-args.md | 4 ++++ lib/devices/android/android-common.js | 4 ---- lib/server/parser.js | 34 ++++++++++++++++++++++++++- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/docs/en/server-args.md b/docs/en/server-args.md index b8f540e71..334f9922d 100644 --- a/docs/en/server-args.md +++ b/docs/en/server-args.md @@ -40,6 +40,10 @@ All flags are optional, but some are required in conjunction with certain others |`--avd`|null|(Android-only) Name of the avd to launch|`--avd @default`| |`--avd-args`|null|(Android-only) Additional emulator arguments to launch the avd|`--avd-args -no-snapshot-load`| |`--device-ready-timeout`|5|(Android-only) Timeout in seconds while waiting for device to become ready|`--device-ready-timeout 5`| +|`--intent-action`|`android.intent.action.MAIN`|(Android-only) Intent action which will be used to start activity|`android.intent.action.VIEW`| +|`--intent-category`|`android.intent.category.LAUNCHER`|(Android-only) Intent category which will be used to start activity|`android.intent.category.APP_CONTACTS`| +|`--intent-flags`|`0x10200000`|(Android-only) Flags that will be used to start activity|`0x10200000`| +|`--intent-args`|null|(Android-only) Additional intent arguments that will be used to start activity. See [Intent arguments](http://developer.android.com/tools/help/adb.html#IntentSpec)|`--esn `, `--ez `| |`--safari`|false|(IOS-Only) Use the safari app|| |`--device-name`|null|Name of the mobile device to use|`--device-name iPhone Retina (4-inch), Android Emulator`| |`--platform-name`|null|Name of the mobile platform: iOS, Android, or FirefoxOS|`--platform-name iOS`| diff --git a/lib/devices/android/android-common.js b/lib/devices/android/android-common.js index 169bb1380..805d51f79 100644 --- a/lib/devices/android/android-common.js +++ b/lib/devices/android/android-common.js @@ -87,12 +87,8 @@ androidCommon.setAndroidArgs = function () { this.args.appActivity; this.appProcess = this.args.appPackage; this.args.appDeviceReadyTimeout = this.args.androidDeviceReadyTimeout; - // TODO better way to set defaults. this.args.avdLaunchTimeout = this.args.avdLaunchTimeout || 120000; this.args.avdReadyTimeout = this.args.avdReadyTimeout || 120000; - this.args.intentAction = this.args.intentAction || "android.intent.action.MAIN"; - this.args.intentCategory = this.args.intentCategory || "android.intent.category.LAUNCHER"; - this.args.intentFlags = this.args.intentFlags || "0x10200000"; }; androidCommon.background = function (secs, cb) { diff --git a/lib/server/parser.js b/lib/server/parser.js index 78fea85a7..13a380b32 100644 --- a/lib/server/parser.js +++ b/lib/server/parser.js @@ -511,8 +511,40 @@ var args = [ , help: 'Absolute path to directory Appium can use to manage temporary ' + 'files, like built-in iOS apps it needs to move around. On *nix/Mac ' + 'defaults to /tmp, on Windows defaults to C:\\Windows\\Temp' - }] + }], + [['--intent-action'], { + dest: 'intentAction' + , defaultValue: "android.intent.action.MAIN" + , required: false + , example: "android.intent.action.MAIN" + , help: "(Android-only) Intent action which will be used to start activity" + }], + + [['--intent-category'], { + dest: 'intentCategory' + , defaultValue: "android.intent.category.LAUNCHER" + , required: false + , example: "android.intent.category.APP_CONTACTS" + , help: "(Android-only) Intent category which will be used to start activity" + }], + + [['--intent-flags'], { + dest: 'intentFlags' + , defaultValue: "0x10200000" + , required: false + , example: "0x10200000" + , help: "(Android-only) Flags that will be used to start activity" + }], + + [['--intent-args'], { + dest: 'optionalIntentArguments' + , defaultValue: null + , required: false + , example: "0x10200000" + , help: "(Android-only) Additional intent arguments that will be used to " + + "start activity" + }] ]; // Setup all the command line argument parsing