From 0f75bb58f9f9cd31d1e1203b8311fdf4e9e763dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Sch=C3=B6nberg?= Date: Wed, 17 May 2017 19:07:37 +0200 Subject: [PATCH] Add nearby activity Espresso test Currently the nearby activity is not included in the Espresso tests. This commit adds one test that checks if the activity loads and the headline is displayed. --- .../free/nrw/commons/NearbyActivityTest.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 app/src/androidTest/java/fr/free/nrw/commons/NearbyActivityTest.java diff --git a/app/src/androidTest/java/fr/free/nrw/commons/NearbyActivityTest.java b/app/src/androidTest/java/fr/free/nrw/commons/NearbyActivityTest.java new file mode 100644 index 000000000..9585b57d1 --- /dev/null +++ b/app/src/androidTest/java/fr/free/nrw/commons/NearbyActivityTest.java @@ -0,0 +1,29 @@ +package fr.free.nrw.commons; + +import android.support.test.espresso.assertion.ViewAssertions; +import android.support.test.filters.LargeTest; +import android.support.test.rule.ActivityTestRule; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import fr.free.nrw.commons.nearby.NearbyActivity; + +import static android.support.test.espresso.Espresso.onView; +import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; +import static android.support.test.espresso.matcher.ViewMatchers.withText; + +@LargeTest +@RunWith(AndroidJUnit4.class) +public class NearbyActivityTest { + @Rule + public final ActivityTestRule nearby = + new ActivityTestRule<>(NearbyActivity.class); + + @Test + public void testActivityLaunch() { + onView(withText("Nearby Places")).check(ViewAssertions.matches(isDisplayed())); + } +}