i have write code to test my SearchView behavior but failed. standard scenario just i want to insert some query into my searcview and then submit
this is my code
onView(withId(R.id.search_match))
.perform(click())
onView(
withId(R.id.search_src_text)
).perform(replaceText("Arsenal"), closeSoftKeyboard(), pressKey(KeyEvent.KEYCODE_ENTER)) //failed here
i got error like this
androidx.test.espresso.PerformException: Error performing 'replace text(Arsenal)' on view 'with id: com.kuhaku.footballmatchschedule:id/search_src_text'.
my xml code
<androidx.cardview.widget.CardView
app:cardCornerRadius="12dp"
android:layout_marginHorizontal="8dp"
app:cardElevation="8dp"
android:id="@+id/card_search"
app:cardUseCompatPadding="true"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.SearchView
android:id="@+id/search_match"
app:queryHint="Search Match"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</androidx.cardview.widget.CardView>
Aucun commentaire:
Enregistrer un commentaire