diff --git a/testing/src/main/java/org/oppia/android/testing/OppiaTestRule.kt b/testing/src/main/java/org/oppia/android/testing/OppiaTestRule.kt index b5ec5ce3df2..b8799aa1612 100644 --- a/testing/src/main/java/org/oppia/android/testing/OppiaTestRule.kt +++ b/testing/src/main/java/org/oppia/android/testing/OppiaTestRule.kt @@ -44,22 +44,23 @@ class OppiaTestRule : TestRule { " $currentEnvironment" ) } - currentPlatform == TestPlatform.ESPRESSO && isEnabled -> { - AccessibilityChecks.enable().apply { - // Suppressing failures for all views which matches with below conditions as we do not - // want to change the UI to pass these failures as it will change the expected behaviour - // for learner. - setSuppressingResultMatcher( - allOf( - matchesCheckNames(`is`("TouchTargetSizeViewCheck")), - matchesViews(withContentDescription("More options")), - matchesViews(withClassName(endsWith("OverflowMenuButton"))) - ) - ) - }.setRunChecksFromRootView(true) - } else -> throw AssertionError("Reached impossible state in test rule") } + if (currentPlatform == TestPlatform.ESPRESSO && isEnabled) { + AccessibilityChecks.enable().apply { + // Suppressing failures for all views which matches with below conditions as we do not + // want to change the UI to pass these failures as it will change the expected behaviour + // for learner. + setSuppressingResultMatcher( + allOf( + matchesCheckNames(`is`("TouchTargetSizeViewCheck")), + matchesViews(withContentDescription("More options")), + matchesViews(withClassName(endsWith("OverflowMenuButton"))) + ) + ) + }.setRunChecksFromRootView(true) + } + base?.evaluate() } } }