This Question have no Text answers yet!

Android Espresso doesn't perform onData calls

Question!

I am trying to create a helper method which performs a selection (button press).

public void performPoseSelection(String roomName, int selection) {
        onData(anything())
                .inAdapterView(withId(android.R.id.list))
                .atPosition(selection)
                .onChildView(withId(R.id.btn))
                .perform(click()); 
}

public void testPickPose() throws InterruptedException{
        performPoseSelection("White Room", 0);
        performPoseSelection("White Room", 1);
        performPoseSelection("White Room", 1);
        performPoseSelection("White Room", 0);
}

What I am finding is that the results are inconsistent. There are times when a selection is not made at all! Other times, the the test is performed correctly. What is causing this issue?



Video about Android Espresso doesn't perform onData calls