aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/actions/CheckHelpers.java
blob: a950ceeaa2e5683c62dd09f21c50598b269df874 (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
30
31
package org.sufficientlysecure.keychain.actions;


import android.support.annotation.StringRes;

import org.hamcrest.CoreMatchers;
import org.sufficientlysecure.keychain.ui.util.Notify.Style;

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant;
import static android.support.test.espresso.matcher.ViewMatchers.withClassName;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static org.sufficientlysecure.keychain.actions.CustomMatchers.withSnackbarLineColor;


abstract public class CheckHelpers {

    public static void checkSnackbar(Style style, @StringRes Integer text) {

        onView(withClassName(CoreMatchers.endsWith("Snackbar")))
                .check(matches(withSnackbarLineColor(style.mLineColor)));

        if (text != null) {
            onView(withClassName(CoreMatchers.endsWith("Snackbar")))
                    .check(matches(hasDescendant(withText(text))));
        }

    }

}