dudi
dudi

Reputation: 5732

How to perform multiple clicks on a view in Espresso

In my application I had a bug, where the app crashed when I clicked a button multiple times. I fixed the bug and now I want to write an Espresso UI Test to verify that the bug is fixed. So my question is, is it possible to perform multiple clicks on one view like a button and how can I do this?

This is what I already have but I'm not sure if this the correct way to implement this

onView(withContentDescription("Foo")).perform(click(), doubleClick())

Upvotes: 2

Views: 1586

Answers (1)

gmetal
gmetal

Reputation: 2988

According to the Android Documentation, the perform method of the ViewInteraction class, takes a vararg of ViewAction objects. So your code:

onView(withContentDescription("Foo")).perform(click(), doubleClick())

seems correct.

Upvotes: 4

Related Questions