https://kotlinlang.org logo
#compose
Title
# compose
t

Tim Malseed

12/22/2021, 6:48 AM
I have the following in a UI test, but the test seems to hang..
Copy code
@Test
fun myTest() {

    composeTestRule.activity.runOnUiThread {
        val backPressedDispatcher = (composeTestRule.activity as OnBackPressedDispatcherOwner).onBackPressedDispatcher
        backPressedDispatcher.onBackPressed()
    }

    assertEquals(composeTestRule.activityRule.scenario.state,  Lifecycle.State.DESTROYED)
The test uses
ComposeTestRule
and
composeTestRule.setContent()
. I’m wondering if there’s an issue because the current Activity under test has been (or is in the process of being) destroyed
3 Views