Last active
July 25, 2016 18:05
-
-
Save heitorcolangelo/09ef7620ade3b943420d093a61dbb803 to your computer and use it in GitHub Desktop.
LoginActivityTest - empty state test - refactor 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void whenPasswordIsEmpty_andClickOnLoginButton_shouldDisplayDialog() { | |
testEmptyFieldState(R.id.login_username); | |
} | |
@Test | |
public void whenUserNameIsEmpty_andClickOnLoginButton_shouldDisplayDialog() { | |
testEmptyFieldState(R.id.login_password); | |
} | |
private void testEmptyFieldState(int notEmptyFieldId){ | |
onView(withId(notEmptyFieldId)).perform(typeText("defaultText")); | |
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