summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/DrawerUtils.java
blob: 8d8905fdf496a1df03d78b4d5b1ce036cfe1a4ad (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.testapp.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());
    }

}