From 27f62ae3d4e5284c13d4bf84978f942658c5164e Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Thu, 21 May 2020 21:59:45 +0200 Subject: [PATCH] Disabled auto update for tests --- .../java/de/test/antennapod/EspressoTestUtils.java | 9 +++++++-- .../java/de/test/antennapod/playback/PlaybackTest.java | 1 - .../service/playback/PlaybackServiceMediaPlayerTest.java | 1 - .../java/de/test/antennapod/ui/MainActivityTest.java | 1 - .../java/de/test/antennapod/ui/NavigationDrawerTest.java | 1 - .../java/de/test/antennapod/ui/QueueFragmentTest.java | 1 - .../java/de/test/antennapod/ui/SpeedChangeTest.java | 1 - .../java/de/test/antennapod/ui/TextOnlyFeedsTest.java | 1 - 8 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/src/androidTest/java/de/test/antennapod/EspressoTestUtils.java b/app/src/androidTest/java/de/test/antennapod/EspressoTestUtils.java index beb6ad705..41c8365fb 100644 --- a/app/src/androidTest/java/de/test/antennapod/EspressoTestUtils.java +++ b/app/src/androidTest/java/de/test/antennapod/EspressoTestUtils.java @@ -4,6 +4,7 @@ import android.content.Context; import android.content.Intent; import androidx.annotation.IdRes; import androidx.annotation.StringRes; +import androidx.preference.PreferenceManager; import androidx.test.InstrumentationRegistry; import androidx.test.espresso.PerformException; import androidx.test.espresso.UiController; @@ -16,6 +17,7 @@ import androidx.test.espresso.util.TreeIterables; import android.view.View; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; +import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.service.download.DownloadService; import de.danoeh.antennapod.core.service.playback.PlaybackService; import de.danoeh.antennapod.core.storage.PodDBAdapter; @@ -121,14 +123,17 @@ public class EspressoTestUtils { InstrumentationRegistry.getTargetContext().getSharedPreferences( fileName.replace(".xml", ""), Context.MODE_PRIVATE).edit().clear().commit(); } - } - public static void makeNotFirstRun() { InstrumentationRegistry.getTargetContext().getSharedPreferences(MainActivity.PREF_NAME, Context.MODE_PRIVATE) .edit() .putBoolean(MainActivity.PREF_IS_FIRST_LAUNCH, false) .commit(); + PreferenceManager.getDefaultSharedPreferences(InstrumentationRegistry.getTargetContext()) + .edit() + .putString(UserPreferences.PREF_UPDATE_INTERVAL, "0") + .commit(); + RatingDialog.init(InstrumentationRegistry.getTargetContext()); RatingDialog.saveRated(); } 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 45994d218..0a3a9f13a 100644 --- a/app/src/androidTest/java/de/test/antennapod/playback/PlaybackTest.java +++ b/app/src/androidTest/java/de/test/antennapod/playback/PlaybackTest.java @@ -88,7 +88,6 @@ public class PlaybackTest { context = InstrumentationRegistry.getInstrumentation().getTargetContext(); EspressoTestUtils.clearPreferences(); EspressoTestUtils.clearDatabase(); - EspressoTestUtils.makeNotFirstRun(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); prefs.edit().putString(UserPreferences.PREF_MEDIA_PLAYER, playerToUse).apply(); diff --git a/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java b/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java index a00a9965f..cfce069ec 100644 --- a/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java +++ b/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceMediaPlayerTest.java @@ -64,7 +64,6 @@ public class PlaybackServiceMediaPlayerTest { public void setUp() throws Exception { assertionError = null; EspressoTestUtils.clearPreferences(); - EspressoTestUtils.makeNotFirstRun(); EspressoTestUtils.clearDatabase(); final Context context = getInstrumentation().getTargetContext(); 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 48bdf4dd4..47988d23f 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java @@ -51,7 +51,6 @@ public class MainActivityTest { @Before public void setUp() throws IOException { EspressoTestUtils.clearPreferences(); - EspressoTestUtils.makeNotFirstRun(); EspressoTestUtils.clearDatabase(); mActivityRule.launchActivity(new Intent()); diff --git a/app/src/androidTest/java/de/test/antennapod/ui/NavigationDrawerTest.java b/app/src/androidTest/java/de/test/antennapod/ui/NavigationDrawerTest.java index d5251ace7..bf4dae882 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/NavigationDrawerTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/NavigationDrawerTest.java @@ -63,7 +63,6 @@ public class NavigationDrawerTest { uiTestUtils.setup(); EspressoTestUtils.clearPreferences(); - EspressoTestUtils.makeNotFirstRun(); EspressoTestUtils.clearDatabase(); } 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 ec0d1fa64..b5c7dd0d1 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/QueueFragmentTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/QueueFragmentTest.java @@ -36,7 +36,6 @@ public class QueueFragmentTest { @Before public void setUp() { EspressoTestUtils.clearPreferences(); - EspressoTestUtils.makeNotFirstRun(); EspressoTestUtils.clearDatabase(); EspressoTestUtils.setLastNavFragment(QueueFragment.TAG); activityRule.launchActivity(new Intent()); diff --git a/app/src/androidTest/java/de/test/antennapod/ui/SpeedChangeTest.java b/app/src/androidTest/java/de/test/antennapod/ui/SpeedChangeTest.java index 288b862b8..6c26078c1 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/SpeedChangeTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/SpeedChangeTest.java @@ -55,7 +55,6 @@ public class SpeedChangeTest { @Before public void setUp() throws Exception { EspressoTestUtils.clearPreferences(); - EspressoTestUtils.makeNotFirstRun(); EspressoTestUtils.clearDatabase(); EspressoTestUtils.setLastNavFragment(QueueFragment.TAG); diff --git a/app/src/androidTest/java/de/test/antennapod/ui/TextOnlyFeedsTest.java b/app/src/androidTest/java/de/test/antennapod/ui/TextOnlyFeedsTest.java index 8f1000d43..782bb09d8 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/TextOnlyFeedsTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/TextOnlyFeedsTest.java @@ -42,7 +42,6 @@ public class TextOnlyFeedsTest { @Before public void setUp() throws IOException { EspressoTestUtils.clearPreferences(); - EspressoTestUtils.makeNotFirstRun(); EspressoTestUtils.clearDatabase(); uiTestUtils = new UITestUtils(InstrumentationRegistry.getInstrumentation().getTargetContext());