葫芦android轻扫不起作用

时间:2016-03-14 10:48:30

标签: android calabash calabash-android

我正在运行一个android calabash测试。我在屏幕上有两个标签,当我尝试 perform_action('刷卡','右键')时,我在这两个标签之间进行切换屏幕滑动,它返回到以前的状态,而无需切换到新选项卡。我甚至尝试过 perform_action('拖动',86,306,143,143,10),但没有得到回应。 当我打印查询得到下面给出的响应。在这里,我想在聊天联系人之间切换。

{  
  "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
  }

2 个答案:

答案 0 :(得分:2)

这些是非常陈旧和不赞成的行为。我建议只使用pan_left或类似的。您可以为这些方法指定百分比坐标

答案 1 :(得分:2)

以下代码已足够。无需使用 perform_action 方法。 Then /^I pan right $/ do pan_right() end