jeudi 21 avril 2016

Testing Recycler View Item State

I have a recycler view that when items are selected, the items state are change to activated and I want to test that behavior in UI testing.

@Test
public void toggleAndDeselectSMSMessage() {

    onView(withId(R.id.scheduled_messages)).perform(
            RecyclerViewActions.actionOnItemAtPosition(0, longClick())
    ).check(matches(isSelected()));
}

What I got so far is this and this won't work because activated and selected are two different states. Do I need to implement my own viewmatcher to check this kind of behavior? Or is their a built-in function already in espresso that I just didn't know. Any help is appreciated.

Aucun commentaire:

Enregistrer un commentaire