Skip to content

Instantly share code, notes, and snippets.

@AlexZhukovich
Last active September 7, 2019 23:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexZhukovich/e9ee9b85c9f720de32ff27939e5113aa to your computer and use it in GitHub Desktop.
Save AlexZhukovich/e9ee9b85c9f720de32ff27939e5113aa to your computer and use it in GitHub Desktop.
Sign In error verification Android UI tests with Espresso
@RunWith(AndroidJUnit4::class)
class EspressoSignInTest {
@Rule @JvmField
val activityRule = ActivityTestRule<SignInActivity>(SignInActivity::class.java)
@Test
fun shouldDisplaySinInErrorWhenEmailIsIncorrect() {
val incorrectEmail = "test"
onView(withId(R.id.email))
.perform(replaceText(incorrectEmail), closeSoftKeyboard())
onView(withId(R.id.signIn))
.perform(click())
onView(withText(R.string.error_email_should_be_valid))
.check(matches(isDisplayed()))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment