diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2015-12-01 19:02:49 +0100 |
---|---|---|
committer | Martin Fietz <Martin.Fietz@gmail.com> | 2016-01-07 23:16:01 +0100 |
commit | f82ced9dc3e0d2d319e00550abeaf11b64c2887a (patch) | |
tree | 5d968961814e3b51147c796be8a71e4acd4183a1 | |
parent | 2ad94d582e9c351e1772a9d2c7862910e3bb40ad (diff) | |
download | AntennaPod-f82ced9dc3e0d2d319e00550abeaf11b64c2887a.zip |
Fix tests
3 files changed, 10 insertions, 13 deletions
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 7c194df2c..e456f3891 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java @@ -51,6 +51,7 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv adapter.close(); // override first launch preference + // do this BEFORE calling getActivity()! prefs = getInstrumentation().getTargetContext().getSharedPreferences(MainActivity.PREF_NAME, Context.MODE_PRIVATE); prefs.edit().putBoolean(MainActivity.PREF_IS_FIRST_LAUNCH, false).commit(); @@ -71,7 +72,8 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv } private void openNavDrawer() { - solo.clickOnScreen(50, 50); + solo.clickOnImageButton(0); + getInstrumentation().waitForIdleSync(); } public void testAddFeed() throws Exception { @@ -125,7 +127,7 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv assertEquals(solo.getString(R.string.add_feed_label), getActionbarTitle()); // podcasts - ListView list = (ListView)solo.getView(R.id.nav_list); + ListView list = (ListView) solo.getView(R.id.nav_list); for (int i = 0; i < uiTestUtils.hostedFeeds.size(); i++) { Feed f = uiTestUtils.hostedFeeds.get(i); solo.clickOnScreen(50, 50); // open nav drawer @@ -137,7 +139,7 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv } private String getActionbarTitle() { - return ((MainActivity)solo.getCurrentActivity()).getSupportActionBar().getTitle().toString(); + return ((MainActivity) solo.getCurrentActivity()).getSupportActionBar().getTitle().toString(); } @FlakyTest(tolerance = 3) @@ -185,14 +187,14 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv openNavDrawer(); solo.clickLongOnText(solo.getString(R.string.queue_label)); solo.waitForDialogToOpen(); - for(String title : titles) { + for (String title : titles) { solo.clickOnText(title); } solo.clickOnText(solo.getString(R.string.confirm_label)); solo.waitForDialogToClose(); List<String> hidden = UserPreferences.getHiddenDrawerItems(); assertEquals(titles.length, hidden.size()); - for(String tag : MainActivity.NAV_DRAWER_TAGS) { + for (String tag : MainActivity.NAV_DRAWER_TAGS) { assertTrue(hidden.contains(tag)); } } diff --git a/app/src/androidTest/java/de/test/antennapod/ui/PlaybackSonicTest.java b/app/src/androidTest/java/de/test/antennapod/ui/PlaybackSonicTest.java index c43757546..d65925703 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/PlaybackSonicTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/PlaybackSonicTest.java @@ -1,7 +1,6 @@ package de.test.antennapod.ui; import android.annotation.TargetApi; -import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; @@ -10,7 +9,6 @@ import android.preference.PreferenceManager; import android.test.ActivityInstrumentationTestCase2; import android.test.FlakyTest; import android.view.View; -import android.widget.ImageButton; import android.widget.ListView; import com.robotium.solo.Solo; @@ -21,15 +19,12 @@ import java.util.List; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.service.playback.PlaybackService; import de.danoeh.antennapod.core.service.playback.PlayerStatus; import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.PodDBAdapter; -import de.danoeh.antennapod.core.util.playback.Playable; -import de.danoeh.antennapod.core.util.playback.PlaybackController; /** * test cases for starting and ending playback from the MainActivity and AudioPlayerActivity @@ -90,7 +85,7 @@ public class PlaybackSonicTest extends ActivityInstrumentationTestCase2<MainActi } private void openNavDrawer() { - solo.clickOnScreen(50, 50); + solo.clickOnImageButton(0); getInstrumentation().waitForIdleSync(); } diff --git a/app/src/androidTest/java/de/test/antennapod/ui/PlaybackTest.java b/app/src/androidTest/java/de/test/antennapod/ui/PlaybackTest.java index 195e3d250..016c868b4 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/PlaybackTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/PlaybackTest.java @@ -79,9 +79,9 @@ public class PlaybackTest extends ActivityInstrumentationTestCase2<MainActivity> super.tearDown(); } - private void openNavDrawer() { - solo.clickOnScreen(50, 50); + solo.clickOnImageButton(0); + getInstrumentation().waitForIdleSync(); } private void setContinuousPlaybackPreference(boolean value) { |