diff options
author | ByteHamster <info@bytehamster.com> | 2020-03-23 16:08:18 +0100 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2020-03-23 19:18:24 +0100 |
commit | 11536361c58a54d82f9a85475ac5e8b816090402 (patch) | |
tree | 94175612c7016e24d02d3f4db2ea4cffbe4f9e43 /app/src/androidTest | |
parent | 5ad7228b4e8650d1fa84bf28db8d810dd0b4aebf (diff) | |
download | AntennaPod-11536361c58a54d82f9a85475ac5e8b816090402.zip |
Fixed tests
Diffstat (limited to 'app/src/androidTest')
-rw-r--r-- | app/src/androidTest/java/de/test/antennapod/EspressoTestUtils.java | 6 | ||||
-rw-r--r-- | app/src/androidTest/java/de/test/antennapod/ui/QueueFragmentTest.java | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/EspressoTestUtils.java b/app/src/androidTest/java/de/test/antennapod/EspressoTestUtils.java index 225f07dfd..beb6ad705 100644 --- a/app/src/androidTest/java/de/test/antennapod/EspressoTestUtils.java +++ b/app/src/androidTest/java/de/test/antennapod/EspressoTestUtils.java @@ -32,7 +32,9 @@ import java.util.concurrent.TimeoutException; import static androidx.test.espresso.Espresso.onView; import static androidx.test.espresso.action.ViewActions.click; import static androidx.test.espresso.matcher.ViewMatchers.hasDescendant; +import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; import static androidx.test.espresso.matcher.ViewMatchers.isRoot; +import static androidx.test.espresso.matcher.ViewMatchers.withContentDescription; import static androidx.test.espresso.matcher.ViewMatchers.withId; import static androidx.test.espresso.matcher.ViewMatchers.withText; import static org.hamcrest.Matchers.allOf; @@ -193,4 +195,8 @@ public class EspressoTestUtils { } androidx.test.platform.app.InstrumentationRegistry.getInstrumentation().waitForIdleSync(); } + + public static Matcher<View> actionBarOverflow() { + return allOf(isDisplayed(), withContentDescription("More options")); + } } diff --git a/app/src/androidTest/java/de/test/antennapod/ui/QueueFragmentTest.java b/app/src/androidTest/java/de/test/antennapod/ui/QueueFragmentTest.java index 37d76bb6d..ec0d1fa64 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/QueueFragmentTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/QueueFragmentTest.java @@ -1,6 +1,7 @@ package de.test.antennapod.ui; import android.content.Intent; +import android.view.View; import androidx.test.espresso.Espresso; import androidx.test.espresso.intent.rule.IntentsTestRule; import androidx.test.runner.AndroidJUnit4; @@ -8,6 +9,7 @@ import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.fragment.QueueFragment; import de.test.antennapod.EspressoTestUtils; +import org.hamcrest.Matcher; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -18,6 +20,7 @@ import static androidx.test.espresso.action.ViewActions.click; import static androidx.test.espresso.matcher.ViewMatchers.withClassName; import static androidx.test.espresso.matcher.ViewMatchers.withContentDescription; import static androidx.test.espresso.matcher.ViewMatchers.withText; +import static de.test.antennapod.NthMatcher.first; import static org.hamcrest.CoreMatchers.allOf; import static org.hamcrest.CoreMatchers.endsWith; @@ -48,14 +51,14 @@ public class QueueFragmentTest { @Test public void testSortEmptyQueue() { - Espresso.openContextualActionModeOverflowMenu(); + onView(first(EspressoTestUtils.actionBarOverflow())).perform(click()); onView(withText(R.string.sort)).perform(click()); onView(withText(R.string.random)).perform(click()); } @Test public void testKeepEmptyQueueSorted() { - Espresso.openContextualActionModeOverflowMenu(); + onView(first(EspressoTestUtils.actionBarOverflow())).perform(click()); onView(withText(R.string.sort)).perform(click()); onView(withText(R.string.keep_sorted)).perform(click()); } |