Search code examples
androidcalabashcalabash-android

Calabash android swipe not working


I am running an android calabash test. I have two tabs on my screen and to switch between these two tabs when I have tried perform_action('swipe', 'right') a small portion of the screen swiping and it goes back to the previous state without switching to the new tab. I have even tried perform_action('drag', 86, 306, 143, 143, 10) but getting no response. When I print the query getting the below-given response. Here I wanted to switch between chats and contacts.

{  
  "id"      =>nil,
  "enabled"      =>true,
  "contentDescription"      =>nil,
  "text"      =>"Chats",
  "visible"      =>true,
  "tag"      =>nil,
  "description"      =>"android.support.v7.widget.AppCompatTextView@42569e98",
  "class"      =>"android.support.v7.widget.AppCompatTextView",
  "rect"      =>      {  
     "center_y"         =>157,
     "center_x"         =>119,
     "height"         =>29,
     "y"         =>143,
     "width"         =>67,
     "x"         =>86
  }
},
{  
  "id"      =>nil,
  "enabled"      =>true,
  "contentDescription"      =>nil,
  "visible"      =>true,
  "tag"      =>nil,
  "description"      =>"android.support.design.widget.TabLayout$TabView@4256b740",
  "class"      =>"android.support.design.widget.TabLayout$TabView",
  "rect"      =>      {  
     "center_y"         =>158,
     "center_x"         =>360,
     "height"         =>72,
     "y"         =>122,
     "width"         =>240,
     "x"         =>240
  }
},
{  
  "id"      =>nil,
  "enabled"      =>true,
  "contentDescription"      =>nil,
  "text"      =>"Contacts",
  "visible"      =>true,
  "tag"      =>nil,
  "description"      =>"android.support.v7.widget.AppCompatTextView@4256c690",
  "class"      =>"android.support.v7.widget.AppCompatTextView",
  "rect"      =>      {  
     "center_y"         =>157,
     "center_x"         =>359,
     "height"         =>29,
     "y"         =>143,
     "width"         =>107,
     "x"         =>306
  }

Solution

  • The below code is enough.no need to use the perform_action method. Then /^I pan right $/ do pan_right() end