public final class

Espresso

extends Object
java.lang.Object
   ↳ android.support.test.espresso.Espresso

Class Overview

Entry point to the Espresso framework. Test authors can initiate testing by using one of the on* methods (e.g. onView) or perform top-level user actions (e.g. pressBack).

Summary

Public Methods
static void closeSoftKeyboard()
Closes soft keyboard if open.
static List<IdlingResource> getIdlingResources()
Returns a list of all currently registered ERROR(/IdlingResource)s.
static DataInteraction onData(Matcher<Object> dataMatcher)
Creates an DataInteraction for a data object displayed by the application.
static ViewInteraction onView(Matcher<View> viewMatcher)
Creates a ViewInteraction for a given view.
static void openActionBarOverflowOrOptionsMenu(Context context)
Opens the overflow menu displayed within an ActionBar.
static void openContextualActionModeOverflowMenu()
Opens the overflow menu displayed in the contextual options of an ActionMode.
static void pressBack()
Press on the back button.
static boolean registerIdlingResources(IdlingResource... resources)
Registers one or more ERROR(/IdlingResource)s with the framework.
static void registerLooperAsIdlingResource(Looper looper, boolean considerWaitIdle)
Registers a Looper for idle checking with the framework.
static void registerLooperAsIdlingResource(Looper looper)
Registers a Looper for idle checking with the framework.
static void setFailureHandler(FailureHandler failureHandler)
Changes the default FailureHandler to the given one.
static boolean unregisterIdlingResources(IdlingResource... resources)
Unregisters one or more ERROR(/IdlingResource)s.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static void closeSoftKeyboard ()

Closes soft keyboard if open.

public static List<IdlingResource> getIdlingResources ()

Returns a list of all currently registered ERROR(/IdlingResource)s.

public static DataInteraction onData (Matcher<Object> dataMatcher)

Creates an DataInteraction for a data object displayed by the application. Use this method to load (into the view hierarchy) items from AdapterView widgets (e.g. ListView).

Parameters
dataMatcher a matcher used to find the data object.

public static ViewInteraction onView (Matcher<View> viewMatcher)

Creates a ViewInteraction for a given view. Note: the view has to be part of the view hierarchy. This may not be the case if it is rendered as part of an AdapterView (e.g. ListView). If this is the case, use Espresso.onData to load the view first.

Parameters
viewMatcher used to select the view.
See Also