android - Firebase Roboscript 中止由于 android Studio 记录 robo 脚本无法记录页面滚动事件

标签 android firebase android-studio firebase-test-lab

我已经从 android studio 录制了一个 robo 脚本(android studio ->tools->Firebase->test Lab->record robo script)。在我的 Activity 中,我有一个由大约 20 个值(编辑文本)组成的 recyclerview,如图所示在 create.png 图像中。因此,当我通过滚动回收器 View 将值放入所有 20 个编辑文本中来记录此 Activity 的机器人脚本时。然后我将此脚本文件连同构建的 .apk 文件上传到 firebase 测试实验室。但在测试结果中它显示“roboscript 被中止”。这个错误是针对滚动后填充的编辑文本值。那么有什么方法可以在录制时在robo脚本中添加滚动事件,因为目前android studio不录制任何滚动事件? Click here for create.png

下面是录制的robo脚本(.json文件)

{
"eventType": "VIEW_CLICKED",//Last edittext value before scrolling
"timestamp": 1558518939378,
"replacementText": "Normal",
"actionCode": -1,
"delayTime": 0,
"canScrollTo": false,
"elementDescriptors": [
  {
    "className": "android.support.v7.widget.AppCompatRadioButton",
    "recyclerViewChildPosition": -1,
    "adapterViewChildPosition": -1,
    "groupViewChildPosition": 0,
    "resourceId": "com.badger.badgermap:id/radioBtn",
    "contentDescription": "",
    "text": "Normal"
  },
  {
    "className": "android.support.constraint.ConstraintLayout",
    "recyclerViewChildPosition": -1,
    "adapterViewChildPosition": -1,
    "groupViewChildPosition": 1,
    "resourceId": "com.badger.badgermap:id/rowCreateNewCheckInConstraintLayout",
    "contentDescription": "",
    "text": ""
  },
  {
    "className": "android.support.v7.widget.RecyclerView",
    "recyclerViewChildPosition": -1,
    "adapterViewChildPosition": -1,
    "groupViewChildPosition": 3,
    "resourceId": "com.badger.badgermap:id/recyclerViewOptions",
    "contentDescription": "",
    "text": ""
  }
]
  },
  {
"eventType": "DELAYED_MESSAGE_POSTED",
"timestamp": 1558518940996,
"actionCode": -1,
"delayTime": 20000,
"canScrollTo": true,
"elementDescriptors": []
 },
  {
   "eventType": "VIEW_TEXT_CHANGED",     // edittext value  after                                         
                                            scrolling. after this script 
                                             gets aborted
"timestamp": 1558518955414,
"replacementText": "222",
"actionCode": -1,
"delayTime": 0,
"canScrollTo": false,
"elementDescriptors": [
  {
    "className": "android.support.v7.widget.AppCompatEditText",
    "recyclerViewChildPosition": -1,
    "adapterViewChildPosition": -1,
    "groupViewChildPosition": 1,
    "resourceId": "com.badger.badgermap:id/textViewValue",
    "contentDescription": "",
    "text": ""
  },
  {
    "className": "android.widget.RelativeLayout",
    "recyclerViewChildPosition": -1,
    "adapterViewChildPosition": -1,
    "groupViewChildPosition": 2,
    "resourceId": "com.badger.badgermap:id/MassUpdateLayout",
    "contentDescription": "",
    "text": ""
  },
  {
    "className": "android.support.v7.widget.RecyclerView",
    "recyclerViewChildPosition": -1,
    "adapterViewChildPosition": -1,
    "groupViewChildPosition": 3,
    "resourceId": "com.badger.badgermap:id/recyclerViewAdditionalFields",
    "contentDescription": "",
    "text": ""
  }
]
 },

最佳答案

在这种情况下,问题不在于滚动,而在于到目前为止,Robo Script Recorder (RSR) 仅在对 RecyclerView 的直接子级执行操作时才考虑 RecyclerView。如果是这种情况,RSR 将记录对其执行操作的元素的 RecyclerView 索引,并且在重放此脚本时,Robo 将滚动到该元素作为执行记录操作的一部分(即,无需记录专用滚动行动)。

然而,在您的情况下,对其执行操作的元素是 RecyclerView 的孙元素。结果,RSR 没有考虑 RecyclerView,也没有在录制的脚本中捕获元素的 RecyclerView 索引。因此,在重播脚本时,Robo 没有滚动到该元素,因此无法在屏幕上找到它。

如果您有兴趣支持对 RecyclerView 的非直接子级执行操作,请随时提交功能请求 https://issuetracker.google.com/issues/new?component=192775请注意,此链接将带您提交 Espresso 测试记录器 (ETR) 的功能请求,但 ETR 和 RTR 共享相同的 RecyclerViews 记录逻辑。

关于android - Firebase Roboscript 中止由于 android Studio 记录 robo 脚本无法记录页面滚动事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56258259/

相关文章:

Android Double Back Press关闭有 fragment 的应用

java.io.FileNotFoundException 在内部存储 android 中保存/加载

android - Git 实验分支还是单独的实验存储库?

android - EditText setError 没有停留在盒子上

javascript - firebase 查询方法 startAt() 采用区分大小写的参数

android - 无法在 Android Studio 2.1.1 中运行 Android 模拟器

android - 使用 Google Service Plugin 3.2.0 的 Gradle 构建失败

swift - 如何在约会 child 后从 Firebase 中读取内容?

ios - 如何将数据添加到 Firebase?

java - 如何将 Stack 中的 View 添加到 LinearLayout 中?