public void testShouldShowPasswordTooShort() { onView(withId(R.id.login_email)) .perform(typeText("correct@email.com")); onView(withId(R.id.login_password)) .perform(typeText("aaa")); onView(withId(R.id.login_submit)) .perform(click()); onView(withId(R.id.login_error_message)) .check(matches(withText( "Password too short."))); }
void testShouldShowPasswordTooShort() { onView withId(R.id.login_email) \ perform typeText('correct@email.com') onView withId(R.id.login_password) \ perform typeText('aaa') onView withId(R.id.login_submit) \ perform click() onView withId(R.id.login_error_message) \ check matches(withText('Password too short.')) }
void testShouldShowPasswordTooShort() { onView withId(R.id.login_email) \ perform typeText('correct@email.com') onView withId(R.id.login_password) \ perform typeText('aaa') onView withId(R.id.login_submit) \ perform click() onView withId(R.id.login_error_message) \ check matches(withText('Password too short.')) }
void testShouldShowPasswordTooShort() { onView withId(R.id.login_email) \ perform typeText('correct@email.com') onView withId(R.id.login_password) \ perform typeText('aaa') onView withId(R.id.login_submit) \ perform click() onView withId(R.id.login_error_message) \ check matches(withText('Password too short.')) }
void testShouldShowPasswordTooShort() { onView withId(R.id.login_email) \ perform typeText('correct@email.com') onView withId(R.id.login_password) \ perform typeText('aaa') onView withId(R.id.login_submit) \ perform click() onView withId(R.id.login_error_message) \ check matches(withText('Password too short.')) }
void testShouldShowPasswordTooShort() { onView withId(R.id.login_email) \ perform typeText('correct@email.com') onView withId(R.id.login_password) \ perform typeText('aaa') onView withId(R.id.login_submit) \ perform click() onView withId(R.id.login_error_message) \ check matches(withText('Password too short.')) }
void testShouldShowPasswordTooShort() {
onView withId(R.id.login_email) \
perform typeText('correct@email.com')
onView withId(R.id.login_password) \
perform typeText('aaa')
onView withId(R.id.login_submit) \
perform click()
onView withId(R.id.login_error_message) \
check matches(withText('Password too short.'))
}
void testShouldShowPasswordTooShort() {
onView withId(R.id.login_email) \
perform typeText('correct@email.com')
onView withId(R.id.login_password) \
perform typeText('aaa')
onView withId(R.id.login_submit) \
perform click()
onView withId(R.id.login_error_message) \
check matches(withText('Password too short.'))
}
void testShouldShowPasswordTooShort() { onView withId(R.id.login_email) \ perform typeText('correct@email.com') onView withId(R.id.login_password) \ perform typeText('aaa') onView withId(R.id.login_submit) \ perform click() onView withId(R.id.login_error_message) \ check matches(withText('Password too short.')) }
void testShouldShowPasswordTooShort() { onView withId(R.id.login_email) \ perform typeText('correct@email.com') onView withId(R.id.login_password) \ perform typeText('aaa') onView withId(R.id.login_submit) \ perform click() onView withId(R.id.login_error_message) \ check matches(withText('Password too short.')) }
void testShouldShowPasswordTooShort() {
onView withId(R.id.login_email) \
perform typeText('correct@email.com')
onView withId(R.id.login_password) \
perform typeText('aaa')
onView withId(R.id.login_submit) \
perform click()
onView withId(R.id.login_error_message) \
check matches(withText('Password too short.'))
}
void testShouldShowPasswordTooShort() {
login('correct@email.com', 'aaa')
onView withId(R.id.login_error_message) \
check matches(withText('Password too short.'))
}
void testShouldShowPasswordTooShort() {
login('correct@email.com', 'aaa')
onView withId(R.id.login_error_message) \
check matches(withText('Password too short.'))
}
void testShouldShowPasswordTooShort() {
login('correct@email.com', 'aaa')
checkLoginErrorMessage('Password too short.')
}
void testShouldShowPasswordTooShort() { login('correct@email.com', 'aaa') checkLoginErrorMessage('Password too short.') }
void testShouldShowPasswordTooShort() {
login('correct@email.com', 'aaa')
checkLoginErrorMessage('Password too short.')
}
static void login(String email, String password) { typeText(R.id.login_email, email) typeText(R.id.login_password, password) click(R.id.login_submit) }
static void login(String email, String password) {
typeText(R.id.login_email, email)
typeText(R.id.login_password, password)
click(R.id.login_submit)
}
static void typeText(@IdRes int id, String text) { onView withId(id) perform typeText(text) }
void testShouldShowPasswordTooShort() { login('correct@email.com', 'aaa') checkLoginErrorMessage('Password too short.') }
subscription = service.byLocation(q, lat, lon)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this.&showDocs, this.&handleError)
final class ResultsActivity extends BaseActivity { @Inject protected SearchService service private Subscription subscription // ... }
@Provides SearchService provideSearchService() {
return { String q, double lat, double lon ->
// ...
return Observable.just(list)
} as SearchService
}
interface LocationService { Observable<Location> getCurrentLocation() }
@Provides LocationService provideLocationService() { return { return just(createLocation(53.89,27.57)) } as LocationService }
interface FacebookLoginButtonProvider { void addToContainer(ViewGroup container, SuccessCallback successCallback, ErrorCallback errorCallback) // ... }
final class LoginActivity extends BaseActivity {
@Inject
protected FacebookLoginButtonProvider provider
// ...
}
def button = new Button(container.context) button.id = R.id.facebook_login_button button.onClickListener = { successCallback.onSuccess("facebook_token") } container.addView(button)
def button = new Button(container.context) button.id = R.id.facebook_login_button button.onClickListener = { errorCallback.onError(new RuntimeException()) } container.addView(button)
@Override
protected void tearDown() throws Exception {
super.tearDown()
pressBackSeveralTimes()
}
private static void pressBackSeveralTimes() {
try {
6.times { pressBack() }
} catch (NoActivityResumedException ignore) {
}
}
final class SleepyCloseKeyboard implements ViewAction { ViewAction original = new CloseKeyboardAction() @Override void perform(UiController uiController, View view) { original.perform(uiController, view) if (BuildConfig.BUILT_ON_TRAVIS) { uiController.loopMainThreadForAtLeast(2_000) } } }
static Matcher<View> hasImage(@DrawableRes int id) { return new TypeSafeMatcher<ImageView>() { @Override boolean matchesSafely(ImageView imageView) { // ... return state == drawable.constantState } // ... } }
onSearchItemWithDoctor("Doctor House", R.id.search_doctor_calendar, ) check matches(isDisplayed())
onView(allOf( isDescendantOfA(allOf( withParent(withId(R.id.search_list)), hasDescendant(allOf( withId(R.id.search_doctor_name), withText("Doctor House")) ) )), withId(R.id.search_doctor_calendar)) ) check matches(isDisplayed())