Espresso 无法点击显示的视图
Espresso can't click displayed view
一夜之间,我的 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: [...]
Espresso 中的行 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.
我不明白为什么会这样。我可以在测试期间看到屏幕上的视图,espresso 给了我一些坐标。
编辑:
因为它是一个 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"/>
该错误与 Espresso 或 Barista 无关。
java.util.NoSuchElementException: List is empty
被扔到视图的 OnClickListener
中。
一夜之间,我的 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: [...]
Espresso 中的行 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.
我不明白为什么会这样。我可以在测试期间看到屏幕上的视图,espresso 给了我一些坐标。
编辑:
因为它是一个 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"/>
该错误与 Espresso 或 Barista 无关。
java.util.NoSuchElementException: List is empty
被扔到视图的 OnClickListener
中。