Created
July 27, 2016 01:32
-
-
Save heitorcolangelo/354080abf09bdabd0e9dd0f5a268bc21 to your computer and use it in GitHub Desktop.
LoginActivityTest - intent test 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 whenBothFieldsAreFilled_andClickOnLoginButton_shouldOpenMainActivity() { | |
Intents.init(); | |
onView(withId(R.id.login_username)).perform(typeText("defaultText"), closeSoftKeyboard()); | |
onView(withId(R.id.login_password)).perform(typeText("defaultText"), closeSoftKeyboard()); | |
Matcher<Intent> matcher = hasComponent(MainActivity.class.getName()); | |
ActivityResult result = new ActivityResult(Activity.RESULT_OK, null); | |
intending(matcher).respondWith(result); | |
onView(withId(R.id.login_button)).perform(click()); | |
intended(matcher); | |
Intents.release(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment