Android Espresso执行longClick而不是click [英] Android Espresso performs longClick instead of click
问题描述
onData(anything()).inAdapterView(withId(R.id.ScheduleOrderListViewListView))
.atPosition(0).perform(click());
50%的时间进行长触摸操作-有一个好的解决方法吗?
perfoms 50% of the time a longtouch - is there are a good workaround?
推荐答案
这是不幸的副作用,它是如何将轻敲事件从您的测试代码通过RPC传递到受测Android应用程序的.
This is an unfortunate side effect of how tap events are passed from your test code over RPC to the Android application under test. The best description of why clicks are sometimes executed as long clicks can be found in the Espresso source code.
此问题不太可能很快得到解决.避免出现此问题的最佳选择是在规格较高的设备上运行测试.这是因为问题发生的可能性取决于系统负载.
It is unlikely this issue will be fixed anytime soon. The best option you have of avoiding the issue is to run your tests on higher spec devices. This is because the likelihood of the issue occurring is dependent on system load.
这篇关于Android Espresso执行longClick而不是click的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!