Thursday, 30 July 2015

android espresso ondata with two listview




If you only have one viewlist you can do:


onData(withProductId(productId)).onChildView(withId(R.id.picking_detail_product_list_item_btn_nonefound)).check(matches(not(isEnabled())));


If you have to, you should:


onData(withProductId(productId)).inAdapterView(withId(R.id.batch_picking_detail_product_list)).onChildView(withId(R.id.picking_detail_product_list_item_btn_nonefound)).check(matches(not(isEnabled())));


Otherwise you will get this error:


android.support.test.espresso.AmbiguousViewMatcherException: 'is assignable from class: class android.widget.AdapterView' matches multiple views in the hierarchy.
Problem views are marked with '****MATCHES****' below.

View Hierarchy:
....




https://code.google.com/p/android-test-kit/wiki/EspressoSamples
https://groups.google.com/forum/#!topic/android-test-kit-discuss/YN7uicr4omg

No comments:

Post a comment