Skip to content

Instantly share code, notes, and snippets.

@heitorcolangelo
Last active October 25, 2016 12:41
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 heitorcolangelo/1bfbcf5c211a2c7b098e3ed0e80085e2 to your computer and use it in GitHub Desktop.
Save heitorcolangelo/1bfbcf5c211a2c7b098e3ed0e80085e2 to your computer and use it in GitHub Desktop.
LoginActivityTest - Empty fields state
@Test
public void whenAnyEditTextIsEmpty_andClickOnLoginButton_shouldDisplayDialog() {
onView(withId(R.id.login_username)).perform(typeText("admin"));
onView(withId(R.id.login_button)).perform(click());
onView(withText(R.string.validation_message)).check(matches(isDisplayed()));
onView(withText(R.string.ok)).perform(click());
onView(withId(R.id.login_username)).perform(clearText());
onView(withId(R.id.login_password)).perform(typeText("pass123"));
onView(withId(R.id.login_button)).perform(click());
onView(withText(R.string.validation_message)).check(matches(isDisplayed()));
onView(withText(R.string.ok)).perform(click());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment