Search code examples
androidfirebaseandroid-studiofirebase-test-lab

Firebase Roboscript aborted due to android Studio record robo script can't record page scroll event


I have recorded a robo script from android studio (android studio ->tools->Firebase->test Lab-> record robo script).In my activity I have a recyclerview consist of around 20 values (edit text) as shown in create.png image. So when I have recorded the robo script for this activity by putting values in all the 20 edit text by scrolling that recycler view. Then I upload this script file along with builded .apk file to the firebase test lab. But in the test result it shows "roboscript gets aborted". And this error is for the edit text values filled after scrolling. So is there any way we can add a scrolling event in the robo script while recording because currently android studio does not recording any scrolling event?Click here for create.png

Below is the recorded robo script (.json file)

{
"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": ""
  }
]
 },

Solution

  • In this case, the problem is not in scrolling, but in the fact that as of now, Robo Script Recorder (RSR) considers RecyclerViews only when actions are performed on their immediate children. If it was the case, RSR would record the RecyclerView index of the element on which the action was performed and while replaying this script, Robo would scroll to that element as part of performing the recorded action (i.e., no need to record a dedicated scroll action).

    In your case however, the element on which the action was performed is a grandchild of a RecyclerView. As a result, RSR did not account for RecyclerView and did not capture the element's RecyclerView index in the recorded script. Consequently, while replaying the script, Robo did not scroll to the element and thus, could not find it on the screen.

    If you are interested in supporting actions on non-immediate children of RecyclerViews, please feel free to submit a feature request https://issuetracker.google.com/issues/new?component=192775 Note that this link will take you to submitting a feature request for Espresso Test Recorder (ETR), but both ETR and RTR share the same recording logic for RecyclerViews.