My app's Reyclerview is "android.support.v7.widget.RecyclerView" And I use androidx's espresso.
I added dependencies to my gradle like below:
androidTestImplementation 'androidx.annotation:annotation:' + rootProject.androidxLibVersion;
androidTestImplementation 'androidx.recyclerview:recyclerview:' + rootProject.androidxLibVersion;
androidTestImplementation 'androidx.test:core:' + rootProject.coreVersion
androidTestImplementation 'androidx.test.ext:junit:' + rootProject.extJUnitVersion
androidTestImplementation 'androidx.test:runner:' + rootProject.runnerVersion
androidTestImplementation 'androidx.test.espresso:espresso-core:' + rootProject.espressoVersion
androidTestImplementation 'androidx.test.espresso:espresso-contrib:' + rootProject.espressoVersion
androidTestImplementation 'androidx.test.espresso:espresso-intents:' + rootProject.espressoVersion
However, when I am trying to use
import androidx.recyclerview.widget.RecyclerView
import androidx.test.espresso.contrib.RecyclerViewActions
...
RecyclerViewActions.scrollToPosition<RecyclerView.ViewHolder>(position)
It says
Caused by: java.lang.RuntimeException: Action will not be performed because the target view does not match one or more of the following constraints: (is assignable from class: class androidx.recyclerview.widget.RecyclerView and is displayed on the screen to the user) Target view: "RecyclerView{id=2131296674, res-name=media_content_recyclerview, visibility=VISIBLE, width=1440, height=2384, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.RelativeLayout$LayoutParams@e32b046, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=192.0, child-count=15}"
Is there something wrong in my code?