https://kotlinlang.org logo
Title
c

chanjungskim

03/06/2023, 4:08 AM
I am trying to write ui test with compose. And I get
Instrumentation run failed due to Process crashed.
error. Is there any solution?
here's my code. in
androidTest
.
@HiltAndroidTest
class VitaminScreenComposeTest {
    @get:Rule(order = 0)
    val hiltRule = HiltAndroidRule(this)

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

    @Test
    fun entryQuestionLayout(){
        val entryQuestionJson = loadFileText(this, "/surveyQuestion.json")
        val entryQuestion = Gson().fromJsonToArrayList(entryQuestionJson, Question::class.java)[0]

        composeTestRule.setContent {
            VitaminScreen(false, entryQuestion, {},{},{})
        }

        composeTestRule.onNodeWithText("scientific").assertIsDisplayed()
        composeTestRule.onNodeWithText("professional").assertIsDisplayed()
    }
}
I solved this issue. And now I want to wait until
scientific
and
professional
text are visible(I get this data from API). How can I wait and assert them here?