class ComposeTest {
@get:Rule
val composeTestRule = createComposeRule()
@Test
fun myTest() {
composeTestRule.setContent {
Text("Hello")
}
composeTestRule.onNodeWithText("Hello").assertIsDisplayed()
}
}
java.lang.IllegalStateException: No compose views found in the app. Is your Activity resumed?
(1.1 系)
や
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
(1.2 系)
というエラーがでる場合、テストを実行しているエミュレータやデバイスの画面が off になっていないかチェックしましょう。