使用SwipeRefreshLayout时Robo脚本中止

时间:2018-11-19 14:16:42

标签: android firebase firebase-test-lab

我的Robo脚本在遇到此结构中的布局时中止:

<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:fitsSystemWindows="true"
tools:context=".ui.AuftraegeActivity">

<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
    android:id="@+id/swipeRefreshLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

        <ListView
            android:id="@+id/projekte_listview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center_horizontal"
            android:background="@android:color/white"
            android:clipToPadding="false"
            android:divider="#d3d3d3"
            android:dividerHeight="2dp"
            android:paddingStart="10dp"
            android:paddingEnd="10dp"
            android:scrollbarStyle="outsideOverlay"
            android:visibility="gone"
            tools:visibility="visible" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

<include layout="@layout/navdrawer" />

</androidx.drawerlayout.widget.DrawerLayout>

在这里,我尝试单击ListView的第一项。

与服务器成功同步后,ListView的可见性设置为在AuftraegeActivity内部可见。同步时,将显示(UI阻止)进度栏。

删除SwipeRefreshLayout使Robo脚本成功运行。

以下是Robo脚本的相关部分:

{
"eventType": "LIST_ITEM_CLICKED",
"timestamp": 1542633892083,
"replacementText": "",
"actionCode": -1,
"delayTime": 0,
"canScrollTo": false,
"elementDescriptors": [
  {
    "className": "android.widget.LinearLayout",
    "recyclerViewChildPosition": -1,
    "adapterViewChildPosition": 0,
    "groupViewChildPosition": -1,
    "resourceId": "de.tarent.ngop.android.debug:id/ll_auftrag_list_item_container",
    "contentDescription": "",
    "text": ""
  },
  {
    "className": "android.widget.ListView",
    "recyclerViewChildPosition": -1,
    "adapterViewChildPosition": -1,
    "groupViewChildPosition": 0,
    "resourceId": "de.tarent.ngop.android.debug:id/projekte_listview",
    "contentDescription": "",
    "text": ""
  },
  {
    "className": "androidx.swiperefreshlayout.widget.SwipeRefreshLayout",
    "recyclerViewChildPosition": -1,
    "adapterViewChildPosition": -1,
    "groupViewChildPosition": 0,
    "resourceId": "de.tarent.ngop.android.debug:id/swipeRefreshLayout",
    "contentDescription": "",
    "text": ""
  }
]
},

2 个答案:

答案 0 :(得分:0)

作为解决此问题的一种方法,如果您使用Espresso Test Recorder(在Android Studio中,运行-> Record Espresso Test)记录了相同的操作,并查看测试是否存在相同的问题,则将有所帮助。如果可以(很有可能),它将为我们提供有关发生了什么问题的详细错误消息。

作为目前的解决方法,您可以删除LIST_ITEM_CLICKED操作的最后一个元素描述符,即删除大括号中的最后一个块(提到SwipeRefreshLayout的块)以及它前面的逗号。请让我们知道是否有帮助。谢谢!

答案 1 :(得分:0)

{
"eventType": "LIST_ITEM_CLICKED",
"timestamp": 1542633892083,
"replacementText": "",
"actionCode": -1,
"delayTime": 0,
"canScrollTo": false,
"elementDescriptors": [
  {
    "className": "android.widget.LinearLayout",
    "recyclerViewChildPosition": -1,
    "adapterViewChildPosition": 0,
    "groupViewChildPosition": -1,
    "resourceId": "de.tarent.ngop.android.debug:id/ll_auftrag_list_item_container",
    "contentDescription": "",
    "text": ""
  }
]
},