diff options
Diffstat (limited to 'app/src/androidTest/java/de/test/antennapod/ui')
-rw-r--r-- | app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java b/app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java index c7520a2e6..be1ed6cc2 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java @@ -24,7 +24,10 @@ import static androidx.test.espresso.Espresso.onView; import static androidx.test.espresso.action.ViewActions.click; import static androidx.test.espresso.action.ViewActions.replaceText; import static androidx.test.espresso.action.ViewActions.scrollTo; +import static androidx.test.espresso.assertion.ViewAssertions.matches; import static androidx.test.espresso.contrib.ActivityResultMatchers.hasResultCode; +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.withId; import static androidx.test.espresso.matcher.ViewMatchers.withText; @@ -32,7 +35,7 @@ import static de.test.antennapod.EspressoTestUtils.clickPreference; import static de.test.antennapod.EspressoTestUtils.openNavDrawer; import static de.test.antennapod.EspressoTestUtils.waitForView; import static junit.framework.TestCase.assertTrue; -import static org.junit.Assert.assertEquals; +import static org.hamcrest.Matchers.allOf; import static org.junit.Assert.assertThat; /** @@ -80,10 +83,6 @@ public class MainActivityTest { onView(isRoot()).perform(waitForView(withId(R.id.butShowSettings), 5000)); } - private String getActionbarTitle() { - return ((MainActivity) solo.getCurrentActivity()).getSupportActionBar().getTitle().toString(); - } - @Test public void testBackButtonBehaviorGoToPage() { openNavDrawer(); @@ -98,7 +97,8 @@ public class MainActivityTest { solo.goBackToActivity(MainActivity.class.getSimpleName()); solo.goBack(); solo.goBack(); - assertEquals(solo.getString(R.string.subscriptions_label), getActionbarTitle()); + onView(allOf(withId(R.id.toolbar), isDisplayed())).check( + matches(hasDescendant(withText(R.string.subscriptions_label)))); solo.goBack(); assertThat(mActivityRule.getActivityResult(), hasResultCode(Activity.RESULT_CANCELED)); } |