I have bdd-test for my app , I use compose and espresso, and I have this error : java.lang.IllegalStateException: No compose hierarchies found in the app. Possible reasons include: (1) the Activity that calls setContent did not launch; (2) setContent was not called; (3) setContent was called before the ComposeTestRule ran. If setContent is called by the Activity, make sure the Activity is launched after the ComposeTestRule runs.
This is a part of my code: @WithJunitRule class ComposeRuleHolder {
companion object {
lateinit var composeTestRule: ComposeTestRule
}
@Rule(order = 0)
@JvmField
var composeRule: ComposeTestRule = createEmptyComposeRule()
@Before
fun before() {
composeTestRule = composeRule
}
}
and after in the class for the test:
fun myPage(func: MyPage.(ComposeTestRule) -> Unit) = MyPage.apply {
func(
ComposeRuleHolder.composeTestRule
)
}
@OptIn(ExperimentalTestApi::class)
object MyPage { ...
....
}
This was working but from about 2 weeks I had this error : Any Idea? Thanks