Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selecting Native Tabs while Espresso testing

I have a viewpager which utilizes the native actionbar Tabs as the indicator. I would like to navigate to different tabs, but Tab component is not a view therefore, onView, or withText does not work properly with perform clicks.

Is there a specific way I can do to navigate through the Tab navigation?

like image 208
Calvin Park Avatar asked Nov 29 '22 11:11

Calvin Park


1 Answers

You could use swiping to navigate between your tabs:

onView(withId(R.id.viewpager)).perform(swipeLeft());
onView(withId(R.id.viewpager)).perform(swipeRight());
like image 97
Eduard Avatar answered Dec 04 '22 14:12

Eduard