Espresso perform click button and don't wait the typeText finish

11 Views Asked by At

im learning espresso, so I have this scenarios the user type in a edit text then performs a click into a button and this do a query nothing fancy but all the time my button perform a click and not finish the type text.And that results in failed the test.

This is my code

 @Test
    fun getThanosVillain(){
        launchFragmentInContainer<FirstFragment>()
        onView(withId(R.id.editText)).perform(typeText("Thanos"))
        onView(withId(R.id.button_first)).check(matches(isDisplayed())).perform(click())
        val textToValue = "Thanos"
        onView(withId(R.id.textview_first)).check(matches(withText(textToValue)))
    }

If anyone knows where I'm going wrong, I'd appreciate it.

Execute the test success

0

There are 0 best solutions below