浓缩咖啡无法单击显示的视图

时间:2019-11-08 08:38:13

标签: android android-espresso android-testing barista

整夜我的ui测试突然停止工作:

咖啡师clickOn(R.id.myView)中的行引发:

com.schibsted.spain.barista.internal.failurehandler.BaristaException: Could not perform action single click on view with id: [...]   
[...]   
Caused by: androidx.test.espresso.NoMatchingViewException: No views in hierarchy found matching: (is displayed on the screen to the user and with id: [...]

浓咖啡onView(withId(R.id.myView)).perform(scrollTo(), click())中的行引发:

androidx.test.espresso.PerformException: Error performing 'single click - At Coordinates: 53, 1723 and precision: 16, 16' on view 'Animations or transitions are enabled on the target device.  
[...]   
Caused by: java.util.NoSuchElementException: List is empty.

我不明白为什么会这样。测试期间我可以在屏幕上看到视图,而意式浓缩咖啡为我提供了一些坐标。

修改:
由于它是TextView,所以我也尝试了Baristas clickOn(context.getString(R.string.myText)),但它抛出:

com.schibsted.spain.barista.internal.failurehandler.BaristaException: Could not perform action single click on view with text: is [...]  
[...]   
Caused by: androidx.test.espresso.NoMatchingViewException: No views in hierarchy found matching: (is displayed on the screen to the user and with text: is [...]
<TextView
   android:id="@+id/myView"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:text="@string/myText"/>

1 个答案:

答案 0 :(得分:0)

该错误与Espresso或Barista无关。
java.util.NoSuchElementException: List is empty被抛出到视图的OnClickListener中。