blob: 8b39503d452626628603b09dafcb20b69b50e7fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
package com.mapbox.mapboxsdk.utils;
import android.support.annotation.StringRes;
import android.support.test.espresso.Espresso;
import android.support.test.espresso.action.ViewActions;
import android.support.test.espresso.matcher.ViewMatchers;
import com.mapbox.mapboxsdk.testapp.R;
import org.hamcrest.Matchers;
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.withContentDescription;
public class DrawerUtils {
private final static String HOME_BUTTON_STRING = "Navigate up";
public static void openDrawer(){
onView(withContentDescription(HOME_BUTTON_STRING)).perform(click());
}
public static void clickItem(@StringRes int txtId){
Espresso.onView(Matchers.allOf(ViewMatchers.withId(R.id.design_menu_item_text),
ViewMatchers.hasSibling(ViewMatchers.withText(txtId)))).perform(ViewActions.click());
}
}
|