app/src/androidTest/java/ch/epfl/sweng/studdybuddy/NavigationTestHelper.java
package ch.epfl.sweng.studdybuddy;
import android.support.test.espresso.ViewInteraction;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withContentDescription;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static ch.epfl.sweng.studdybuddy.GroupsActivityLeadsToCreateGroup.childAtPosition;
import static org.hamcrest.Matchers.allOf;
public class NavigationTestHelper {
public static void navigate(String tabName, int viewId, int position) {
ViewInteraction tab = onView(
allOf(withId(viewId), withContentDescription(tabName),
childAtPosition(
childAtPosition(
withId(R.id.bottom_navigation),
0),
position),
isDisplayed()));
tab.perform(click());
}
}