RecyclerViewActions.PositionableRecyclerViewAction


public interface RecyclerViewActions.PositionableRecyclerViewAction extends ViewAction


Most RecyclerViewActions are given a matcher to select a particular view / viewholder within the RecyclerView. In this case the default behaviour is to expect that the matcher matches 1 and only one item within the RecyclerView.

This interface gives users the ability to override that type of behaviour and explicitly select an item in the RecyclerView at a given position. This is similar to on the onData(...).atPosition() api for AdapterViews.

Summary

Public methods

abstract RecyclerViewActions.PositionableRecyclerViewAction
atPosition(int position)

Returns a new ViewAction which will cause the ViewAction to operate upon the position-th element which the matcher has selected.

Inherited methods

From androidx.test.espresso.ViewAction
abstract Matcher<View>

A mechanism for ViewActions to specify what type of views they can operate on.

abstract String

Returns a description of the view action.

abstract void
perform(UiController uiController, View view)

Performs this action on the given view.

Public methods

atPosition

abstract RecyclerViewActions.PositionableRecyclerViewAction atPosition(int position)

Returns a new ViewAction which will cause the ViewAction to operate upon the position-th element which the matcher has selected.

Parameters
int position

a 0-based index into the list of matching elements within the RecyclerView.

Returns
RecyclerViewActions.PositionableRecyclerViewAction

PositionableRecyclerViewAction a new ViewAction focused on a particular position.

Throws
java.lang.IllegalArgumentException

if position <0.