Updated tests
This commit is contained in:
parent
59c2c5b1d6
commit
168b41a825
|
@ -43,7 +43,7 @@ android {
|
||||||
versionCode getMyVersionCode()
|
versionCode getMyVersionCode()
|
||||||
versionName "${getMyVersionName()}"
|
versionName "${getMyVersionName()}"
|
||||||
testApplicationId "de.test.antennapod"
|
testApplicationId "de.test.antennapod"
|
||||||
testInstrumentationRunner "de.test.antennapod.AntennaPodTestRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
generatedDensities = []
|
generatedDensities = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,6 +120,10 @@ android {
|
||||||
additionalParameters "--no-version-vectors"
|
additionalParameters "--no-version-vectors"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testOptions {
|
||||||
|
animationsDisabled = true
|
||||||
|
}
|
||||||
|
|
||||||
flavorDimensions "market"
|
flavorDimensions "market"
|
||||||
productFlavors {
|
productFlavors {
|
||||||
free {
|
free {
|
||||||
|
@ -184,6 +188,11 @@ dependencies {
|
||||||
implementation 'com.github.ByteHamster:SearchPreference:v1.0.8'
|
implementation 'com.github.ByteHamster:SearchPreference:v1.0.8'
|
||||||
|
|
||||||
androidTestImplementation "com.jayway.android.robotium:robotium-solo:$robotiumSoloVersion"
|
androidTestImplementation "com.jayway.android.robotium:robotium-solo:$robotiumSoloVersion"
|
||||||
|
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||||
|
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.2'
|
||||||
|
androidTestImplementation 'com.android.support.test.espresso:espresso-intents:3.0.2'
|
||||||
|
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||||
|
androidTestImplementation 'com.android.support.test:rules:1.0.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
play {
|
play {
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
package de.test.antennapod;
|
|
||||||
|
|
||||||
import android.test.InstrumentationTestRunner;
|
|
||||||
import android.test.suitebuilder.TestSuiteBuilder;
|
|
||||||
|
|
||||||
import junit.framework.TestSuite;
|
|
||||||
|
|
||||||
public class AntennaPodTestRunner extends InstrumentationTestRunner {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TestSuite getAllTests() {
|
|
||||||
return new TestSuiteBuilder(AntennaPodTestRunner.class)
|
|
||||||
.includeAllPackagesUnderHere()
|
|
||||||
.excludePackages("de.test.antennapod.gpodnet")
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
package de.test.antennapod;
|
||||||
|
|
||||||
|
import org.hamcrest.BaseMatcher;
|
||||||
|
import org.hamcrest.Description;
|
||||||
|
import org.hamcrest.Matcher;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
public class NthMatcher {
|
||||||
|
public static <T> Matcher<T> first(final Matcher<T> matcher) {
|
||||||
|
return nth(matcher, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Matcher<T> second(final Matcher<T> matcher) {
|
||||||
|
return nth(matcher, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> Matcher<T> nth(final Matcher<T> matcher, final int index) {
|
||||||
|
return new BaseMatcher<T>() {
|
||||||
|
AtomicInteger count = new AtomicInteger(0);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean matches(final Object item) {
|
||||||
|
if (matcher.matches(item)) {
|
||||||
|
if (count.incrementAndGet() == index) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void describeTo(final Description description) {
|
||||||
|
description.appendText("should return first matching item");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,43 +1,43 @@
|
||||||
package de.test.antennapod.gpodnet;
|
package de.test.antennapod.gpodnet;
|
||||||
|
|
||||||
import android.test.AndroidTestCase;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
import de.danoeh.antennapod.core.gpoddernet.GpodnetService;
|
import de.danoeh.antennapod.core.gpoddernet.GpodnetService;
|
||||||
import de.danoeh.antennapod.core.gpoddernet.GpodnetServiceException;
|
import de.danoeh.antennapod.core.gpoddernet.GpodnetServiceException;
|
||||||
import de.danoeh.antennapod.core.gpoddernet.model.GpodnetDevice;
|
import de.danoeh.antennapod.core.gpoddernet.model.GpodnetDevice;
|
||||||
import de.danoeh.antennapod.core.gpoddernet.model.GpodnetTag;
|
import de.danoeh.antennapod.core.gpoddernet.model.GpodnetTag;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import static java.util.Collections.singletonList;
|
import static java.util.Collections.singletonList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test class for GpodnetService
|
* Test class for GpodnetService
|
||||||
*/
|
*/
|
||||||
public class GPodnetServiceTest extends AndroidTestCase {
|
@Ignore
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class GPodnetServiceTest {
|
||||||
|
|
||||||
private GpodnetService service;
|
private GpodnetService service;
|
||||||
|
|
||||||
private static final String USER = "";
|
private static final String USER = "";
|
||||||
private static final String PW = "";
|
private static final String PW = "";
|
||||||
|
|
||||||
@Override
|
@Before
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() {
|
||||||
super.setUp();
|
|
||||||
service = new GpodnetService();
|
service = new GpodnetService();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void tearDown() throws Exception {
|
|
||||||
super.tearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void authenticate() throws GpodnetServiceException {
|
private void authenticate() throws GpodnetServiceException {
|
||||||
service.authenticate(USER, PW);
|
service.authenticate(USER, PW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testUploadSubscription() throws GpodnetServiceException {
|
public void testUploadSubscription() throws GpodnetServiceException {
|
||||||
authenticate();
|
authenticate();
|
||||||
ArrayList<String> l = new ArrayList<>();
|
ArrayList<String> l = new ArrayList<>();
|
||||||
|
@ -45,6 +45,7 @@ public class GPodnetServiceTest extends AndroidTestCase {
|
||||||
service.uploadSubscriptions(USER, "radio", l);
|
service.uploadSubscriptions(USER, "radio", l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testUploadSubscription2() throws GpodnetServiceException {
|
public void testUploadSubscription2() throws GpodnetServiceException {
|
||||||
authenticate();
|
authenticate();
|
||||||
ArrayList<String> l = new ArrayList<>();
|
ArrayList<String> l = new ArrayList<>();
|
||||||
|
@ -53,6 +54,7 @@ public class GPodnetServiceTest extends AndroidTestCase {
|
||||||
service.uploadSubscriptions(USER, "radio", l);
|
service.uploadSubscriptions(USER, "radio", l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testUploadChanges() throws GpodnetServiceException {
|
public void testUploadChanges() throws GpodnetServiceException {
|
||||||
authenticate();
|
authenticate();
|
||||||
String[] URLS = {"http://bitsundso.de/feed", "http://gamesundso.de/feed", "http://cre.fm/feed/mp3/", "http://freakshow.fm/feed/m4a/"};
|
String[] URLS = {"http://bitsundso.de/feed", "http://gamesundso.de/feed", "http://cre.fm/feed/mp3/", "http://freakshow.fm/feed/m4a/"};
|
||||||
|
@ -63,53 +65,63 @@ public class GPodnetServiceTest extends AndroidTestCase {
|
||||||
service.uploadChanges(USER, "radio", added, removed);
|
service.uploadChanges(USER, "radio", added, removed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetSubscriptionChanges() throws GpodnetServiceException {
|
public void testGetSubscriptionChanges() throws GpodnetServiceException {
|
||||||
authenticate();
|
authenticate();
|
||||||
service.getSubscriptionChanges(USER, "radio", 1362322610L);
|
service.getSubscriptionChanges(USER, "radio", 1362322610L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetSubscriptionsOfUser()
|
public void testGetSubscriptionsOfUser()
|
||||||
throws GpodnetServiceException {
|
throws GpodnetServiceException {
|
||||||
authenticate();
|
authenticate();
|
||||||
service.getSubscriptionsOfUser(USER);
|
service.getSubscriptionsOfUser(USER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetSubscriptionsOfDevice()
|
public void testGetSubscriptionsOfDevice()
|
||||||
throws GpodnetServiceException {
|
throws GpodnetServiceException {
|
||||||
authenticate();
|
authenticate();
|
||||||
service.getSubscriptionsOfDevice(USER, "radio");
|
service.getSubscriptionsOfDevice(USER, "radio");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testConfigureDevices() throws GpodnetServiceException {
|
public void testConfigureDevices() throws GpodnetServiceException {
|
||||||
authenticate();
|
authenticate();
|
||||||
service.configureDevice(USER, "foo", "This is an updated caption",
|
service.configureDevice(USER, "foo", "This is an updated caption",
|
||||||
GpodnetDevice.DeviceType.LAPTOP);
|
GpodnetDevice.DeviceType.LAPTOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetDevices() throws GpodnetServiceException {
|
public void testGetDevices() throws GpodnetServiceException {
|
||||||
authenticate();
|
authenticate();
|
||||||
service.getDevices(USER);
|
service.getDevices(USER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetSuggestions() throws GpodnetServiceException {
|
public void testGetSuggestions() throws GpodnetServiceException {
|
||||||
authenticate();
|
authenticate();
|
||||||
service.getSuggestions(10);
|
service.getSuggestions(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testTags() throws GpodnetServiceException {
|
public void testTags() throws GpodnetServiceException {
|
||||||
service.getTopTags(20);
|
service.getTopTags(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testPodcastForTags() throws GpodnetServiceException {
|
public void testPodcastForTags() throws GpodnetServiceException {
|
||||||
List<GpodnetTag> tags = service.getTopTags(20);
|
List<GpodnetTag> tags = service.getTopTags(20);
|
||||||
service.getPodcastsForTag(tags.get(1),
|
service.getPodcastsForTag(tags.get(1),
|
||||||
10);
|
10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testSearch() throws GpodnetServiceException {
|
public void testSearch() throws GpodnetServiceException {
|
||||||
service.searchPodcasts("linux", 64);
|
service.searchPodcasts("linux", 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testToplist() throws GpodnetServiceException {
|
public void testToplist() throws GpodnetServiceException {
|
||||||
service.getPodcastToplist(10);
|
service.getPodcastToplist(10);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,16 +2,14 @@ package de.test.antennapod.ui;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.test.ActivityInstrumentationTestCase2;
|
import android.support.test.espresso.contrib.DrawerActions;
|
||||||
import android.test.FlakyTest;
|
import android.support.test.espresso.intent.Intents;
|
||||||
|
import android.support.test.filters.FlakyTest;
|
||||||
|
import android.support.test.rule.ActivityTestRule;
|
||||||
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
|
||||||
import com.robotium.solo.Solo;
|
import com.robotium.solo.Solo;
|
||||||
|
import com.robotium.solo.Timeout;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.activity.MainActivity;
|
import de.danoeh.antennapod.activity.MainActivity;
|
||||||
import de.danoeh.antennapod.activity.OnlineFeedViewActivity;
|
import de.danoeh.antennapod.activity.OnlineFeedViewActivity;
|
||||||
|
@ -23,25 +21,46 @@ import de.danoeh.antennapod.fragment.DownloadsFragment;
|
||||||
import de.danoeh.antennapod.fragment.EpisodesFragment;
|
import de.danoeh.antennapod.fragment.EpisodesFragment;
|
||||||
import de.danoeh.antennapod.fragment.PlaybackHistoryFragment;
|
import de.danoeh.antennapod.fragment.PlaybackHistoryFragment;
|
||||||
import de.danoeh.antennapod.fragment.QueueFragment;
|
import de.danoeh.antennapod.fragment.QueueFragment;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static android.support.test.InstrumentationRegistry.getInstrumentation;
|
||||||
|
import static android.support.test.espresso.Espresso.onView;
|
||||||
|
import static android.support.test.espresso.action.ViewActions.click;
|
||||||
|
import static android.support.test.espresso.action.ViewActions.longClick;
|
||||||
|
import static android.support.test.espresso.intent.Intents.intended;
|
||||||
|
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasComponent;
|
||||||
|
import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
||||||
|
import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
||||||
|
import static de.test.antennapod.NthMatcher.first;
|
||||||
|
import static junit.framework.TestCase.assertTrue;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User interface tests for MainActivity
|
* User interface tests for MainActivity
|
||||||
*/
|
*/
|
||||||
public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> {
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class MainActivityTest {
|
||||||
|
|
||||||
private Solo solo;
|
private Solo solo;
|
||||||
private UITestUtils uiTestUtils;
|
private UITestUtils uiTestUtils;
|
||||||
|
|
||||||
private SharedPreferences prefs;
|
private SharedPreferences prefs;
|
||||||
|
|
||||||
public MainActivityTest() {
|
@Rule
|
||||||
super(MainActivity.class);
|
public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Before
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws IOException {
|
||||||
super.setUp();
|
Intents.init();
|
||||||
Context context = getInstrumentation().getTargetContext();
|
Context context = mActivityRule.getActivity();
|
||||||
uiTestUtils = new UITestUtils(context);
|
uiTestUtils = new UITestUtils(context);
|
||||||
uiTestUtils.setup();
|
uiTestUtils.setup();
|
||||||
|
|
||||||
|
@ -54,30 +73,26 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
|
||||||
|
|
||||||
// override first launch preference
|
// override first launch preference
|
||||||
// do this BEFORE calling getActivity()!
|
// do this BEFORE calling getActivity()!
|
||||||
prefs = getInstrumentation().getTargetContext().getSharedPreferences(MainActivity.PREF_NAME, Context.MODE_PRIVATE);
|
prefs = context.getSharedPreferences(MainActivity.PREF_NAME, Context.MODE_PRIVATE);
|
||||||
prefs.edit().putBoolean(MainActivity.PREF_IS_FIRST_LAUNCH, false).commit();
|
prefs.edit().putBoolean(MainActivity.PREF_IS_FIRST_LAUNCH, false).commit();
|
||||||
|
|
||||||
solo = new Solo(getInstrumentation(), getActivity());
|
solo = new Solo(getInstrumentation(), mActivityRule.getActivity());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@After
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
uiTestUtils.tearDown();
|
uiTestUtils.tearDown();
|
||||||
solo.finishOpenedActivities();
|
solo.finishOpenedActivities();
|
||||||
|
Intents.release();
|
||||||
PodDBAdapter.deleteDatabase();
|
PodDBAdapter.deleteDatabase();
|
||||||
|
|
||||||
// reset preferences
|
|
||||||
prefs.edit().clear().commit();
|
prefs.edit().clear().commit();
|
||||||
|
|
||||||
super.tearDown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openNavDrawer() {
|
private void openNavDrawer() {
|
||||||
solo.clickOnImageButton(0);
|
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
|
||||||
getInstrumentation().waitForIdleSync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAddFeed() throws Exception {
|
public void testAddFeed() throws Exception {
|
||||||
uiTestUtils.addHostedFeedData();
|
uiTestUtils.addHostedFeedData();
|
||||||
final Feed feed = uiTestUtils.hostedFeeds.get(0);
|
final Feed feed = uiTestUtils.hostedFeeds.get(0);
|
||||||
|
@ -89,10 +104,12 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
|
||||||
solo.waitForView(R.id.butSubscribe);
|
solo.waitForView(R.id.butSubscribe);
|
||||||
assertEquals(solo.getString(R.string.subscribe_label), solo.getButton(0).getText().toString());
|
assertEquals(solo.getString(R.string.subscribe_label), solo.getButton(0).getText().toString());
|
||||||
solo.clickOnButton(0);
|
solo.clickOnButton(0);
|
||||||
solo.waitForText(solo.getString(R.string.subscribed_label));
|
assertTrue(solo.waitForText(solo.getString(R.string.open_podcast), 0, Timeout.getLargeTimeout(), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@FlakyTest(tolerance = 3)
|
|
||||||
|
@Test
|
||||||
|
@FlakyTest
|
||||||
public void testClickNavDrawer() throws Exception {
|
public void testClickNavDrawer() throws Exception {
|
||||||
uiTestUtils.addLocalFeedData(false);
|
uiTestUtils.addLocalFeedData(false);
|
||||||
|
|
||||||
|
@ -150,57 +167,60 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
|
||||||
return ((MainActivity) solo.getCurrentActivity()).getSupportActionBar().getTitle().toString();
|
return ((MainActivity) solo.getCurrentActivity()).getSupportActionBar().getTitle().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@FlakyTest(tolerance = 3)
|
@Test
|
||||||
|
@FlakyTest
|
||||||
public void testGoToPreferences() {
|
public void testGoToPreferences() {
|
||||||
openNavDrawer();
|
openNavDrawer();
|
||||||
solo.clickOnText(solo.getString(R.string.settings_label));
|
onView(withText(R.string.settings_label)).perform(click());
|
||||||
solo.waitForActivity(PreferenceActivity.class);
|
intended(hasComponent(PreferenceActivity.class.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testDrawerPreferencesHideSomeElements() {
|
public void testDrawerPreferencesHideSomeElements() {
|
||||||
UserPreferences.setHiddenDrawerItems(new ArrayList<>());
|
UserPreferences.setHiddenDrawerItems(new ArrayList<>());
|
||||||
openNavDrawer();
|
openNavDrawer();
|
||||||
solo.clickLongOnText(solo.getString(R.string.queue_label));
|
onView(first(withText(R.string.queue_label))).perform(longClick());
|
||||||
solo.waitForDialogToOpen();
|
onView(withText(R.string.episodes_label)).perform(click());
|
||||||
solo.clickOnText(solo.getString(R.string.episodes_label));
|
onView(withText(R.string.playback_history_label)).perform(click());
|
||||||
solo.clickOnText(solo.getString(R.string.playback_history_label));
|
onView(withText(R.string.confirm_label)).perform(click());
|
||||||
solo.clickOnText(solo.getString(R.string.confirm_label));
|
|
||||||
solo.waitForDialogToClose();
|
|
||||||
List<String> hidden = UserPreferences.getHiddenDrawerItems();
|
List<String> hidden = UserPreferences.getHiddenDrawerItems();
|
||||||
assertEquals(2, hidden.size());
|
assertEquals(2, hidden.size());
|
||||||
assertTrue(hidden.contains(EpisodesFragment.TAG));
|
assertTrue(hidden.contains(EpisodesFragment.TAG));
|
||||||
assertTrue(hidden.contains(PlaybackHistoryFragment.TAG));
|
assertTrue(hidden.contains(PlaybackHistoryFragment.TAG));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testDrawerPreferencesUnhideSomeElements() {
|
public void testDrawerPreferencesUnhideSomeElements() {
|
||||||
List<String> hidden = Arrays.asList(PlaybackHistoryFragment.TAG, DownloadsFragment.TAG);
|
List<String> hidden = Arrays.asList(PlaybackHistoryFragment.TAG, DownloadsFragment.TAG);
|
||||||
UserPreferences.setHiddenDrawerItems(hidden);
|
UserPreferences.setHiddenDrawerItems(hidden);
|
||||||
openNavDrawer();
|
openNavDrawer();
|
||||||
solo.clickLongOnText(solo.getString(R.string.queue_label));
|
onView(first(withText(R.string.queue_label))).perform(longClick());
|
||||||
solo.waitForDialogToOpen();
|
|
||||||
solo.clickOnText(solo.getString(R.string.downloads_label));
|
onView(withText(R.string.downloads_label)).perform(click());
|
||||||
solo.clickOnText(solo.getString(R.string.queue_label));
|
onView(withText(R.string.queue_label)).perform(click());
|
||||||
solo.clickOnText(solo.getString(R.string.confirm_label));
|
onView(withText(R.string.confirm_label)).perform(click());
|
||||||
solo.waitForDialogToClose();
|
|
||||||
hidden = UserPreferences.getHiddenDrawerItems();
|
hidden = UserPreferences.getHiddenDrawerItems();
|
||||||
assertEquals(2, hidden.size());
|
assertEquals(2, hidden.size());
|
||||||
assertTrue(hidden.contains(QueueFragment.TAG));
|
assertTrue(hidden.contains(QueueFragment.TAG));
|
||||||
assertTrue(hidden.contains(PlaybackHistoryFragment.TAG));
|
assertTrue(hidden.contains(PlaybackHistoryFragment.TAG));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testDrawerPreferencesHideAllElements() {
|
public void testDrawerPreferencesHideAllElements() {
|
||||||
UserPreferences.setHiddenDrawerItems(new ArrayList<>());
|
UserPreferences.setHiddenDrawerItems(new ArrayList<>());
|
||||||
String[] titles = getInstrumentation().getTargetContext().getResources().getStringArray(R.array.nav_drawer_titles);
|
String[] titles = mActivityRule.getActivity().getResources().getStringArray(R.array.nav_drawer_titles);
|
||||||
|
|
||||||
openNavDrawer();
|
openNavDrawer();
|
||||||
solo.clickLongOnText(solo.getString(R.string.queue_label));
|
onView(first(withText(R.string.queue_label))).perform(longClick());
|
||||||
solo.waitForDialogToOpen();
|
|
||||||
for (String title : titles) {
|
for (String title : titles) {
|
||||||
solo.clickOnText(title);
|
onView(first(withText(title))).perform(click());
|
||||||
}
|
}
|
||||||
solo.clickOnText(solo.getString(R.string.confirm_label));
|
onView(withText(R.string.confirm_label)).perform(click());
|
||||||
solo.waitForDialogToClose();
|
|
||||||
List<String> hidden = UserPreferences.getHiddenDrawerItems();
|
List<String> hidden = UserPreferences.getHiddenDrawerItems();
|
||||||
assertEquals(titles.length, hidden.size());
|
assertEquals(titles.length, hidden.size());
|
||||||
for (String tag : MainActivity.NAV_DRAWER_TAGS) {
|
for (String tag : MainActivity.NAV_DRAWER_TAGS) {
|
||||||
|
@ -208,19 +228,17 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testDrawerPreferencesHideCurrentElement() {
|
public void testDrawerPreferencesHideCurrentElement() {
|
||||||
UserPreferences.setHiddenDrawerItems(new ArrayList<>());
|
UserPreferences.setHiddenDrawerItems(new ArrayList<>());
|
||||||
|
openNavDrawer();
|
||||||
|
onView(withText(R.string.downloads_label)).perform(click());
|
||||||
|
openNavDrawer();
|
||||||
|
|
||||||
|
onView(first(withText(R.string.queue_label))).perform(longClick());
|
||||||
|
onView(first(withText(R.string.downloads_label))).perform(click());
|
||||||
|
onView(withText(R.string.confirm_label)).perform(click());
|
||||||
|
|
||||||
openNavDrawer();
|
|
||||||
String downloads = solo.getString(R.string.downloads_label);
|
|
||||||
solo.clickOnText(downloads);
|
|
||||||
solo.waitForView(android.R.id.list);
|
|
||||||
openNavDrawer();
|
|
||||||
solo.clickLongOnText(downloads);
|
|
||||||
solo.waitForDialogToOpen();
|
|
||||||
solo.clickOnText(downloads);
|
|
||||||
solo.clickOnText(solo.getString(R.string.confirm_label));
|
|
||||||
solo.waitForDialogToClose();
|
|
||||||
List<String> hidden = UserPreferences.getHiddenDrawerItems();
|
List<String> hidden = UserPreferences.getHiddenDrawerItems();
|
||||||
assertEquals(1, hidden.size());
|
assertEquals(1, hidden.size());
|
||||||
assertTrue(hidden.contains(DownloadsFragment.TAG));
|
assertTrue(hidden.contains(DownloadsFragment.TAG));
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class PlaybackSonicTest extends ActivityInstrumentationTestCase2<MainActi
|
||||||
.clear()
|
.clear()
|
||||||
.putBoolean(UserPreferences.PREF_UNPAUSE_ON_HEADSET_RECONNECT, false)
|
.putBoolean(UserPreferences.PREF_UNPAUSE_ON_HEADSET_RECONNECT, false)
|
||||||
.putBoolean(UserPreferences.PREF_PAUSE_ON_HEADSET_DISCONNECT, false)
|
.putBoolean(UserPreferences.PREF_PAUSE_ON_HEADSET_DISCONNECT, false)
|
||||||
.putBoolean(UserPreferences.PREF_SONIC, true)
|
.putString(UserPreferences.PREF_MEDIA_PLAYER, "sonic")
|
||||||
.commit();
|
.commit();
|
||||||
|
|
||||||
solo = new Solo(getInstrumentation(), getActivity());
|
solo = new Solo(getInstrumentation(), getActivity());
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
package de.test.antennapod.ui;
|
package de.test.antennapod.ui;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.test.ActivityInstrumentationTestCase2;
|
import android.preference.PreferenceManager;
|
||||||
|
import android.support.test.espresso.contrib.RecyclerViewActions;
|
||||||
|
import android.support.test.rule.ActivityTestRule;
|
||||||
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
|
import android.view.View;
|
||||||
import com.robotium.solo.Solo;
|
import com.robotium.solo.Solo;
|
||||||
import com.robotium.solo.Timeout;
|
import com.robotium.solo.Timeout;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.activity.PreferenceActivity;
|
import de.danoeh.antennapod.activity.PreferenceActivity;
|
||||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||||
|
@ -17,36 +16,54 @@ import de.danoeh.antennapod.core.storage.APCleanupAlgorithm;
|
||||||
import de.danoeh.antennapod.core.storage.APNullCleanupAlgorithm;
|
import de.danoeh.antennapod.core.storage.APNullCleanupAlgorithm;
|
||||||
import de.danoeh.antennapod.core.storage.APQueueCleanupAlgorithm;
|
import de.danoeh.antennapod.core.storage.APQueueCleanupAlgorithm;
|
||||||
import de.danoeh.antennapod.core.storage.EpisodeCleanupAlgorithm;
|
import de.danoeh.antennapod.core.storage.EpisodeCleanupAlgorithm;
|
||||||
|
import org.hamcrest.Matcher;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
public class PreferencesTest extends ActivityInstrumentationTestCase2<PreferenceActivity> {
|
import java.util.Arrays;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
private static final String TAG = "PreferencesTest";
|
import static android.support.test.InstrumentationRegistry.getInstrumentation;
|
||||||
|
import static android.support.test.espresso.Espresso.onView;
|
||||||
|
import static android.support.test.espresso.action.ViewActions.click;
|
||||||
|
import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant;
|
||||||
|
import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
||||||
|
import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
||||||
|
import static junit.framework.TestCase.assertEquals;
|
||||||
|
import static junit.framework.TestCase.assertTrue;
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class PreferencesTest {
|
||||||
private Solo solo;
|
private Solo solo;
|
||||||
private Context context;
|
|
||||||
private Resources res;
|
private Resources res;
|
||||||
|
private SharedPreferences prefs;
|
||||||
|
|
||||||
public PreferencesTest() {
|
@Rule
|
||||||
super(PreferenceActivity.class);
|
public ActivityTestRule<PreferenceActivity> mActivityRule = new ActivityTestRule<>(PreferenceActivity.class);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() {
|
||||||
super.setUp();
|
solo = new Solo(getInstrumentation(), mActivityRule.getActivity());
|
||||||
solo = new Solo(getInstrumentation(), getActivity());
|
|
||||||
Timeout.setSmallTimeout(500);
|
Timeout.setSmallTimeout(500);
|
||||||
Timeout.setLargeTimeout(1000);
|
Timeout.setLargeTimeout(1000);
|
||||||
context = getInstrumentation().getTargetContext();
|
res = mActivityRule.getActivity().getResources();
|
||||||
res = getActivity().getResources();
|
UserPreferences.init(mActivityRule.getActivity());
|
||||||
UserPreferences.init(context);
|
|
||||||
|
prefs = PreferenceManager.getDefaultSharedPreferences(mActivityRule.getActivity());
|
||||||
|
prefs.edit().clear();
|
||||||
|
prefs.edit().putBoolean(UserPreferences.PREF_ENABLE_AUTODL, true).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@After
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() {
|
||||||
solo.finishOpenedActivities();
|
solo.finishOpenedActivities();
|
||||||
super.tearDown();
|
prefs.edit().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testSwitchTheme() {
|
public void testSwitchTheme() {
|
||||||
final int theme = UserPreferences.getTheme();
|
final int theme = UserPreferences.getTheme();
|
||||||
int otherTheme;
|
int otherTheme;
|
||||||
|
@ -55,13 +72,13 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
|
||||||
} else {
|
} else {
|
||||||
otherTheme = R.string.pref_theme_title_light;
|
otherTheme = R.string.pref_theme_title_light;
|
||||||
}
|
}
|
||||||
solo.clickOnText(solo.getString(R.string.user_interface_label));
|
clickPreference(withText(R.string.user_interface_label));
|
||||||
solo.clickOnText(solo.getString(R.string.pref_set_theme_title));
|
clickPreference(withText(R.string.pref_set_theme_title));
|
||||||
solo.waitForDialogToOpen();
|
onView(withText(otherTheme)).perform(click());
|
||||||
solo.clickOnText(solo.getString(otherTheme));
|
|
||||||
assertTrue(solo.waitForCondition(() -> UserPreferences.getTheme() != theme, Timeout.getLargeTimeout()));
|
assertTrue(solo.waitForCondition(() -> UserPreferences.getTheme() != theme, Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testSwitchThemeBack() {
|
public void testSwitchThemeBack() {
|
||||||
final int theme = UserPreferences.getTheme();
|
final int theme = UserPreferences.getTheme();
|
||||||
int otherTheme;
|
int otherTheme;
|
||||||
|
@ -70,33 +87,23 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
|
||||||
} else {
|
} else {
|
||||||
otherTheme = R.string.pref_theme_title_light;
|
otherTheme = R.string.pref_theme_title_light;
|
||||||
}
|
}
|
||||||
solo.clickOnText(solo.getString(R.string.user_interface_label));
|
clickPreference(withText(R.string.user_interface_label));
|
||||||
solo.clickOnText(solo.getString(R.string.pref_set_theme_title));
|
clickPreference(withText(R.string.pref_set_theme_title));
|
||||||
solo.waitForDialogToOpen(1000);
|
onView(withText(otherTheme)).perform(click());
|
||||||
solo.clickOnText(solo.getString(otherTheme));
|
|
||||||
assertTrue(solo.waitForCondition(() -> UserPreferences.getTheme() != theme, Timeout.getLargeTimeout()));
|
assertTrue(solo.waitForCondition(() -> UserPreferences.getTheme() != theme, Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testExpandNotification() {
|
@Test
|
||||||
solo.clickOnText(solo.getString(R.string.user_interface_label));
|
|
||||||
final int priority = UserPreferences.getNotifyPriority();
|
|
||||||
solo.clickOnText(solo.getString(R.string.pref_expandNotify_title));
|
|
||||||
assertTrue(solo.waitForCondition(() -> priority != UserPreferences.getNotifyPriority(), Timeout.getLargeTimeout()));
|
|
||||||
solo.clickOnText(solo.getString(R.string.pref_expandNotify_title));
|
|
||||||
assertTrue(solo.waitForCondition(() -> priority == UserPreferences.getNotifyPriority(), Timeout.getLargeTimeout()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testEnablePersistentPlaybackControls() {
|
public void testEnablePersistentPlaybackControls() {
|
||||||
solo.clickOnText(solo.getString(R.string.user_interface_label));
|
|
||||||
final boolean persistNotify = UserPreferences.isPersistNotify();
|
final boolean persistNotify = UserPreferences.isPersistNotify();
|
||||||
solo.scrollDown();
|
clickPreference(withText(R.string.user_interface_label));
|
||||||
solo.scrollDown();
|
clickPreference(withText(R.string.pref_persistNotify_title));
|
||||||
solo.clickOnText(solo.getString(R.string.pref_persistNotify_title));
|
|
||||||
assertTrue(solo.waitForCondition(() -> persistNotify != UserPreferences.isPersistNotify(), Timeout.getLargeTimeout()));
|
assertTrue(solo.waitForCondition(() -> persistNotify != UserPreferences.isPersistNotify(), Timeout.getLargeTimeout()));
|
||||||
solo.clickOnText(solo.getString(R.string.pref_persistNotify_title));
|
clickPreference(withText(R.string.pref_persistNotify_title));
|
||||||
assertTrue(solo.waitForCondition(() -> persistNotify == UserPreferences.isPersistNotify(), Timeout.getLargeTimeout()));
|
assertTrue(solo.waitForCondition(() -> persistNotify == UserPreferences.isPersistNotify(), Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testSetLockscreenButtons() {
|
public void testSetLockscreenButtons() {
|
||||||
solo.clickOnText(solo.getString(R.string.user_interface_label));
|
solo.clickOnText(solo.getString(R.string.user_interface_label));
|
||||||
solo.scrollDown();
|
solo.scrollDown();
|
||||||
|
@ -123,6 +130,7 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
|
||||||
assertTrue(solo.waitForCondition(() -> !UserPreferences.showSkipOnCompactNotification(), Timeout.getLargeTimeout()));
|
assertTrue(solo.waitForCondition(() -> !UserPreferences.showSkipOnCompactNotification(), Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testEnqueueAtFront() {
|
public void testEnqueueAtFront() {
|
||||||
solo.clickOnText(solo.getString(R.string.playback_pref));
|
solo.clickOnText(solo.getString(R.string.playback_pref));
|
||||||
final boolean enqueueAtFront = UserPreferences.enqueueAtFront();
|
final boolean enqueueAtFront = UserPreferences.enqueueAtFront();
|
||||||
|
@ -134,6 +142,7 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
|
||||||
assertTrue(solo.waitForCondition(() -> enqueueAtFront == UserPreferences.enqueueAtFront(), Timeout.getLargeTimeout()));
|
assertTrue(solo.waitForCondition(() -> enqueueAtFront == UserPreferences.enqueueAtFront(), Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testHeadPhonesDisconnect() {
|
public void testHeadPhonesDisconnect() {
|
||||||
solo.clickOnText(solo.getString(R.string.playback_pref));
|
solo.clickOnText(solo.getString(R.string.playback_pref));
|
||||||
final boolean pauseOnHeadsetDisconnect = UserPreferences.isPauseOnHeadsetDisconnect();
|
final boolean pauseOnHeadsetDisconnect = UserPreferences.isPauseOnHeadsetDisconnect();
|
||||||
|
@ -143,6 +152,7 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
|
||||||
assertTrue(solo.waitForCondition(() -> pauseOnHeadsetDisconnect == UserPreferences.isPauseOnHeadsetDisconnect(), Timeout.getLargeTimeout()));
|
assertTrue(solo.waitForCondition(() -> pauseOnHeadsetDisconnect == UserPreferences.isPauseOnHeadsetDisconnect(), Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testHeadPhonesReconnect() {
|
public void testHeadPhonesReconnect() {
|
||||||
solo.clickOnText(solo.getString(R.string.playback_pref));
|
solo.clickOnText(solo.getString(R.string.playback_pref));
|
||||||
if(UserPreferences.isPauseOnHeadsetDisconnect() == false) {
|
if(UserPreferences.isPauseOnHeadsetDisconnect() == false) {
|
||||||
|
@ -156,6 +166,7 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
|
||||||
assertTrue(solo.waitForCondition(() -> unpauseOnHeadsetReconnect == UserPreferences.isUnpauseOnHeadsetReconnect(), Timeout.getLargeTimeout()));
|
assertTrue(solo.waitForCondition(() -> unpauseOnHeadsetReconnect == UserPreferences.isUnpauseOnHeadsetReconnect(), Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testBluetoothReconnect() {
|
public void testBluetoothReconnect() {
|
||||||
solo.clickOnText(solo.getString(R.string.playback_pref));
|
solo.clickOnText(solo.getString(R.string.playback_pref));
|
||||||
if(UserPreferences.isPauseOnHeadsetDisconnect() == false) {
|
if(UserPreferences.isPauseOnHeadsetDisconnect() == false) {
|
||||||
|
@ -169,6 +180,7 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
|
||||||
assertTrue(solo.waitForCondition(() -> unpauseOnBluetoothReconnect == UserPreferences.isUnpauseOnBluetoothReconnect(), Timeout.getLargeTimeout()));
|
assertTrue(solo.waitForCondition(() -> unpauseOnBluetoothReconnect == UserPreferences.isUnpauseOnBluetoothReconnect(), Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testContinuousPlayback() {
|
public void testContinuousPlayback() {
|
||||||
solo.clickOnText(solo.getString(R.string.playback_pref));
|
solo.clickOnText(solo.getString(R.string.playback_pref));
|
||||||
final boolean continuousPlayback = UserPreferences.isFollowQueue();
|
final boolean continuousPlayback = UserPreferences.isFollowQueue();
|
||||||
|
@ -180,6 +192,7 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
|
||||||
assertTrue(solo.waitForCondition(() -> continuousPlayback == UserPreferences.isFollowQueue(), Timeout.getLargeTimeout()));
|
assertTrue(solo.waitForCondition(() -> continuousPlayback == UserPreferences.isFollowQueue(), Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAutoDelete() {
|
public void testAutoDelete() {
|
||||||
solo.clickOnText(solo.getString(R.string.storage_pref));
|
solo.clickOnText(solo.getString(R.string.storage_pref));
|
||||||
final boolean autoDelete = UserPreferences.isAutoDelete();
|
final boolean autoDelete = UserPreferences.isAutoDelete();
|
||||||
|
@ -189,17 +202,15 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
|
||||||
assertTrue(solo.waitForCondition(() -> autoDelete == UserPreferences.isAutoDelete(), Timeout.getLargeTimeout()));
|
assertTrue(solo.waitForCondition(() -> autoDelete == UserPreferences.isAutoDelete(), Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testPlaybackSpeeds() {
|
public void testPlaybackSpeeds() {
|
||||||
solo.clickOnText(solo.getString(R.string.playback_pref));
|
clickPreference(withText(R.string.playback_pref));
|
||||||
solo.scrollDown();
|
clickPreference(withText(R.string.pref_playback_speed_title));
|
||||||
solo.scrollDown();
|
|
||||||
solo.clickOnText(solo.getString(R.string.pref_playback_speed_title));
|
|
||||||
solo.waitForDialogToOpen(1000);
|
|
||||||
assertTrue(solo.searchText(res.getStringArray(R.array.playback_speed_values)[0]));
|
assertTrue(solo.searchText(res.getStringArray(R.array.playback_speed_values)[0]));
|
||||||
solo.clickOnText(solo.getString(R.string.cancel_label));
|
onView(withText(R.string.cancel_label)).perform(click());
|
||||||
solo.waitForDialogToClose(1000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testPauseForInterruptions() {
|
public void testPauseForInterruptions() {
|
||||||
solo.clickOnText(solo.getString(R.string.playback_pref));
|
solo.clickOnText(solo.getString(R.string.playback_pref));
|
||||||
final boolean pauseForFocusLoss = UserPreferences.shouldPauseForFocusLoss();
|
final boolean pauseForFocusLoss = UserPreferences.shouldPauseForFocusLoss();
|
||||||
|
@ -209,6 +220,7 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
|
||||||
assertTrue(solo.waitForCondition(() -> pauseForFocusLoss == UserPreferences.shouldPauseForFocusLoss(), Timeout.getLargeTimeout()));
|
assertTrue(solo.waitForCondition(() -> pauseForFocusLoss == UserPreferences.shouldPauseForFocusLoss(), Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testDisableUpdateInterval() {
|
public void testDisableUpdateInterval() {
|
||||||
solo.clickOnText(solo.getString(R.string.network_pref));
|
solo.clickOnText(solo.getString(R.string.network_pref));
|
||||||
solo.clickOnText(solo.getString(R.string.pref_autoUpdateIntervallOrTime_sum));
|
solo.clickOnText(solo.getString(R.string.pref_autoUpdateIntervallOrTime_sum));
|
||||||
|
@ -217,31 +229,31 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
|
||||||
assertTrue(solo.waitForCondition(() -> UserPreferences.getUpdateInterval() == 0, 1000));
|
assertTrue(solo.waitForCondition(() -> UserPreferences.getUpdateInterval() == 0, 1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testSetUpdateInterval() {
|
public void testSetUpdateInterval() {
|
||||||
solo.clickOnText(solo.getString(R.string.network_pref));
|
clickPreference(withText(R.string.network_pref));
|
||||||
solo.clickOnText(solo.getString(R.string.pref_autoUpdateIntervallOrTime_title));
|
clickPreference(withText(R.string.pref_autoUpdateIntervallOrTime_title));
|
||||||
solo.waitForDialogToOpen();
|
onView(withText(R.string.pref_autoUpdateIntervallOrTime_Interval)).perform(click());
|
||||||
solo.clickOnText(solo.getString(R.string.pref_autoUpdateIntervallOrTime_Interval));
|
|
||||||
solo.waitForDialogToOpen();
|
|
||||||
String search = "12 " + solo.getString(R.string.pref_update_interval_hours_plural);
|
String search = "12 " + solo.getString(R.string.pref_update_interval_hours_plural);
|
||||||
solo.clickOnText(search);
|
onView(withText(search)).perform(click());
|
||||||
solo.waitForDialogToClose();
|
|
||||||
assertTrue(solo.waitForCondition(() -> UserPreferences.getUpdateInterval() ==
|
assertTrue(solo.waitForCondition(() -> UserPreferences.getUpdateInterval() ==
|
||||||
TimeUnit.HOURS.toMillis(12), Timeout.getLargeTimeout()));
|
TimeUnit.HOURS.toMillis(12), Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testMobileUpdates() {
|
public void testMobileUpdates() {
|
||||||
solo.clickOnText(solo.getString(R.string.network_pref));
|
clickPreference(withText(R.string.network_pref));
|
||||||
final boolean mobileUpdates = UserPreferences.isAllowMobileUpdate();
|
final boolean mobileUpdates = UserPreferences.isAllowMobileUpdate();
|
||||||
solo.clickOnText(solo.getString(R.string.pref_mobileUpdate_title));
|
clickPreference(withText(R.string.pref_mobileUpdate_title));
|
||||||
assertTrue(solo.waitForCondition(() -> mobileUpdates != UserPreferences.isAllowMobileUpdate(), Timeout.getLargeTimeout()));
|
assertTrue(solo.waitForCondition(() -> mobileUpdates != UserPreferences.isAllowMobileUpdate(), Timeout.getLargeTimeout()));
|
||||||
solo.clickOnText(solo.getString(R.string.pref_mobileUpdate_title));
|
clickPreference(withText(R.string.pref_mobileUpdate_title));
|
||||||
assertTrue(solo.waitForCondition(() -> mobileUpdates == UserPreferences.isAllowMobileUpdate(), Timeout.getLargeTimeout()));
|
assertTrue(solo.waitForCondition(() -> mobileUpdates == UserPreferences.isAllowMobileUpdate(), Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testSetSequentialDownload() {
|
public void testSetSequentialDownload() {
|
||||||
solo.clickOnText(solo.getString(R.string.network_pref));
|
clickPreference(withText(R.string.network_pref));
|
||||||
solo.clickOnText(solo.getString(R.string.pref_parallel_downloads_title));
|
clickPreference(withText(R.string.pref_parallel_downloads_title));
|
||||||
solo.waitForDialogToOpen();
|
solo.waitForDialogToOpen();
|
||||||
solo.clearEditText(0);
|
solo.clearEditText(0);
|
||||||
solo.enterText(0, "1");
|
solo.enterText(0, "1");
|
||||||
|
@ -249,9 +261,10 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
|
||||||
assertTrue(solo.waitForCondition(() -> UserPreferences.getParallelDownloads() == 1, Timeout.getLargeTimeout()));
|
assertTrue(solo.waitForCondition(() -> UserPreferences.getParallelDownloads() == 1, Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testSetParallelDownloads() {
|
public void testSetParallelDownloads() {
|
||||||
solo.clickOnText(solo.getString(R.string.network_pref));
|
clickPreference(withText(R.string.network_pref));
|
||||||
solo.clickOnText(solo.getString(R.string.pref_parallel_downloads_title));
|
clickPreference(withText(R.string.pref_parallel_downloads_title));
|
||||||
solo.waitForDialogToOpen();
|
solo.waitForDialogToOpen();
|
||||||
solo.clearEditText(0);
|
solo.clearEditText(0);
|
||||||
solo.enterText(0, "10");
|
solo.enterText(0, "10");
|
||||||
|
@ -259,50 +272,50 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
|
||||||
assertTrue(solo.waitForCondition(() -> UserPreferences.getParallelDownloads() == 10, Timeout.getLargeTimeout()));
|
assertTrue(solo.waitForCondition(() -> UserPreferences.getParallelDownloads() == 10, Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testSetParallelDownloadsInvalidInput() {
|
public void testSetParallelDownloadsInvalidInput() {
|
||||||
solo.clickOnText(solo.getString(R.string.network_pref));
|
clickPreference(withText(R.string.network_pref));
|
||||||
solo.clickOnText(solo.getString(R.string.pref_parallel_downloads_title));
|
clickPreference(withText(R.string.pref_parallel_downloads_title));
|
||||||
solo.waitForDialogToOpen();
|
solo.waitForDialogToOpen();
|
||||||
solo.clearEditText(0);
|
solo.clearEditText(0);
|
||||||
solo.enterText(0, "0");
|
solo.enterText(0, "0");
|
||||||
assertEquals("1", solo.getEditText(0).getText().toString());
|
assertEquals("", solo.getEditText(0).getText().toString());
|
||||||
solo.clearEditText(0);
|
solo.clearEditText(0);
|
||||||
solo.enterText(0, "100");
|
solo.enterText(0, "100");
|
||||||
assertEquals("50", solo.getEditText(0).getText().toString());
|
assertEquals("", solo.getEditText(0).getText().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testSetEpisodeCache() {
|
public void testSetEpisodeCache() {
|
||||||
String[] entries = res.getStringArray(R.array.episode_cache_size_entries);
|
String[] entries = res.getStringArray(R.array.episode_cache_size_entries);
|
||||||
String[] values = res.getStringArray(R.array.episode_cache_size_values);
|
String[] values = res.getStringArray(R.array.episode_cache_size_values);
|
||||||
String entry = entries[entries.length/2];
|
String entry = entries[entries.length/2];
|
||||||
final int value = Integer.valueOf(values[values.length/2]);
|
final int value = Integer.valueOf(values[values.length/2]);
|
||||||
solo.clickOnText(solo.getString(R.string.network_pref));
|
clickPreference(withText(R.string.network_pref));
|
||||||
solo.clickOnText(solo.getString(R.string.pref_automatic_download_title));
|
clickPreference(withText(R.string.pref_automatic_download_title));
|
||||||
solo.waitForText(solo.getString(R.string.pref_automatic_download_title));
|
clickPreference(withText(R.string.pref_episode_cache_title));
|
||||||
solo.clickOnText(solo.getString(R.string.pref_episode_cache_title));
|
|
||||||
solo.waitForDialogToOpen();
|
solo.waitForDialogToOpen();
|
||||||
solo.clickOnText(entry);
|
solo.clickOnText(entry);
|
||||||
assertTrue(solo.waitForCondition(() -> UserPreferences.getEpisodeCacheSize() == value, Timeout.getLargeTimeout()));
|
assertTrue(solo.waitForCondition(() -> UserPreferences.getEpisodeCacheSize() == value, Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testSetEpisodeCacheMin() {
|
public void testSetEpisodeCacheMin() {
|
||||||
String[] entries = res.getStringArray(R.array.episode_cache_size_entries);
|
String[] entries = res.getStringArray(R.array.episode_cache_size_entries);
|
||||||
String[] values = res.getStringArray(R.array.episode_cache_size_values);
|
String[] values = res.getStringArray(R.array.episode_cache_size_values);
|
||||||
String minEntry = entries[0];
|
String minEntry = entries[0];
|
||||||
final int minValue = Integer.valueOf(values[0]);
|
final int minValue = Integer.valueOf(values[0]);
|
||||||
solo.clickOnText(solo.getString(R.string.network_pref));
|
|
||||||
solo.clickOnText(solo.getString(R.string.pref_automatic_download_title));
|
clickPreference(withText(R.string.network_pref));
|
||||||
solo.waitForText(solo.getString(R.string.pref_automatic_download_title));
|
clickPreference(withText(R.string.pref_automatic_download_title));
|
||||||
if(!UserPreferences.isEnableAutodownload()) {
|
clickPreference(withText(R.string.pref_episode_cache_title));
|
||||||
solo.clickOnText(solo.getString(R.string.pref_automatic_download_title));
|
|
||||||
}
|
|
||||||
solo.clickOnText(solo.getString(R.string.pref_episode_cache_title));
|
|
||||||
solo.waitForDialogToOpen(1000);
|
solo.waitForDialogToOpen(1000);
|
||||||
solo.scrollUp();
|
solo.scrollUp();
|
||||||
solo.clickOnText(minEntry);
|
solo.clickOnText(minEntry);
|
||||||
assertTrue(solo.waitForCondition(() -> UserPreferences.getEpisodeCacheSize() == minValue, Timeout.getLargeTimeout()));
|
assertTrue(solo.waitForCondition(() -> UserPreferences.getEpisodeCacheSize() == minValue, Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testSetEpisodeCacheMax() {
|
public void testSetEpisodeCacheMax() {
|
||||||
String[] entries = res.getStringArray(R.array.episode_cache_size_entries);
|
String[] entries = res.getStringArray(R.array.episode_cache_size_entries);
|
||||||
String[] values = res.getStringArray(R.array.episode_cache_size_values);
|
String[] values = res.getStringArray(R.array.episode_cache_size_values);
|
||||||
|
@ -311,24 +324,22 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
|
||||||
solo.clickOnText(solo.getString(R.string.network_pref));
|
solo.clickOnText(solo.getString(R.string.network_pref));
|
||||||
solo.clickOnText(solo.getString(R.string.pref_automatic_download_title));
|
solo.clickOnText(solo.getString(R.string.pref_automatic_download_title));
|
||||||
solo.waitForText(solo.getString(R.string.pref_automatic_download_title));
|
solo.waitForText(solo.getString(R.string.pref_automatic_download_title));
|
||||||
if(!UserPreferences.isEnableAutodownload()) {
|
|
||||||
solo.clickOnText(solo.getString(R.string.pref_automatic_download_title));
|
|
||||||
}
|
|
||||||
solo.clickOnText(solo.getString(R.string.pref_episode_cache_title));
|
solo.clickOnText(solo.getString(R.string.pref_episode_cache_title));
|
||||||
solo.waitForDialogToOpen();
|
solo.waitForDialogToOpen();
|
||||||
solo.clickOnText(maxEntry);
|
solo.clickOnText(maxEntry);
|
||||||
assertTrue(solo.waitForCondition(() -> UserPreferences.getEpisodeCacheSize() == maxValue, Timeout.getLargeTimeout()));
|
assertTrue(solo.waitForCondition(() -> UserPreferences.getEpisodeCacheSize() == maxValue, Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAutomaticDownload() {
|
public void testAutomaticDownload() {
|
||||||
final boolean automaticDownload = UserPreferences.isEnableAutodownload();
|
final boolean automaticDownload = UserPreferences.isEnableAutodownload();
|
||||||
solo.clickOnText(solo.getString(R.string.network_pref));
|
clickPreference(withText(R.string.network_pref));
|
||||||
solo.clickOnText(solo.getString(R.string.pref_automatic_download_title));
|
clickPreference(withText(R.string.pref_automatic_download_title));
|
||||||
solo.waitForText(solo.getString(R.string.pref_automatic_download_title));
|
clickPreference(withText(R.string.pref_automatic_download_title));
|
||||||
solo.clickOnText(solo.getString(R.string.pref_automatic_download_title));
|
|
||||||
assertTrue(solo.waitForCondition(() -> automaticDownload != UserPreferences.isEnableAutodownload(), Timeout.getLargeTimeout()));
|
assertTrue(solo.waitForCondition(() -> automaticDownload != UserPreferences.isEnableAutodownload(), Timeout.getLargeTimeout()));
|
||||||
if(UserPreferences.isEnableAutodownload() == false) {
|
if(UserPreferences.isEnableAutodownload() == false) {
|
||||||
solo.clickOnText(solo.getString(R.string.pref_automatic_download_title));
|
clickPreference(withText(R.string.pref_automatic_download_title));
|
||||||
}
|
}
|
||||||
assertTrue(solo.waitForCondition(() -> UserPreferences.isEnableAutodownload() == true, Timeout.getLargeTimeout()));
|
assertTrue(solo.waitForCondition(() -> UserPreferences.isEnableAutodownload() == true, Timeout.getLargeTimeout()));
|
||||||
final boolean enableAutodownloadOnBattery = UserPreferences.isEnableAutodownloadOnBattery();
|
final boolean enableAutodownloadOnBattery = UserPreferences.isEnableAutodownloadOnBattery();
|
||||||
|
@ -343,6 +354,7 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
|
||||||
assertTrue(solo.waitForCondition(() -> enableWifiFilter == UserPreferences.isEnableAutodownloadWifiFilter(), Timeout.getLargeTimeout()));
|
assertTrue(solo.waitForCondition(() -> enableWifiFilter == UserPreferences.isEnableAutodownloadWifiFilter(), Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testEpisodeCleanupQueueOnly() {
|
public void testEpisodeCleanupQueueOnly() {
|
||||||
solo.clickOnText(solo.getString(R.string.network_pref));
|
solo.clickOnText(solo.getString(R.string.network_pref));
|
||||||
solo.clickOnText(solo.getString(R.string.pref_automatic_download_title));
|
solo.clickOnText(solo.getString(R.string.pref_automatic_download_title));
|
||||||
|
@ -356,6 +368,7 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
|
||||||
Timeout.getLargeTimeout()));
|
Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testEpisodeCleanupNeverAlg() {
|
public void testEpisodeCleanupNeverAlg() {
|
||||||
solo.clickOnText(solo.getString(R.string.network_pref));
|
solo.clickOnText(solo.getString(R.string.network_pref));
|
||||||
solo.clickOnText(solo.getString(R.string.pref_automatic_download_title));
|
solo.clickOnText(solo.getString(R.string.pref_automatic_download_title));
|
||||||
|
@ -369,6 +382,7 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
|
||||||
Timeout.getLargeTimeout()));
|
Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testEpisodeCleanupClassic() {
|
public void testEpisodeCleanupClassic() {
|
||||||
solo.clickOnText(solo.getString(R.string.network_pref));
|
solo.clickOnText(solo.getString(R.string.network_pref));
|
||||||
solo.clickOnText(solo.getString(R.string.pref_automatic_download_title));
|
solo.clickOnText(solo.getString(R.string.pref_automatic_download_title));
|
||||||
|
@ -386,12 +400,14 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
|
||||||
Timeout.getLargeTimeout()));
|
Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testEpisodeCleanupNumDays() {
|
public void testEpisodeCleanupNumDays() {
|
||||||
solo.clickOnText(solo.getString(R.string.network_pref));
|
clickPreference(withText(R.string.network_pref));
|
||||||
solo.clickOnText(solo.getString(R.string.pref_automatic_download_title));
|
clickPreference(withText(R.string.pref_automatic_download_title));
|
||||||
solo.clickOnText(solo.getString(R.string.pref_episode_cleanup_title));
|
clickPreference(withText(R.string.pref_episode_cleanup_title));
|
||||||
solo.waitForText(solo.getString(R.string.episode_cleanup_after_listening));
|
solo.waitForDialogToOpen();
|
||||||
solo.clickOnText("5");
|
String search = res.getQuantityString(R.plurals.episode_cleanup_days_after_listening, 5, 5);
|
||||||
|
onView(withText(search)).perform(click());
|
||||||
assertTrue(solo.waitForCondition(() -> {
|
assertTrue(solo.waitForCondition(() -> {
|
||||||
EpisodeCleanupAlgorithm alg = UserPreferences.getEpisodeCleanupAlgorithm();
|
EpisodeCleanupAlgorithm alg = UserPreferences.getEpisodeCleanupAlgorithm();
|
||||||
if (alg instanceof APCleanupAlgorithm) {
|
if (alg instanceof APCleanupAlgorithm) {
|
||||||
|
@ -403,15 +419,13 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
|
||||||
Timeout.getLargeTimeout()));
|
Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testRewindChange() {
|
public void testRewindChange() {
|
||||||
int seconds = UserPreferences.getRewindSecs();
|
int seconds = UserPreferences.getRewindSecs();
|
||||||
int deltas[] = res.getIntArray(R.array.seek_delta_values);
|
int deltas[] = res.getIntArray(R.array.seek_delta_values);
|
||||||
|
|
||||||
solo.clickOnText(solo.getString(R.string.playback_pref));
|
clickPreference(withText(R.string.playback_pref));
|
||||||
solo.scrollDown();
|
clickPreference(withText(R.string.pref_rewind));
|
||||||
solo.scrollDown();
|
|
||||||
solo.clickOnText(solo.getString(R.string.pref_rewind));
|
|
||||||
solo.waitForDialogToOpen();
|
solo.waitForDialogToOpen();
|
||||||
|
|
||||||
int currentIndex = Arrays.binarySearch(deltas, seconds);
|
int currentIndex = Arrays.binarySearch(deltas, seconds);
|
||||||
|
@ -419,24 +433,22 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
|
||||||
|
|
||||||
// Find next value (wrapping around to next)
|
// Find next value (wrapping around to next)
|
||||||
int newIndex = (currentIndex + 1) % deltas.length;
|
int newIndex = (currentIndex + 1) % deltas.length;
|
||||||
|
onView(withText(String.valueOf(deltas[newIndex]) + " seconds")).perform(click());
|
||||||
solo.clickOnText(String.valueOf(deltas[newIndex]) + " seconds");
|
onView(withText("Confirm")).perform(click());
|
||||||
solo.clickOnButton("Confirm");
|
|
||||||
|
|
||||||
solo.waitForDialogToClose();
|
solo.waitForDialogToClose();
|
||||||
assertTrue(solo.waitForCondition(() -> UserPreferences.getRewindSecs() == deltas[newIndex],
|
assertTrue(solo.waitForCondition(() -> UserPreferences.getRewindSecs() == deltas[newIndex],
|
||||||
Timeout.getLargeTimeout()));
|
Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testFastForwardChange() {
|
public void testFastForwardChange() {
|
||||||
solo.clickOnText(solo.getString(R.string.playback_pref));
|
clickPreference(withText(R.string.playback_pref));
|
||||||
solo.scrollDown();
|
|
||||||
solo.scrollDown();
|
|
||||||
for (int i = 2; i > 0; i--) { // repeat twice to catch any error where fastforward is tracking rewind
|
for (int i = 2; i > 0; i--) { // repeat twice to catch any error where fastforward is tracking rewind
|
||||||
int seconds = UserPreferences.getFastForwardSecs();
|
int seconds = UserPreferences.getFastForwardSecs();
|
||||||
int deltas[] = res.getIntArray(R.array.seek_delta_values);
|
int deltas[] = res.getIntArray(R.array.seek_delta_values);
|
||||||
|
|
||||||
solo.clickOnText(solo.getString(R.string.pref_fast_forward));
|
clickPreference(withText(R.string.pref_fast_forward));
|
||||||
solo.waitForDialogToOpen();
|
solo.waitForDialogToOpen();
|
||||||
|
|
||||||
int currentIndex = Arrays.binarySearch(deltas, seconds);
|
int currentIndex = Arrays.binarySearch(deltas, seconds);
|
||||||
|
@ -445,12 +457,17 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference
|
||||||
// Find next value (wrapping around to next)
|
// Find next value (wrapping around to next)
|
||||||
int newIndex = (currentIndex + 1) % deltas.length;
|
int newIndex = (currentIndex + 1) % deltas.length;
|
||||||
|
|
||||||
solo.clickOnText(String.valueOf(deltas[newIndex]) + " seconds");
|
onView(withText(String.valueOf(deltas[newIndex]) + " seconds")).perform(click());
|
||||||
solo.clickOnButton("Confirm");
|
onView(withText("Confirm")).perform(click());
|
||||||
|
|
||||||
solo.waitForDialogToClose();
|
solo.waitForDialogToClose();
|
||||||
assertTrue(solo.waitForCondition(() -> UserPreferences.getFastForwardSecs() == deltas[newIndex],
|
assertTrue(solo.waitForCondition(() -> UserPreferences.getFastForwardSecs() == deltas[newIndex],
|
||||||
Timeout.getLargeTimeout()));
|
Timeout.getLargeTimeout()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void clickPreference(Matcher<View> matcher) {
|
||||||
|
onView(withId(R.id.list))
|
||||||
|
.perform(RecyclerViewActions.actionOnItem(hasDescendant(matcher), click()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ project.ext {
|
||||||
minSdkVersion = 14
|
minSdkVersion = 14
|
||||||
targetSdkVersion = 26
|
targetSdkVersion = 26
|
||||||
|
|
||||||
supportVersion = "26.1.0"
|
supportVersion = "27.1.1"
|
||||||
awaitilityVersion = "3.1.2"
|
awaitilityVersion = "3.1.2"
|
||||||
commonsioVersion = "2.5"
|
commonsioVersion = "2.5"
|
||||||
commonslangVersion = "3.6"
|
commonslangVersion = "3.6"
|
||||||
|
|
|
@ -10,7 +10,7 @@ android {
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
testApplicationId "de.danoeh.antennapod.core.tests"
|
testApplicationId "de.danoeh.antennapod.core.tests"
|
||||||
testInstrumentationRunner "de.danoeh.antennapod.core.AntennaPodTestRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
|
@ -83,6 +83,9 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
|
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||||
|
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||||
|
androidTestImplementation 'com.android.support.test:rules:1.0.2'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
package de.danoeh.antennapod.core;
|
|
||||||
|
|
||||||
import android.test.InstrumentationTestRunner;
|
|
||||||
import android.test.suitebuilder.TestSuiteBuilder;
|
|
||||||
|
|
||||||
import junit.framework.TestSuite;
|
|
||||||
|
|
||||||
public class AntennaPodTestRunner extends InstrumentationTestRunner {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TestSuite getAllTests() {
|
|
||||||
return new TestSuiteBuilder(AntennaPodTestRunner.class)
|
|
||||||
.includeAllPackagesUnderHere()
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue