From 0f5600932d5894d5653993d48d925df437fe6d00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Drobni=C4=8D?= Date: Sun, 4 Feb 2024 19:54:46 +0100 Subject: Add next chapter button to notification (#6276) --- .../de/test/antennapod/ui/PreferencesTest.java | 32 +++++----------------- 1 file changed, 7 insertions(+), 25 deletions(-) (limited to 'app/src/androidTest/java/de/test') diff --git a/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java b/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java index 24c20242a..9ba4276be 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java @@ -3,6 +3,7 @@ package de.test.antennapod.ui; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Resources; + import androidx.annotation.StringRes; import androidx.preference.PreferenceManager; import androidx.test.filters.LargeTest; @@ -30,9 +31,7 @@ import static androidx.test.espresso.action.ViewActions.click; import static androidx.test.espresso.action.ViewActions.scrollTo; import static androidx.test.espresso.action.ViewActions.swipeDown; import static androidx.test.espresso.action.ViewActions.swipeUp; -import static androidx.test.espresso.assertion.ViewAssertions.doesNotExist; import static androidx.test.espresso.assertion.ViewAssertions.matches; -import static androidx.test.espresso.matcher.ViewMatchers.isChecked; import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; import static androidx.test.espresso.matcher.ViewMatchers.isRoot; import static androidx.test.espresso.matcher.ViewMatchers.withId; @@ -40,7 +39,6 @@ import static androidx.test.espresso.matcher.ViewMatchers.withText; import static de.test.antennapod.EspressoTestUtils.clickPreference; import static de.test.antennapod.EspressoTestUtils.waitForView; import static java.util.concurrent.TimeUnit.MILLISECONDS; -import static org.hamcrest.Matchers.not; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -80,38 +78,22 @@ public class PreferencesTest { } @Test - public void testSetLockscreenButtons() { + public void testSetNotificationButtons() { clickPreference(R.string.user_interface_label); - String[] buttons = res.getStringArray(R.array.compact_notification_buttons_options); - clickPreference(R.string.pref_compact_notification_buttons_title); + String[] buttons = res.getStringArray(R.array.full_notification_buttons_options); + clickPreference(R.string.pref_full_notification_buttons_title); // First uncheck checkboxes - onView(withText(buttons[0])).perform(click()); - onView(withText(buttons[1])).perform(click()); - - // Now try to check all checkboxes - onView(withText(buttons[0])).perform(click()); onView(withText(buttons[1])).perform(click()); onView(withText(buttons[2])).perform(click()); - // Make sure that the third checkbox is unchecked - onView(withText(buttons[2])).check(matches(not(isChecked()))); - - String snackBarText = String.format(res.getString( - R.string.pref_compact_notification_buttons_dialog_error), 2); - Awaitility.await().ignoreExceptions().atMost(4000, MILLISECONDS) - .until(() -> { - onView(withText(snackBarText)).check(doesNotExist()); - return true; - }); - onView(withText(R.string.confirm_label)).perform(click()); Awaitility.await().atMost(1000, MILLISECONDS) - .until(UserPreferences::showRewindOnCompactNotification); + .until(() -> UserPreferences.showSkipOnFullNotification()); Awaitility.await().atMost(1000, MILLISECONDS) - .until(UserPreferences::showFastForwardOnCompactNotification); + .until(() -> UserPreferences.showNextChapterOnFullNotification()); Awaitility.await().atMost(1000, MILLISECONDS) - .until(() -> !UserPreferences.showSkipOnCompactNotification()); + .until(() -> !UserPreferences.showPlaybackSpeedOnFullNotification()); } @Test -- cgit v1.2.3