skyisle / android-test-kit

Automatically exported from code.google.com/p/android-test-kit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hasFocus() not working for ListView in a ViewPager

GoogleCodeExporter opened this issue · comments

What steps will reproduce the problem?
1. Create a ViewPager with some tabs, each of which contains a Fragment. In 
that Fragment, add a single ListView. 
2. ViewPager will implicitly add a second instance of your ListView for caching 
purposes. 
3. Use onData to point to this ListView in a test. 
4. One of the ListViews will have focus = true; the other will have focus = 
false
5. Using allOf(withId(R.id.LISTVIEWID), hasFocus()) will point to both of the 
ListViews and lead to an Ambiguous view exception, even though one is labeled 
to have focus and the other is labeled to not have focus. 

What is the expected output? What do you see instead?

Since only one of the instances of the ListView has focus, I expect to return 
only one ListView from my allOf() call, but I see an Ambiguous view exception 
instead. 


What version of the product are you using? On what operating system?
Using Espresso 1.1 r-3 on Mavericks. 


Original issue reported on code.google.com by mike.mcg...@indiegogo.com on 3 Oct 2014 at 5:52

Haven't confirmed for sure, but I'm guessing that at some point (perhaps during 
a transition), both of the lists have focus. Do you mind confirming and perhaps 
providing a code snippet that demonstrates the issue?

Original comment by vale...@google.com on 19 Nov 2014 at 10:58