This Question have no Text answers yet!

Android Espresso onData skipped

Question!

I am currently writing a test which uses the onData call to find and press a button.

public void testPickFavorites() throws InterruptedException {

        onData(anything())
                .inAdapterView(withId(android.R.id.list))
                .atPosition(0)
                .onChildView(withId(yesButtonId))
                .perform(click());
        onData(anything())
                .inAdapterView(withId(android.R.id.list))
                .atPosition(1)
                .onChildView(withId(noButtonId))
                .perform(click());

        onData(anything())
                .inAdapterView(withId(android.R.id.list))
                .atPosition(0)
                .onChildView(withId(maybeButtonId))
                .perform(click());
        onData(anything())
                .inAdapterView(withId(android.R.id.list))
                .atPosition(1)
                .onChildView(withId(maybeButtonId))
                .perform(click());
    }

The problem with this is that while certin test runs will perform all 4 clicks successfully, there are otheres where one or several of these clicks will not be performed. Does anyone know what's causing the issue?



Video about Android Espresso onData skipped