简体   繁体   English

Android Studio浓缩咖啡测试记录器-滑动事件

[英]Android Studio espresso test recorder - swipe events

I've been playing around with the espresso test recorder and reading the documentation 我一直在玩意式咖啡记录仪,并阅读文档

The documentation states: 该文档指出:

Interact with your device to start logging events such as “tap” and “type” actions. 与设备进行交互以开始记录事件,例如“轻击”和“键入”动作。

Is it possible to record swipe events like swiping on a view pager? 是否可以记录诸如在查看寻呼机上滑动的滑动事件? I've been unable to find any examples of this being done, though I know it's still in beta. 我一直无法找到完成此操作的任何示例,尽管我知道它仍处于测试阶段。

Thanks 谢谢

我目前知道的唯一解决方案是将手势手动添加到生成的测试代码中。

onView(withId(R.id.xyz)).perform(swipeLeft());

Nowadays, Espresso Test Recorder lacks in features like swipe events or starting from actual activity. 如今,Espresso Test Recorder缺少诸如滑动事件或从实际活动开始的功能。 Maybe that would be fixed in the nearest feature. 也许这将在最近的功能中修复。

Nowadays, still more simple and less flaky way is to write Espresso tests. 如今,更简单,更轻松的方法是编写Espresso测试。

This might be useful: https://google.github.io/android-testing-support-library/downloads/espresso-cheat-sheet-2.1.0.pdf 这可能很有用: https : //google.github.io/android-testing-support-library/downloads/espresso-cheat-sheet-2.1.0.pdf

Hope it will help. 希望它会有所帮助。

Recycler view particular item swap

    ViewInteraction recyclerView = onView(allOf(withId(R.id.rc_vehicle_list),
                withParent(withId(R.id.ll_vehicle)),
                isDisplayed()));
        recyclerView.perform(actionOnItemAtPosition(3,swipeUp()));




 public static ViewAction swipeUp() {
        return new GeneralSwipeAction(Swipe.FAST, GeneralLocation.CENTER_LEFT,
                GeneralLocation.CENTER_RIGHT, Press.FINGER);
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM