From 3f40d5dd50d8a7cd4cb4593c6a769df9deaf8e98 Mon Sep 17 00:00:00 2001 From: Srikanth Kb Date: Wed, 24 Feb 2021 12:40:39 +0530 Subject: [PATCH] Workaround for ExplorationActivityTest in espresso --- .../app/player/exploration/ExplorationActivityTest.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/sharedTest/java/org/oppia/android/app/player/exploration/ExplorationActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/player/exploration/ExplorationActivityTest.kt index a10db3455b6..6ea532ca3e1 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/player/exploration/ExplorationActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/player/exploration/ExplorationActivityTest.kt @@ -92,10 +92,12 @@ import org.oppia.android.domain.topic.TEST_TOPIC_ID_0 import org.oppia.android.testing.EditTextInputAction import org.oppia.android.testing.IsOnRobolectric import org.oppia.android.testing.RobolectricModule +import org.oppia.android.testing.RunOn import org.oppia.android.testing.TestAccessibilityModule import org.oppia.android.testing.TestCoroutineDispatchers import org.oppia.android.testing.TestDispatcherModule import org.oppia.android.testing.TestLogReportingModule +import org.oppia.android.testing.TestPlatform import org.oppia.android.testing.time.FakeOppiaClockModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule @@ -524,8 +526,8 @@ class ExplorationActivityTest { // TODO (#1855): Resolve ktlint max line in app module test // TODO(#89): The ExplorationActivity takes time to finish. This test case is failing currently. + @RunOn(TestPlatform.ESPRESSO) @Test - @Ignore("The ExplorationActivity takes time to finish, needs to fixed in #89.") fun testAudioWithWifi_openRatioExploration_clickAudioIcon_checkAudioFragmentHasDefaultLanguageAndAutoPlays() { // ktlint-disable max-line-length getApplicationDependencies(RATIOS_EXPLORATION_ID_0) networkConnectionUtil.setCurrentConnectionStatus(NetworkConnectionUtil.ConnectionStatus.LOCAL) @@ -537,6 +539,9 @@ class ExplorationActivityTest { RATIOS_EXPLORATION_ID_0 ) ).use { + // Work around for #2430 espresso tests, resource registered again at the end of test + testCoroutineDispatchers.unregisterIdlingResource() + waitForTheView(withText("What is a Ratio?")) onView(withId(R.id.action_audio_player)).perform(click()) onView( @@ -554,6 +559,7 @@ class ExplorationActivityTest { ) ) ) + testCoroutineDispatchers.registerIdlingResource() } explorationDataController.stopPlayingExploration() }