fix: Fix Android scroll_to and scroll_to_exact#638
Conversation
|
@emen Could you explain me more? |
|
Hi @KazuCocoa, I ran into a couple of issues with the current implementation.
I tested with Appium 1.6.5 and a couple of versions of Android. Thanks! |
KazuCocoa
left a comment
There was a problem hiding this comment.
thanks!
hm...
In my environment, tests were passed 7 runs, 11 assertions, 0 failures, 0 errors, 0 skips even if I use scroll_to('Views').click. I ran with Android 6.0.
Anyway, certainly we have resource_id(text, "new UiSelector().resourceId(#{text});" is "" case. 👍
| scroll_uiselector(resource_id(text, "new UiSelector().resourceId(#{text});"), scrollable_index) | ||
|
|
||
| find_element :uiautomator, args | ||
| rid = resource_id(text, "new UiSelector().resourceId(#{text});") |
There was a problem hiding this comment.
How about the following if you'd like to ignore resource_id(text, "new UiSelector().resourceId(#{text});") is "" case?
r_id = resource_id(text, "new UiSelector().resourceId(#{text});")
args = scroll_uiselector("new UiSelector().textContains(#{text})", scrollable_index) +
scroll_uiselector("new UiSelector().descriptionContains(#{text})", scrollable_index)
args += scroll_uiselector(r_id, scrollable_index) unless r_id.empty?
find_element :uiautomator, args| scroll_uiselector(resource_id(text, "new UiSelector().resourceId(#{text});"), scrollable_index) | ||
|
|
||
| find_element :uiautomator, args | ||
| rid = resource_id(text, "new UiSelector().resourceId(#{text});") |
There was a problem hiding this comment.
Also,
r_id = resource_id(text, "new UiSelector().resourceId(#{text});")
args = scroll_uiselector("new UiSelector().text(#{text})", scrollable_index) +
scroll_uiselector("new UiSelector().description(#{text})", scrollable_index)
args += scroll_uiselector(r_id, scrollable_index) unless r_id.empty?|
@emen |
|
Hi @KazuCocoa, I figured it out. The tests fail with Android 5.0.0. and 5.1.0, pass with 6.0.0 and 7.0.0. With 5.0.0 and 5.1.1, Ruby needs to check if the scroll is successful and return the element. The change you suggested unfortunately will still fail on 5.0.0 and 5.1.0 Please try and let me know. Thanks a lot! |
|
@emen r_id = resource_id(text, "new UiSelector().resourceId(#{text});")
args = scroll_uiselector("new UiSelector().textContains(#{text})", scrollable_index) +
scroll_uiselector("new UiSelector().descriptionContains(#{text})", scrollable_index)
args += scroll_uiselector(r_id, scrollable_index) unless r_id.empty?
find_element :uiautomator, argsI'd like to reduce the number of request to the server, and I'd like to call |
|
Thank you @KazuCocoa! You are right. With the above change, the unit test Thanks! |
|
thanks! |
I need to use this method for some of my tests.
Fixed Android
scroll_toandscroll_to_exactmethods and their testsrake android['android/element/generic.rb']