【问题标题】:Calabash Android Soft Buttons and Hard Buttons detectionCalabash Android 软按钮和硬按钮检测
【发布时间】:2014-06-10 03:45:56
【问题描述】:

我正在 Calabash 中为 Android 和 iOS 创建测试。

现在,该应用将在带有物理按钮的设备上使用“菜单”按钮。并且在没有物理按钮时会显示一个菜单选项。

目前,使用物理按钮的设备上的葫芦测试失败(因为它们是使用软按钮设计的)。

有没有办法用葫芦检测手机的型号(或硬按钮的存在)?

【问题讨论】:

    标签: android ruby testing cucumber calabash


    【解决方案1】:

    最初我通过查询屏幕找到并识别了“菜单”按钮。

    touch("com.android.internal.view.menu.ActionMenuPresenter$OverflowMenuButton marked:'More options'") // terrible way to do this.
    

    但是,这(显然)不适用于不显示菜单按钮以支持物理按钮的旧设备。

    更好的方法是使用“press_menu”操作:

    performAction('press_menu')
    

    这也是一个预定义的步骤:

    Then /^I press the menu key$/
    

    定义于:

    calabash-android/ruby-gem/lib/calabash-android/steps/navigation_steps.rb
    

    作者:

    Then /^I press the menu key$/ do
      performAction('press_menu')
    end
    

    【讨论】:

      猜你喜欢
      • 2014-08-13
      • 1970-01-01
      • 1970-01-01
      • 2013-11-08
      • 1970-01-01
      • 1970-01-01
      • 2014-04-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多