diff options
-rw-r--r-- | tests/hostside/safetycenter/helper-app/src/android/safetycenter/hostside/device/SafetyCenterInteractionLoggingHelperTests.kt | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/hostside/safetycenter/helper-app/src/android/safetycenter/hostside/device/SafetyCenterInteractionLoggingHelperTests.kt b/tests/hostside/safetycenter/helper-app/src/android/safetycenter/hostside/device/SafetyCenterInteractionLoggingHelperTests.kt index f37479180..6afcff85a 100644 --- a/tests/hostside/safetycenter/helper-app/src/android/safetycenter/hostside/device/SafetyCenterInteractionLoggingHelperTests.kt +++ b/tests/hostside/safetycenter/helper-app/src/android/safetycenter/hostside/device/SafetyCenterInteractionLoggingHelperTests.kt @@ -23,6 +23,7 @@ import android.safetycenter.SafetyCenterManager.EXTRA_SAFETY_SOURCE_ID import android.safetycenter.SafetyCenterManager.EXTRA_SAFETY_SOURCE_ISSUE_ID import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 +import com.android.compatibility.common.util.UiAutomatorUtils2 import com.android.safetycenter.testing.SafetyCenterActivityLauncher.launchSafetyCenterActivity import com.android.safetycenter.testing.SafetyCenterActivityLauncher.launchSafetyCenterQsActivity import com.android.safetycenter.testing.SafetyCenterActivityLauncher.openPageAndExit @@ -34,6 +35,7 @@ import com.android.safetycenter.testing.SafetyCenterTestRule import com.android.safetycenter.testing.SafetySourceTestData import com.android.safetycenter.testing.SafetySourceTestData.Companion.INFORMATION_ISSUE_ID import com.android.safetycenter.testing.UiTestHelper.waitAllTextDisplayed +import org.junit.After import org.junit.Before import org.junit.Rule import org.junit.Test @@ -63,6 +65,14 @@ class SafetyCenterInteractionLoggingHelperTests { SafetyCenterFlags.showSubpages = true } + @After + fun tearDown() { + // When an assertion fails, it will end up leaving the previous view open, which screws + // with the logging assertions made by this test (polluting with view events from whatever + // view was left open). Here we preemptively clear whatever's open to get back to home + UiAutomatorUtils2.getUiDevice().pressHome() + } + @Test fun openSafetyCenter() { context.launchSafetyCenterActivity {} |