Search in sources :

Example 56 with UiController

use of android.support.test.espresso.UiController in project collect by opendatakit.

the class AllWidgetsFormTest method setProgress.

public static ViewAction setProgress(final int progress) {
    return new ViewAction() {

        @Override
        public void perform(UiController uiController, View view) {
            SeekBar seekBar = (SeekBar) view;
            seekBar.setProgress(progress);
        }

        @Override
        public String getDescription() {
            return "Set a progress on a SeekBar";
        }

        @Override
        public Matcher<View> getConstraints() {
            return ViewMatchers.isAssignableFrom(SeekBar.class);
        }
    };
}
Also used : SeekBar(android.widget.SeekBar) ViewAction(android.support.test.espresso.ViewAction) UiController(android.support.test.espresso.UiController) View(android.view.View) Espresso.onView(android.support.test.espresso.Espresso.onView)

Example 57 with UiController

use of android.support.test.espresso.UiController in project Rocket by mozilla-tw.

the class RecyclerViewTestUtils method clickChildViewWithId.

public static ViewAction clickChildViewWithId(final int id) {
    return new ViewAction() {

        @Override
        public Matcher<View> getConstraints() {
            return null;
        }

        @Override
        public String getDescription() {
            return "Click on a child view with specified id.";
        }

        @Override
        public void perform(UiController uiController, View view) {
            View v = view.findViewById(id);
            v.performClick();
        }
    };
}
Also used : ViewAction(android.support.test.espresso.ViewAction) UiController(android.support.test.espresso.UiController) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 58 with UiController

use of android.support.test.espresso.UiController in project openhab-android by openhab.

the class BasicWidgetTest method onChildView.

public static ViewAction onChildView(final ViewAction action, @IdRes final int targetViewId) {
    return new ViewAction() {

        @Override
        public Matcher<View> getConstraints() {
            return null;
        }

        @Override
        public String getDescription() {
            return null;
        }

        @Override
        public void perform(UiController uiController, View view) {
            View v = view.findViewById(targetViewId);
            action.perform(uiController, v);
        }
    };
}
Also used : ViewAction(android.support.test.espresso.ViewAction) UiController(android.support.test.espresso.UiController) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) Espresso.onView(android.support.test.espresso.Espresso.onView)

Example 59 with UiController

use of android.support.test.espresso.UiController in project orgzly-android by orgzly.

the class EspressoUtils method closeSoftKeyboardWithDelay.

/**
 * Give keyboard time to close, to avoid java.lang.SecurityException
 * if hidden button is clicked next.
 */
static ViewAction closeSoftKeyboardWithDelay() {
    return new ViewAction() {

        /**
         * The delay time to allow the soft keyboard to dismiss.
         */
        private static final long KEYBOARD_DISMISSAL_DELAY_MILLIS = 1000L;

        /**
         * The real {@link CloseKeyboardAction} instance.
         */
        private final ViewAction mCloseSoftKeyboard = new CloseKeyboardAction();

        @Override
        public Matcher<View> getConstraints() {
            return mCloseSoftKeyboard.getConstraints();
        }

        @Override
        public String getDescription() {
            return mCloseSoftKeyboard.getDescription();
        }

        @Override
        public void perform(final UiController uiController, final View view) {
            mCloseSoftKeyboard.perform(uiController, view);
            uiController.loopMainThreadForAtLeast(KEYBOARD_DISMISSAL_DELAY_MILLIS);
        }
    };
}
Also used : ViewAction(android.support.test.espresso.ViewAction) CloseKeyboardAction(android.support.test.espresso.action.CloseKeyboardAction) UiController(android.support.test.espresso.UiController) View(android.view.View) Espresso.onView(android.support.test.espresso.Espresso.onView) ListView(android.widget.ListView)

Example 60 with UiController

use of android.support.test.espresso.UiController in project apps-android-wikipedia by wikimedia.

the class ViewTools method clickChildViewWithId.

public static ViewAction clickChildViewWithId(final int id) {
    return new ViewAction() {

        @Override
        public Matcher<View> getConstraints() {
            return null;
        }

        @Override
        public String getDescription() {
            return "Click on a child view with specified id.";
        }

        @Override
        public void perform(UiController uiController, View view) {
            View v = view.findViewById(id);
            v.performClick();
        }
    };
}
Also used : ViewAction(android.support.test.espresso.ViewAction) UiController(android.support.test.espresso.UiController) BottomNavigationView(android.support.design.widget.BottomNavigationView) TextView(android.widget.TextView) Espresso.onView(android.support.test.espresso.Espresso.onView) View(android.view.View)

Aggregations

UiController (android.support.test.espresso.UiController)64 View (android.view.View)64 ViewAction (android.support.test.espresso.ViewAction)63 NavigationView (android.support.design.widget.NavigationView)18 Espresso.onView (android.support.test.espresso.Espresso.onView)14 TextView (android.widget.TextView)14 ViewPager (android.support.v4.view.ViewPager)9 TabLayout (android.support.design.widget.TabLayout)8 TextInputLayout (android.support.design.widget.TextInputLayout)7 FloatingActionButton (android.support.design.widget.FloatingActionButton)6 BottomNavigationView (android.support.design.widget.BottomNavigationView)4 ViewGroup (android.view.ViewGroup)4 Matcher (org.hamcrest.Matcher)4 BaseMatcher (org.hamcrest.BaseMatcher)3 TypeSafeMatcher (org.hamcrest.TypeSafeMatcher)3 TabLayoutActions.setupWithViewPager (android.support.design.testutils.TabLayoutActions.setupWithViewPager)2 CollapsingToolbarLayout (android.support.design.widget.CollapsingToolbarLayout)2 DrawerLayout (android.support.v4.widget.DrawerLayout)2 RecyclerView (android.support.v7.widget.RecyclerView)2 HorizontalScrollView (android.widget.HorizontalScrollView)2