Merge pull request #4181 from ByteHamster/tests-clear
Disabled auto update for tests
This commit is contained in:
commit
65dc10e8f0
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -51,7 +51,6 @@ public class MainActivityTest {
|
|||
@Before
|
||||
public void setUp() throws IOException {
|
||||
EspressoTestUtils.clearPreferences();
|
||||
EspressoTestUtils.makeNotFirstRun();
|
||||
EspressoTestUtils.clearDatabase();
|
||||
|
||||
mActivityRule.launchActivity(new Intent());
|
||||
|
|
|
@ -63,7 +63,6 @@ public class NavigationDrawerTest {
|
|||
uiTestUtils.setup();
|
||||
|
||||
EspressoTestUtils.clearPreferences();
|
||||
EspressoTestUtils.makeNotFirstRun();
|
||||
EspressoTestUtils.clearDatabase();
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -55,7 +55,6 @@ public class SpeedChangeTest {
|
|||
@Before
|
||||
public void setUp() throws Exception {
|
||||
EspressoTestUtils.clearPreferences();
|
||||
EspressoTestUtils.makeNotFirstRun();
|
||||
EspressoTestUtils.clearDatabase();
|
||||
EspressoTestUtils.setLastNavFragment(QueueFragment.TAG);
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Reference in New Issue