Skip to content

#319 fix - #326

Merged
TikhomirovSergey merged 7 commits into
appium:masterfrom
TikhomirovSergey:server_flag_actualization
Mar 3, 2016
Merged

#319 fix#326
TikhomirovSergey merged 7 commits into
appium:masterfrom
TikhomirovSergey:server_flag_actualization

Conversation

@TikhomirovSergey

Copy link
Copy Markdown
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:

publicinterfaceMobileCapabilityTypeextendsCapabilityType {
/** * Deprecated. Moved to {@link AndroidMobileCapabilityType#DEVICE_READY_TIMEOUT} */@DeprecatedStringDEVICE_READY_TIMEOUT = "deviceReadyTimeout";
/** * Deprecated. Moved to {@link IOSMobileCapabilityType#LAUNCH_TIMEOUT} */@DeprecatedStringLAUNCH_TIMEOUT = "launchTimeout";
/** * Deprecated. Moved to {@link AndroidMobileCapabilityType#APP_PACKAGE} */@DeprecatedStringAPP_PACKAGE = "appPackage";
/** * Deprecated. Moved to {@link AndroidMobileCapabilityType#APP_ACTIVITY} */@DeprecatedStringAPP_ACTIVITY = "appActivity";
/** * Deprecated. Moved to {@link AndroidMobileCapabilityType#APP_WAIT_ACTIVITY} */@DeprecatedStringAPP_WAIT_ACTIVITY = "appWaitActivity";
/** * Deprecated. Moved to {@link AndroidMobileCapabilityType#APP_WAIT_PACKAGE} */@DeprecatedStringAPP_WAIT_PACKAGE = "appWaitPackage";
/** * Deprecated. Moved to {@link AndroidMobileCapabilityType#DONT_STOP_APP_ON_RESET} */@DeprecatedStringDONT_STOP_APP_ON_RESET = "dontStopAppOnReset";
/** * Deprecated. Moved to {@link AndroidMobileCapabilityType#UNICODE_KEYBOARD} */@DeprecatedStringUNICODE_KEYBOARD = "unicodeKeyboard";
@Deprecated/** * Deprecated. Moved to {@link AndroidMobileCapabilityType#SELENDROID_PORT} */StringSELENDROID_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:
packageio.appium.java_client.service.local.flags;
publicenumGeneralServerFlagimplementsServerArgument{
@DeprecatedUIID;
@DeprecatedNO_RESET;
@DeprecatedDEVICE_NAME;
@DeprecatedPLATFORM_NAME;
@DeprecatedPLATFORM_VERSION;
@DeprecatedAUTOMATION_NAME;
@DeprecatedBROWSER_NAME;
@DeprecatedLANGUAGE;
@DeprecatedLOCALE;
@DeprecatedCHROME_DRIVER_PORT; //moved to AndroidServerFlag @DeprecatedCHROME_DRIVER_EXECUTABLE; //moved to AndroidServerFlag @DeprecatedCOMMAND_TIMEOUT;
}
publicenumAndroidServerFlagimplementsServerArgument {
@DeprecatedPACKAGE;
@DeprecatedACTIVITY;
@DeprecatedAPP_WAIT_PACKAGE@DeprecatedAPP_WAIT_ACTIVITY;
@DeprecatedANDROID_COVERAGE;
@DeprecatedAVD;
@DeprecatedAVD_ARGS;
@DeprecatedDEVICE_READY_TIMEOUT;
@DeprecatedUSE_KEY_STORE;
@DeprecatedKEY_STORE_PATH;
@DeprecatedKEY_STORE_PASSWORD;
@DeprecatedKEY_ALIAS;
@DeprecatedKEY_PASSWORD;
@DeprecatedINTENT_ACTION;
@DeprecatedINTENT_CATEGORY;
@DeprecatedINTENT_FLAGS;
@DeprecatedINTENT_ARGUMENTS;
@DeprecatedDO_NOT_STOP_APP_ON_RESET;
}
publicenumIOSServerFlagimplementsServerArgument{
@DeprecatedLOCALIZABLE_STRING_PATH;
@DeprecatedLAUNCH_TIMEOUT;
@DeprecatedUSE_NATIVE_INSTRUMENTS;
@DeprecatedCALENDAR_FORMAT;
@DeprecatedORIENTATION;
@DeprecatedSHOW_SIMULATOR_LOG;
@DeprecatedSHOW_IOS_LOG;
@DeprecatedKEEP_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:

DesiredCapabilitiesserverCapabilities = newDesiredCapabilities();
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 casesAppiumServiceBuilderbuilder = newAppiumServiceBuilder().withCapabilities(serverCapabilities);
AppiumDriverLocalServiceservice = builder.build();
service.start();
...
service.stop();

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

DesiredCapabilitiesserverCapabilities = newDesiredCapabilities();
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 casesAppiumServiceBuilderbuilder = newAppiumServiceBuilder().withCapabilities(serverCapabilities);
AppiumDriverLocalServiceservice = builder.build();
DesiredCapabilitiesclientCapabilities = newDesiredCapabilities();
clientCapabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "io.appium.android.apis");
clientCapabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, ".view.WebView1");

then

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

or

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

or

service.start();
AndroidDriver<MobileElement> driver = newAndroidDriver<>(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
Copy Markdown
ContributorAuthor

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

@Jonahss

Copy link
Copy Markdown
Member

Super 👍

@SrinivasanTarget

Copy link
Copy Markdown
Member

LGTM!

@jlipps

Copy link
Copy Markdown
Member

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

@imurchie

Copy link
Copy Markdown
Contributor

LGTM

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@TikhomirovSergey@Jonahss@SrinivasanTarget@jlipps@imurchie