use of android.support.test.espresso.ViewInteraction in project quickstart-android by firebase.
the class EmailPasswordTest method failedSignInTest.
@Test
public void failedSignInTest() {
String email = "test@test.com";
String password = "123456";
// Make sure we're signed out
signOutIfPossible();
// Enter email
enterEmail(email);
// Enter password
enterPassword(password);
// Click sign in
ViewInteraction appCompatButton = onView(allOf(withId(R.id.email_sign_in_button), withText(R.string.sign_in), withParent(withId(R.id.email_password_buttons)), isDisplayed()));
appCompatButton.perform(click());
// Check that auth failed
onView(withText(R.string.auth_failed)).check(matches(isDisplayed()));
}
use of android.support.test.espresso.ViewInteraction in project quickstart-android by firebase.
the class EmailPasswordTest method enterPassword.
private void enterPassword(String password) {
ViewInteraction passwordField = onView(allOf(withId(R.id.field_password), withParent(withId(R.id.email_password_fields)), isDisplayed()));
passwordField.perform(replaceText(password));
}
use of android.support.test.espresso.ViewInteraction in project quickstart-android by firebase.
the class MainActivityTest method uploadPhotoTest.
@Test
public void uploadPhotoTest() throws InterruptedException {
// Log out to start
logOutIfPossible();
// Create a temp file
createTempFile();
// Click sign in
ViewInteraction signInButton = onView(allOf(withId(R.id.button_sign_in), withText(R.string.sign_in_anonymously), isDisplayed()));
signInButton.perform(click());
// Wait for sign in
Thread.sleep(5000);
// Click upload
ViewInteraction uploadButton = onView(allOf(withId(R.id.button_camera), withText(R.string.camera_button_text), isDisplayed()));
uploadButton.perform(click());
// Confirm that download link label is displayed
onView(withText(R.string.label_link)).check(matches(isDisplayed()));
// Confirm that there is a download link on screen
onView(withId(R.id.picture_download_uri)).check(matches(withText(startsWith("https://firebasestorage.googleapis.com"))));
// Click download
ViewInteraction downloadButton = onView(allOf(withId(R.id.button_download), withText(R.string.download), isDisplayed()));
downloadButton.perform(click());
// Wait for download
Thread.sleep(5000);
// Confirm that a success dialog appears
onView(withText(R.string.success)).inRoot(isDialog()).check(matches(isDisplayed()));
}
use of android.support.test.espresso.ViewInteraction in project quickstart-android by firebase.
the class MainActivityTest method mainActivityTest.
@Test
public void mainActivityTest() {
// Select favorite food if the dialog appears
selectFavoriteFoodIfPossible("Hot Dogs");
// Initial title
checkTitleText(R.string.pattern1_title);
// Swipe, make sure we see the right titles
ViewInteraction viewPager = onView(withId(R.id.pager));
viewPager.check(matches(isDisplayed()));
// Swipe left
viewPager.perform(swipeLeft());
checkTitleText(R.string.pattern2_title);
// Swipe left
viewPager.perform(swipeLeft());
checkTitleText(R.string.pattern3_title);
// Swipe back right
viewPager.perform(swipeRight());
checkTitleText(R.string.pattern2_title);
}
use of android.support.test.espresso.ViewInteraction in project iosched by google.
the class ToolbarUtils method checkToolbarCollapsesAfterSwipingRecyclerViewUp.
public static void checkToolbarCollapsesAfterSwipingRecyclerViewUp(int viewResource) {
// TODO
ViewInteraction view = onView(withId(R.id.toolbar));
// Swiping up should hide the toolbar.
onView(withId(viewResource)).perform(RecyclerViewActions.actionOnItemAtPosition(0, swipeUp()));
// Check if the toolbar is hidden.
view.check(matches(not(isDisplayed())));
}
Aggregations