diff --git a/app/src/androidTest/java/de/test/antennapod/playback/PlaybackBuiltinTest.java b/app/src/androidTest/java/de/test/antennapod/playback/PlaybackBuiltinTest.java deleted file mode 100644 index a80ee41d7..000000000 --- a/app/src/androidTest/java/de/test/antennapod/playback/PlaybackBuiltinTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package de.test.antennapod.playback; - -import androidx.test.filters.LargeTest; -import de.danoeh.antennapod.core.preferences.UserPreferences; -import org.junit.Before; - -/** - * Test cases for starting and ending playback from the MainActivity and AudioPlayerActivity. - */ -@LargeTest -public class PlaybackBuiltinTest extends PlaybackTest { - @Before - public void setUp() throws Exception { - super.setUp(); - UserPreferences.enableBuiltin(); - } -} diff --git a/app/src/androidTest/java/de/test/antennapod/playback/PlaybackExoplayerTest.java b/app/src/androidTest/java/de/test/antennapod/playback/PlaybackExoplayerTest.java deleted file mode 100644 index 0cf73f069..000000000 --- a/app/src/androidTest/java/de/test/antennapod/playback/PlaybackExoplayerTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package de.test.antennapod.playback; - -import androidx.test.filters.LargeTest; -import de.danoeh.antennapod.core.preferences.UserPreferences; -import org.junit.Before; - -/** - * Test cases for starting and ending playback from the MainActivity and AudioPlayerActivity. - */ -@LargeTest -public class PlaybackExoplayerTest extends PlaybackTest { - @Before - public void setUp() throws Exception { - super.setUp(); - UserPreferences.enableExoplayer(); - } -} diff --git a/app/src/androidTest/java/de/test/antennapod/playback/PlaybackSonicTest.java b/app/src/androidTest/java/de/test/antennapod/playback/PlaybackSonicTest.java deleted file mode 100644 index a0fb74809..000000000 --- a/app/src/androidTest/java/de/test/antennapod/playback/PlaybackSonicTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package de.test.antennapod.playback; - -import androidx.test.filters.LargeTest; -import de.danoeh.antennapod.core.preferences.UserPreferences; -import org.junit.Before; - -/** - * Test cases for starting and ending playback from the MainActivity and AudioPlayerActivity. - */ -@LargeTest -public class PlaybackSonicTest extends PlaybackTest { - @Before - public void setUp() throws Exception { - super.setUp(); - UserPreferences.enableSonic(); - } -} diff --git a/app/src/androidTest/java/de/test/antennapod/playback/PlaybackTest.java b/app/src/androidTest/java/de/test/antennapod/playback/PlaybackTest.java index 9732ac215..f04d30a76 100644 --- a/app/src/androidTest/java/de/test/antennapod/playback/PlaybackTest.java +++ b/app/src/androidTest/java/de/test/antennapod/playback/PlaybackTest.java @@ -4,6 +4,7 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.preference.PreferenceManager; +import androidx.test.filters.LargeTest; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.rule.ActivityTestRule; import de.danoeh.antennapod.R; @@ -21,7 +22,11 @@ import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import java.util.Arrays; +import java.util.Collection; import java.util.List; import java.util.concurrent.TimeUnit; @@ -45,14 +50,22 @@ import static org.junit.Assert.assertTrue; /** * Test cases for starting and ending playback from the MainActivity and AudioPlayerActivity. */ -public abstract class PlaybackTest { - +@LargeTest +@RunWith(Parameterized.class) +public class PlaybackTest { @Rule public ActivityTestRule activityTestRule = new ActivityTestRule<>(MainActivity.class, false, false); + @Parameterized.Parameter(value = 0) + public String playerToUse; private UITestUtils uiTestUtils; protected Context context; + @Parameterized.Parameters(name = "{0}") + public static Collection initParameters() { + return Arrays.asList(new Object[][] { { "exoplayer" }, { "builtin" }, { "sonic" } }); + } + @Before public void setUp() throws Exception { context = InstrumentationRegistry.getInstrumentation().getTargetContext(); @@ -60,6 +73,9 @@ public abstract class PlaybackTest { EspressoTestUtils.clearDatabase(); EspressoTestUtils.makeNotFirstRun(); + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + prefs.edit().putString(UserPreferences.PREF_MEDIA_PLAYER, playerToUse).apply(); + uiTestUtils = new UITestUtils(context); uiTestUtils.setup(); }