Issue
I want to test my error message in my android app. My error check only happens when the focus of my editText changes.
@Test
fun wrongFirstname(){
onView(withId(R.id.txtFirstNameRegister)).perform(typeText(""))
//here I need to lose my focus
onView(withId(R.id.txtFirstNameRegister)).check(matches(hasErrorText(R.string.firstNameCheckError.toString())))
}
Solution
From what I know there is no explicit method that allows you to just lose focus, this is also not an action a user can perform hence it is not included in espresso.
You can of course use a different method resulting in loss of focus such as clicking on a different component:
onView(withId(R.id.some_view)).perform(click())
Answered By - Anton
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.