Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

JsonToMobileElementConverter re-design #532

Merged
merged 13 commits into from
Dec 10, 2016
Merged

JsonToMobileElementConverter re-design #532

merged 13 commits into from
Dec 10, 2016

Conversation

TikhomirovSergey
Copy link
Contributor

@TikhomirovSergey TikhomirovSergey commented Dec 6, 2016

Change list

Visibility of command constants was changed. The lock command:

  • The argument preparation for the lockDevice command was moved to the MobileCommand.

JsonToMobileElementConverter re-design:

  • unused MobileElementToJsonConverter was removed
  • JsonToMobileElementConverter is not rhe abstract class now. It generates instances of MobileElement subclasses according to current session parameters
  • JsonToAndroidElementConverter is deprecated now
  • JsonToIOSElementConverter is depreacated now
  • JsonToYouiEngineElementConverter is deprecated now.
  • constructors of 'AppiumDriver' were re-designed.
  • constructors of 'AndroidDriver' were re-designed.
  • constructors of 'IOSDriver' were re-designed.

Additional changes:

  • the new automation type youiengine was added.

  • IOSDriver now implements io.appium.java_client.FindsByIosNSPredicate.

  • these capabilities were added:

    • IOSMobileCapabilityType#CUSTOM_SSL_CERT
    • IOSMobileCapabilityType#TAP_WITH_SHORT_PRESS_DURATION
    • IOSMobileCapabilityType#SCALE_FACTOR
    • MobileCapabilityType#CLEAR_SYSTEM_FILES
  • source and tests code cleaning up.

Types of changes

What types of changes are you proposing/introducing to Java client?

  • No changes in production code.
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Details

The work on #454 is really completed now.
Motivation:
As AppiumDriver should not ne abstract then end user should be able to work with found elements. The type of elements should depend on current platform and automation type.

- removal of unusal imports
- unused MobileElementToJsonConverter was removed
- IOSMobileCommandHelper: methods that hide keyboard were moved to MobileCommand
 - constants which describe commands that supposed to be common for all the platforms  have package-visibility now.
  - The argument preparation for the lockDevice command was moved to the MobileCommand.
- JsonToMobileElementConverter is not rhe abstract class now. It generates instances of MobileElement subclasses according to current session parameters
- JsonToAndroidElementConverter is deprecated now
- JsonToIOSElementConverter is depreacated now
- JsonToYouiEngineElementConverter is deprecated now.
- MobileElement is the abstract class.
- the new automation type `youiengine` was added.
- more strict contract beetween AppiumDriver subclasses and MobileElement subclasses was provided:
   - AppiumDriver stays the  generic class
   - AndroidDriver now generates only AndroidElement
   - IOSDriver  now generates only IOSDriver
...and the additional test for AppiumDriver for Android
it is not correct because we automate tot only native apps. There are mobile browsers and hybrid apps.
@TikhomirovSergey TikhomirovSergey added this to the 5.0.0 milestone Dec 6, 2016
@TikhomirovSergey TikhomirovSergey self-assigned this Dec 6, 2016
@TikhomirovSergey
Copy link
Contributor Author

@SrinivasanTarget @jlipps could you rewiew this PR?

.get(1))
.findElementByIosUIAutomation(".elements().withName(\"Answer\")").getText(), null);
}

@Test public void setValuerTest() {
IOSElement slider = (IOSElement) driver.findElementByClassName("UIASlider");
IOSElement slider = driver.findElementByClassName("UIASlider");
slider.setValue("0%");
Copy link
Member

@SrinivasanTarget SrinivasanTarget Dec 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setValue seems to be not working now for slider :(

Tested on iOS 9.3. Server Logs: https://gist.github.com/SrinivasanTarget/7202391e8064b7cf8827380064e27e38

org.junit.ComparisonFailure:
Expected :0%
Actual :51%

at org.junit.Assert.assertEquals(Assert.java:115)
at org.junit.Assert.assertEquals(Assert.java:144)
at io.appium.java_client.ios.IOSElementTest.setValuerTest(IOSElementTest.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

TikhomirovSergey and others added 3 commits December 8, 2016 19:26
Also io.appium.java_client.android.HasSettings API was improved. Now getSettings returns Map instead of JSONObject
IOSDriver implements FindsByIosNSPredicate
@TikhomirovSergey TikhomirovSergey merged commit 265bea8 into appium:master Dec 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants