ViewActions.closeSoftKeyboard())
Espresso.onView(ViewMatchers.withId(R.id.loginPasswordEditText))
.perform(ViewActions.typeText("12345678"), ViewActions.closeSoftKeyboard())
Espresso.onView(ViewMatchers.withId(R.id.loginSubmitButton)).perform(ViewActions.click())
Espresso.onView(ViewMatchers.withText("Login"))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
}
@Test
fun test_login_withEmptyEmail_showsError() {
Espresso.onView(ViewMatchers.withId(R.id.loginUsernameEditText))
.perform(ViewActions.typeText(""), ViewActions.closeSoftKeyboard())
Espresso.onView(ViewMatchers.withId(R.id.loginPasswordEditText))
.perform(ViewActions.typeText("12345678"), ViewActions.closeSoftKeyboard())
Espresso.onView(ViewMatchers.withId(R.id.loginSubmitButton)).perform(ViewActions.click())
Espresso.onView(ViewMatchers.withId(R.id.loginUsernameEditText))
.check(ViewAssertions.matches(CustomMatchers.withError()))
}
@Test
fun test_login_withEmptyPassword_showsError() {
Espresso.onView(ViewMatchers.withId(R.id.loginUsernameEditText))
.perform(ViewActions.typeText("
[email protected]"), ViewActions.closeSoftKeyboard())
Espresso.onView(ViewMatchers.withId(R.id.loginPasswordEditText))
.perform(ViewActions.typeText(""), ViewActions.closeSoftKeyboard())
Espresso.onView(ViewMatchers.withId(R.id.loginSubmitButton)).perform(ViewActions.click())
Espresso.onView(ViewMatchers.withId(R.id.loginPasswordEditText))
.check(ViewAssertions.matches(CustomMatchers.withError()))
}
} Without robot Sample 3/3