Skip to content

Instantly share code, notes, and snippets.

@heitorcolangelo
Last active October 8, 2016 20:28
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/8644f123ed867c14a02a8b5ea3ff531b to your computer and use it in GitHub Desktop.
Save heitorcolangelo/8644f123ed867c14a02a8b5ea3ff531b to your computer and use it in GitHub Desktop.
class LoginRobot {
LoginRobot username(String username) {
onView(withId(R.id.login_username)).perform(typeText(username), closeSoftKeyboard());
return this;
}
LoginRobot password(String password) {
onView(withId(R.id.login_password)).perform(typeText(password), closeSoftKeyboard());
return this;
}
ResultLoginRobot login() {
Intents.init();
Matcher<Intent> matcher = hasComponent(MainActivity.class.getName());
onView(withId(R.id.login_button)).perform(scrollTo(), click());
return new ResultLoginRobot();
}
}
class ResultLoginRobot {
ResultRobot isSuccess() {
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