Hi this might be a silly question, but is there so...
# compose
o
Hi this might be a silly question, but is there something fancy you have to do to make testing in compose work? I have this test (see code in thread) but it looks like it just stalls and then after 45 sek it gives the error
Copy code
java.lang.AssertionError: Activity never becomes requested state "[RESUMED, CREATED, STARTED, DESTROYED]" (last lifecycle transition = "PRE_ON_CREATE")
I saw that someone here had this problem before and solved it by adding a ComponentActivity in their manifest, but I just get the same result. Has anyone here had the same experience? 😄 🤔
Copy code
@LargeTest
@HiltAndroidTest
class TriviaMenuUiTest {
    @get:Rule(order = 0)
    val hiltAndroidRule = HiltAndroidRule(this)

    @get:Rule(order = 1)
    val composeTestRule = createComposeRule()

    @Test
    fun testQuickPlayButtonIsPresent() {

        composeTestRule.setContent {
            KiwiTheme {
                TriviaMenu(
                    onQuickStart = { /*TODO*/ },
                    onBrowseCategories = { /*TODO*/ },
                    onBrowsePreviousResults = { /*TODO*/ },
                    signOut = { }
                )
            }
        }

        composeTestRule.apply {
            onNodeWithTag("quick-play")
                .assertExists("Quick play button does not exist")

            onNodeWithTag("quick-play")
                .assertIsDisplayed()
        }
    }
}
t
@Odin I think am having the same issue with gradle plugin
7.2.0-beta01
. Were you able to fix it?
o
I unfortunately can't recall what the solution to this was, but I think it was due to some dependency incompatibilities
t
@Odin No problem. In my case, the culprit was jacoco dependency
180 Views