Search in sources :

Example 6 with ViewInteraction

use of androidx.test.espresso.ViewInteraction in project PocketHub by pockethub.

the class CreateGistActivityTest method testCreateWithNoInitialText.

/**
 * Create Gist with no initial text
 *
 * @throws Throwable
 */
@Test
public void testCreateWithNoInitialText() throws Throwable {
    activityTestRule.launchActivity(new Intent());
    ViewInteraction createMenu = onView(withId(R.id.create_gist));
    ViewInteraction content = onView(withId(R.id.et_gist_content));
    createMenu.check(ViewAssertions.matches(not(isEnabled())));
    content.perform(ViewActions.typeText("gist content"));
    createMenu.check(ViewAssertions.matches(isEnabled()));
}
Also used : Intent(android.content.Intent) ViewInteraction(androidx.test.espresso.ViewInteraction) Test(org.junit.Test)

Example 7 with ViewInteraction

use of androidx.test.espresso.ViewInteraction in project fdroidclient by f-droid.

the class MainActivityEspressoTest method startSwap.

@LargeTest
@Test
public void startSwap() {
    if (!BuildConfig.FLAVOR.startsWith("full")) {
        return;
    }
    ViewInteraction nearbyBottonNavButton = onView(allOf(withText(R.string.main_menu__swap_nearby), isDisplayed()));
    nearbyBottonNavButton.perform(click());
    ViewInteraction findPeopleButton = onView(allOf(withId(R.id.find_people_button), withText(R.string.nearby_splash__find_people_button), isDisplayed()));
    findPeopleButton.perform(click());
    onView(withText(R.string.swap_send_fdroid)).check(matches(isDisplayed()));
}
Also used : ViewInteraction(androidx.test.espresso.ViewInteraction) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test) LargeTest(androidx.test.filters.LargeTest)

Example 8 with ViewInteraction

use of androidx.test.espresso.ViewInteraction in project fdroidclient by f-droid.

the class MainActivityEspressoTest method showUpdates.

@LargeTest
@Test
public void showUpdates() {
    ViewInteraction updatesBottonNavButton = onView(allOf(withText(R.string.main_menu__updates), isDisplayed()));
    updatesBottonNavButton.perform(click());
    onView(withText(R.string.main_menu__updates)).check(matches(isDisplayed()));
}
Also used : ViewInteraction(androidx.test.espresso.ViewInteraction) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test) LargeTest(androidx.test.filters.LargeTest)

Example 9 with ViewInteraction

use of androidx.test.espresso.ViewInteraction in project BetterBatteryStats by asksven.

the class ShareActivityTestCancel method shareActivityTest.

@Test
public void shareActivityTest() {
    // https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html
    try {
        Thread.sleep(2000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    ViewInteraction actionMenuItemView = onView(allOf(withId(R.id.share), withContentDescription("Share"), isDisplayed()));
    actionMenuItemView.perform(click());
    // https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html
    try {
        Thread.sleep(2000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    ViewInteraction appCompatButton2 = onView(withText("Cancel"));
    appCompatButton2.perform(click());
}
Also used : ViewInteraction(androidx.test.espresso.ViewInteraction) Test(org.junit.Test)

Example 10 with ViewInteraction

use of androidx.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.viewPager));
    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);
}
Also used : ViewInteraction(androidx.test.espresso.ViewInteraction) Test(org.junit.Test) LargeTest(androidx.test.filters.LargeTest)

Aggregations

ViewInteraction (androidx.test.espresso.ViewInteraction)17 Test (org.junit.Test)16 LargeTest (androidx.test.filters.LargeTest)9 Intent (android.content.Intent)1 CheckBox (android.widget.CheckBox)1 NoMatchingViewException (androidx.test.espresso.NoMatchingViewException)1 UiObject (androidx.test.uiautomator.UiObject)1 UiSelector (androidx.test.uiautomator.UiSelector)1 ViewVisibilityIdlingResource (com.github.pockethub.android.tests.ViewVisibilityIdlingResource)1