Skip to content

#319 fix #326

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 7 commits into from
Mar 3, 2016
Merged

#319 fix #326

merged 7 commits into from
Mar 3, 2016

Conversation

TikhomirovSergey
Copy link
Contributor

Change list:

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
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants