I am setting up UI Tests and keep getting an androidx.test.espresso.NoMatchingViewException: No views in hierarchy found matching:
error message
My xml file looks like this with multiple categories
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:key="@string/key_preference_screen"
android:title="@string/sometitlename">
<PreferenceCategory
android:layout="@layout/category_layout"
android:key="@string/key_pref_">
<Preference
android:key="@string/key"
android:title="@string/pref_title"/>
</PreferenceCategory>
</PreferenceScreen>
I've tried variations of
onData(allOf(`is`(instanceOf(Preference::class.java)),
withKey(R.string.key),
withTitle(R.string.pref_title)))
.onChildView(withText(pref_title))
.check(matches(isCompletelyDisplayed()))```