由于我在注册屏幕上有多个字段,并且我对空字段使用相同的字符串资源,我该如何解决这个错误?
com.som.android.acceptanceTests.signIn.RegistrationScreenTest > startRegistrationWithEmptyFields[emu_19_WXGA720(AVD) - 5.0.2] FAILED
android.support.test.espresso.AmbiguousViewMatcherException: '(with id: com.fentury.android:id/errorMessage and with text: is "This field cannot be empty")' matches multiple views in the hierarchy.
Problem views are marked with '****MATCHES****' below.
最佳答案
这是 Espresso 匹配器的重要资源:https://google.github.io/android-testing-support-library/docs/espresso/cheatsheet/
看起来您需要以下内容:
onView(allOf(withId(R.id.errorMessage), withSibling(withId(特定输入的 id))))
或isDescendantOfA()
是否有一个独特的容器 View
关于java - 下面的比赛在 Espresso ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43606649/