From fe4659f8d6ef5b0520ba391deb050f64f878aeed Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Sun, 14 Jun 2015 18:09:14 +0200 Subject: instrument: add helper for snackbar check (2) --- .../keychain/actions/CheckHelpers.java | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/actions/CheckHelpers.java (limited to 'OpenKeychain/src/androidTest') diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/actions/CheckHelpers.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/actions/CheckHelpers.java new file mode 100644 index 000000000..a950ceeaa --- /dev/null +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/actions/CheckHelpers.java @@ -0,0 +1,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)))); + } + + } + +} -- cgit v1.2.3