From b9b226b1a3b12d35e0181b5b5e149d807b299f37 Mon Sep 17 00:00:00 2001 From: jacqueli Date: Tue, 15 Dec 2020 12:23:51 -0800 Subject: [PATCH] Apply test changes from #2253 --- .../oppia/android/app/home/HomeActivityTest.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/src/sharedTest/java/org/oppia/android/app/home/HomeActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/home/HomeActivityTest.kt index d8093e8b87f..81c3aea9dff 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/home/HomeActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/home/HomeActivityTest.kt @@ -240,6 +240,7 @@ class HomeActivityTest { @Test fun testHomeActivity_recyclerViewIndex1_displaysRecentlyPlayedStoriesText() { launch(createHomeActivityIntent(internalProfileId)).use { + testCoroutineDispatchers.runCurrent() onView(withId(R.id.home_recycler_view)).perform( scrollToPosition(1) ) @@ -260,6 +261,7 @@ class HomeActivityTest { @Test fun testHomeActivity_recyclerViewIndex1_displaysViewAllText() { launch(createHomeActivityIntent(internalProfileId)).use { + testCoroutineDispatchers.runCurrent() onView(withId(R.id.home_recycler_view)).perform( scrollToPosition(1) ) @@ -274,6 +276,7 @@ class HomeActivityTest { @Test fun testHomeActivity_recyclerViewIndex1_clickViewAll_opensRecentlyPlayedActivity() { launch(createHomeActivityIntent(internalProfileId)).use { + testCoroutineDispatchers.runCurrent() onView(withId(R.id.home_recycler_view)).perform( scrollToPosition(1) ) @@ -372,6 +375,7 @@ class HomeActivityTest { @Test fun testHomeActivity_recyclerViewIndex3_topicSummary_topicNameIsCorrect() { launch(createHomeActivityIntent(internalProfileId)).use { + testCoroutineDispatchers.runCurrent() onView(withId(R.id.home_recycler_view)).perform( scrollToPosition(3) ) @@ -386,6 +390,7 @@ class HomeActivityTest { @Test fun testHomeActivity_recyclerViewIndex3_topicSummary_lessonCountIsCorrect() { launch(createHomeActivityIntent(internalProfileId)).use { + testCoroutineDispatchers.runCurrent() onView(withId(R.id.home_recycler_view)).perform( scrollToPosition(3) ) @@ -405,6 +410,7 @@ class HomeActivityTest { @Test fun testHomeActivity_recyclerViewIndex4_topicSummary_topicNameIsCorrect() { launch(createHomeActivityIntent(internalProfileId)).use { + testCoroutineDispatchers.runCurrent() onView(withId(R.id.home_recycler_view)).perform( scrollToPosition(4) ) @@ -419,6 +425,7 @@ class HomeActivityTest { @Test fun testHomeActivity_recyclerViewIndex4_topicSummary_lessonCountIsCorrect() { launch(createHomeActivityIntent(internalProfileId)).use { + testCoroutineDispatchers.runCurrent() onView(withId(R.id.home_recycler_view)).perform( scrollToPosition(4) ) @@ -438,6 +445,7 @@ class HomeActivityTest { @Test fun testHomeActivity_recyclerViewIndex4_topicSummary_configurationChange_lessonCountIsCorrect() { launch(createHomeActivityIntent(internalProfileId)).use { + testCoroutineDispatchers.runCurrent() onView(isRoot()).perform(orientationLandscape()) onView(withId(R.id.home_recycler_view)).perform( scrollToPosition(4) @@ -458,6 +466,7 @@ class HomeActivityTest { @Test fun testHomeActivity_recyclerViewIndex3_clickTopicSummary_opensTopicActivity() { launch(createHomeActivityIntent(internalProfileId)).use { + testCoroutineDispatchers.runCurrent() onView(withId(R.id.home_recycler_view)).perform( scrollToPosition(3) ) @@ -470,6 +479,7 @@ class HomeActivityTest { @Test fun testHomeActivity_onBackPressed_showsExitToProfileChooserDialog() { launch(createHomeActivityIntent(internalProfileId)).use { + testCoroutineDispatchers.runCurrent() pressBack() onView(withText(R.string.home_activity_back_dialog_message)) .inRoot(isDialog()) @@ -480,6 +490,7 @@ class HomeActivityTest { @Test fun testHomeActivity_onBackPressed_orientationChange_showsExitToProfileChooserDialog() { launch(createHomeActivityIntent(internalProfileId)).use { + testCoroutineDispatchers.runCurrent() pressBack() onView(isRoot()).perform(orientationLandscape()) onView(withText(R.string.home_activity_back_dialog_message)) @@ -491,6 +502,7 @@ class HomeActivityTest { @Test fun testHomeActivity_onBackPressed_clickExit_checkOpensProfileActivity() { launch(createHomeActivityIntent(internalProfileId)).use { + testCoroutineDispatchers.runCurrent() pressBack() onView(withText(R.string.home_activity_back_dialog_exit)) .inRoot(isDialog()) @@ -502,6 +514,7 @@ class HomeActivityTest { @Test fun testHomeActivity_checkSpanForItem0_spanSizeIsTwoOrThree() { launch(createHomeActivityIntent(internalProfileId)).use { + testCoroutineDispatchers.runCurrent() if (context.resources.getBoolean(R.bool.isTablet)) { onView(withId(R.id.home_recycler_view)).check(hasGridItemCount(3, 0)) } else { @@ -513,6 +526,7 @@ class HomeActivityTest { @Test fun testHomeActivity_checkSpanForItem4_spanSizeIsOne() { launch(createHomeActivityIntent(internalProfileId)).use { + testCoroutineDispatchers.runCurrent() onView(withId(R.id.home_recycler_view)).check(hasGridItemCount(1, 4)) } } @@ -520,6 +534,7 @@ class HomeActivityTest { @Test fun testHomeActivity_configurationChange_checkSpanForItem4_spanSizeIsOne() { launch(createHomeActivityIntent(internalProfileId)).use { + testCoroutineDispatchers.runCurrent() onView(isRoot()).perform(orientationLandscape()) onView(withId(R.id.home_recycler_view)).check(hasGridItemCount(1, 4)) }