java.lang.Object | |
↳ | android.support.test.espresso.action.ViewActions |
A collection of common ViewActions
.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Performs all assertions before the
ViewAction s in this class and then performs the
given ViewAction
| |||||||||||
Adds a
ViewAssertion to be run every time a ViewAction in this class is
performed.
| |||||||||||
Returns an action that clears text on the view.
| |||||||||||
Returns an action that performs a single click on the view.
| |||||||||||
Returns an action that clicks the view.
| |||||||||||
Returns an action that closes soft keyboard.
| |||||||||||
Returns an action that double clicks the view.
| |||||||||||
Returns an action that long clicks the view.
| |||||||||||
Returns an action that opens a link matching the given link text and uri matchers.
| |||||||||||
Same as
openLink(Matcher , but uses
any(Uri.class) as the uriMatcher.
| |||||||||||
Same as
openLinkWithText(Matcher , but uses
is(linkText) as the linkTextMatcher.
| |||||||||||
Same as
openLink(Matcher , but uses
any(String.class) as the linkTextMatcher.
| |||||||||||
Same as
openLinkWithUri(Matcher , but uses is(uri) as the
uriMatcher.
| |||||||||||
Returns an action that clicks the back button.
| |||||||||||
Returns an action that presses the current action button (next, done, search, etc) on the IME
(Input Method Editor).
| |||||||||||
Returns an action that presses the key specified by the keyCode (eg.
| |||||||||||
Returns an action that presses the specified key with the specified modifiers.
| |||||||||||
Returns an action that presses the hardware menu key.
| |||||||||||
Removes the given assertion from the set of assertions to be run before actions are performed.
| |||||||||||
Returns an action that updates the text attribute of a view.
| |||||||||||
Returns an action that scrolls to the view.
| |||||||||||
Returns an action that performs a swipe top-to-bottom across the horizontal center of the view.
| |||||||||||
Returns an action that performs a swipe right-to-left across the vertical center of the
view.
| |||||||||||
Returns an action that performs a swipe left-to-right across the vertical center of the
view.
| |||||||||||
Returns an action that performs a swipe bottom-to-top across the horizontal center of the view.
| |||||||||||
Returns an action that selects the view (by clicking on it) and types the provided string into
the view.
| |||||||||||
Returns an action that types the provided string into the view.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Performs all assertions before the ViewAction
s in this class and then performs the
given ViewAction
viewAction | the ViewAction to perform after the assertions
|
---|
Adds a ViewAssertion
to be run every time a ViewAction
in this class is
performed. The assertion will be run prior to performing the action.
name | a name of the assertion to be added |
---|---|
viewAssertion | a ViewAssertion to be added |
IllegalArgumentException | if the name/viewAssertion pair is already contained in the global assertions. |
---|
Returns an action that clears text on the view.
View constraints:
Returns an action that performs a single click on the view.
If the click takes longer than the 'long press' duration (which is possible) the provided
rollback action is invoked on the view and a click is attempted again.
This is only necessary if the view being clicked on has some different behaviour for long press
versus a normal tap.
For example - if a long press on a particular view element opens a popup menu -
ViewActions.pressBack() may be an acceptable rollback action.
View constraints:
Returns an action that clicks the view.
View constraints:
Returns an action that closes soft keyboard. If the keyboard is already closed, it is a no-op.
Returns an action that double clicks the view.
View preconditions:
Returns an action that long clicks the view.
View preconditions:
Returns an action that opens a link matching the given link text and uri matchers. The action
is performed by invoking the link's onClick method (as opposed to actually issuing a click on
the screen).
View preconditions:
Same as openLink(Matcher
, but uses
any(Uri.class)
as the uriMatcher.
Same as openLinkWithText(Matcher
, but uses
is(linkText)
as the linkTextMatcher.
Same as openLink(Matcher
, but uses
any(String.class)
as the linkTextMatcher.
Same as openLinkWithUri(Matcher
, but uses is(uri)
as the
uriMatcher.
Returns an action that presses the current action button (next, done, search, etc) on the IME (Input Method Editor). The selected view will have its onEditorAction method called.
Returns an action that presses the key specified by the keyCode (eg. Keyevent.KEYCODE_BACK).
Returns an action that presses the specified key with the specified modifiers.
Removes the given assertion from the set of assertions to be run before actions are performed.
viewAssertion | the assertion to remove |
---|
IllegalArgumentException | if the name/viewAssertion pair is not already contained in the global assertions. |
---|
Returns an action that updates the text attribute of a view.
View preconditions:
Returns an action that scrolls to the view.
View preconditions:
Returns an action that performs a swipe top-to-bottom across the horizontal center of the view.
The swipe doesn't start at the very edge of the view, but has a bit of offset.
View constraints:
Returns an action that performs a swipe right-to-left across the vertical center of the
view. The swipe doesn't start at the very edge of the view, but is a bit offset.
View constraints:
Returns an action that performs a swipe left-to-right across the vertical center of the
view. The swipe doesn't start at the very edge of the view, but is a bit offset.
View constraints:
Returns an action that performs a swipe bottom-to-top across the horizontal center of the view.
The swipe doesn't start at the very edge of the view, but has a bit of offset.
View constraints:
Returns an action that selects the view (by clicking on it) and types the provided string into
the view. Appending a \n to the end of the string translates to a ENTER key event. Note: this
method performs a tap on the view before typing to force the view into focus, if the view
already contains text this tap may place the cursor at an arbitrary position within the text.
View preconditions:
Returns an action that types the provided string into the view.
Appending a \n to the end of the string translates to a ENTER key event. Note: this method
does not change cursor position in the focused view - text is inserted at the location where
the cursor is currently pointed.
View preconditions: