Skip to content

Conversation

TikhomirovSergey
Copy link
Contributor

Change list:

  • all capabilities were added.
    Capabilities were added according to https://github.com/appium/appium/blob/1.5/docs/en/writing-running-appium/caps.md. Therea three classes:
    io.appium.java_client.remote.MobileCapabilityType (just modified),
    io.appium.java_client.remote.AndroidMobileCapabilityType (android-specific capabilities),
    io.appium.java_client.remote.IOSMobileCapabilityType (iOS-specific capabilities).

Some existing capabilities were marked Deprecated and they are going to be removed at the next java client release:

public interface MobileCapabilityType extends CapabilityType { /**  * Deprecated. Moved to {@link AndroidMobileCapabilityType#DEVICE_READY_TIMEOUT}  */ @Deprecated String DEVICE_READY_TIMEOUT = "deviceReadyTimeout"; /**  * Deprecated. Moved to {@link IOSMobileCapabilityType#LAUNCH_TIMEOUT}  */ @Deprecated String LAUNCH_TIMEOUT = "launchTimeout"; /**  * Deprecated. Moved to {@link AndroidMobileCapabilityType#APP_PACKAGE}  */ @Deprecated String APP_PACKAGE = "appPackage"; /**  * Deprecated. Moved to {@link AndroidMobileCapabilityType#APP_ACTIVITY}  */ @Deprecated String APP_ACTIVITY = "appActivity"; /**  * Deprecated. Moved to {@link AndroidMobileCapabilityType#APP_WAIT_ACTIVITY}  */ @Deprecated String APP_WAIT_ACTIVITY = "appWaitActivity"; /**  * Deprecated. Moved to {@link AndroidMobileCapabilityType#APP_WAIT_PACKAGE}  */ @Deprecated String APP_WAIT_PACKAGE = "appWaitPackage"; /**  * Deprecated. Moved to {@link AndroidMobileCapabilityType#DONT_STOP_APP_ON_RESET}  */ @Deprecated String DONT_STOP_APP_ON_RESET = "dontStopAppOnReset"; /**  * Deprecated. Moved to {@link AndroidMobileCapabilityType#UNICODE_KEYBOARD}  */ @Deprecated String UNICODE_KEYBOARD = "unicodeKeyboard"; @Deprecated /**  * Deprecated. Moved to {@link AndroidMobileCapabilityType#SELENDROID_PORT}  */ String SELENDROID_PORT = "selendroidPort"; }
  • some server flags were marked deprecated because they are deprecated since server node v1.5.x. These flags are going to be removed at the java client release:
package io.appium.java_client.service.local.flags; public enum GeneralServerFlag implements ServerArgument{ @Deprecated UIID; @Deprecated NO_RESET; @Deprecated DEVICE_NAME; @Deprecated PLATFORM_NAME; @Deprecated PLATFORM_VERSION; @Deprecated AUTOMATION_NAME; @Deprecated BROWSER_NAME; @Deprecated LANGUAGE; @Deprecated LOCALE; @Deprecated CHROME_DRIVER_PORT; //moved to AndroidServerFlag  @Deprecated CHROME_DRIVER_EXECUTABLE; //moved to AndroidServerFlag  @Deprecated COMMAND_TIMEOUT; }
public enum AndroidServerFlag implements ServerArgument { @Deprecated PACKAGE; @Deprecated ACTIVITY; @Deprecated APP_WAIT_PACKAGE @Deprecated APP_WAIT_ACTIVITY; @Deprecated ANDROID_COVERAGE; @Deprecated AVD; @Deprecated AVD_ARGS; @Deprecated DEVICE_READY_TIMEOUT; @Deprecated USE_KEY_STORE; @Deprecated KEY_STORE_PATH; @Deprecated KEY_STORE_PASSWORD; @Deprecated KEY_ALIAS; @Deprecated KEY_PASSWORD; @Deprecated INTENT_ACTION; @Deprecated INTENT_CATEGORY; @Deprecated INTENT_FLAGS; @Deprecated INTENT_ARGUMENTS; @Deprecated DO_NOT_STOP_APP_ON_RESET; }
public enum IOSServerFlag implements ServerArgument{ @Deprecated LOCALIZABLE_STRING_PATH; @Deprecated LAUNCH_TIMEOUT; @Deprecated USE_NATIVE_INSTRUMENTS; @Deprecated CALENDAR_FORMAT; @Deprecated ORIENTATION; @Deprecated SHOW_SIMULATOR_LOG; @Deprecated SHOW_IOS_LOG; @Deprecated KEEP_KEYCHAINS; }
  • The ability to start Appium node programmatically using desired capabilities. This feature is compatible with Appium node server v >= 1.5.x.

It is the addition to usecases which have been provided here: #240. Now it is possible to do something like that:

DesiredCapabilities serverCapabilities = new DesiredCapabilities(); serverCapabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android"); serverCapabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator"); serverCapabilities.setCapability(MobileCapabilityType.FULL_RESET, true); serverCapabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 60); serverCapabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath()); serverCapabilities.setCapability(AndroidMobileCapabilityType.CHROMEDRIVER_EXECUTABLE, chrome.getAbsolutePath()); //this capability set can be used for all cases AppiumServiceBuilder builder = new AppiumServiceBuilder().withCapabilities(serverCapabilities); AppiumDriverLocalService service = builder.build(); service.start(); ... service.stop();

Capabilities which are passed through a builder can be completed/orerriden any similar way:

DesiredCapabilities serverCapabilities = new DesiredCapabilities(); serverCapabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android"); serverCapabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator"); serverCapabilities.setCapability(MobileCapabilityType.FULL_RESET, true); serverCapabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 60); serverCapabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath()); serverCapabilities.setCapability(AndroidMobileCapabilityType.CHROMEDRIVER_EXECUTABLE, chrome.getAbsolutePath()); //this capability set can be used for all cases AppiumServiceBuilder builder = new AppiumServiceBuilder().withCapabilities(serverCapabilities); AppiumDriverLocalService service = builder.build(); DesiredCapabilities clientCapabilities = new DesiredCapabilities(); clientCapabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "io.appium.android.apis"); clientCapabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, ".view.WebView1");

then

AndroidDriver<MobileElement> driver = new AndroidDriver<>(service, clientCapabilities);

or

AndroidDriver<MobileElement> driver = new AndroidDriver<>(builder, clientCapabilities);

or

service.start(); AndroidDriver<MobileElement> driver = new AndroidDriver<>(service.getUrl(), clientCapabilities);

#319

Old server flags were marked deprecated.
- AppiumServiceBuilder.withArgument methods were marked Deprecated - AppiumServiceBuilder.withCapabilities was added The next step is the testing.
- some server flags are deprecated now - test re-design I need to add 2-4 new tests
- the different capability forming for Windows and UNIX-like OSs - test cleaning of deprecated code
@TikhomirovSergey
Copy link
Contributor Author

@bootstraponline @imurchie @jlipps @Jonahss
Guys
could you take a look at this PR?

@Jonahss
Copy link
Member

Jonahss commented Mar 1, 2016

Super 👍

@SrinivasanTarget
Copy link
Member

LGTM!

@jlipps
Copy link
Member

jlipps commented Mar 2, 2016

can't comment on the code itself but I like the idea!

@imurchie
Copy link
Contributor

imurchie commented Mar 2, 2016

LGTM

@TikhomirovSergey TikhomirovSergey merged commit debe53a into appium:master Mar 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants