kezhou2 / android-test-kit

Automatically exported from code.google.com/p/android-test-kit
0 stars 0 forks source link

onData does not operate on currently visible activity #108

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a test case for an activity on which you can perform an action that 
takes you to a second activity that contains an AdapterView (in my case, a 
ListView).
2. In this test, perform aforementioned action to start the second activity.
3. Use onData() to perform an action on one of the items in the AdapterView

What is the expected output? What do you see instead?
I expect onData to match on the AdapterView on the second activity. Instead, I 
receive the error, 
"com.google.android.apps.common.testing.ui.espresso.NoMatchingViewException: No 
views in hierarchy found matching: is assignable from class: class 
android.widget.AdapterView"

The hierarchy that is emitted after this error is the hierarchy for the first 
activity, indicating to me that onData is not taking into account the presence 
of a new activity on screen.

What version of the product are you using? On what operating system?
androidTestCompile('com.jakewharton.espresso:espresso:1.1-r3')
Android 4.4.2 (stock Note 3 on Verizon)

Please provide any additional information below.

Original issue reported on code.google.com by bria...@gmail.com on 16 Dec 2014 at 4:13

GoogleCodeExporter commented 9 years ago
I was trying to put together some code to describe exactly when it happened, 
and it stopped happening.

It initially stopped when I chained inAdapterView(withId(R.id.listView)) to the 
onData() call. However, after I removed that it still behaved sensibly. So I 
can't give you a solid reproduction right now.

Original comment by bria...@gmail.com on 16 Dec 2014 at 4:49