为什么我会得到未初始化的常量Calabash :: ABase(NameError)?

时间:2018-08-02 17:34:12

标签: calabash calabash-android

我正在使用葫芦。我按照here的描述运行了calabash-android gen。我有一个步骤定义,一个页面对象和一个功能。这是我的页面对象:

class LocationScanPage < Calabash::ABase  
    LIST_BUTTON_QUERY="com.facebook.react.views.text.ReactTextView marked:'List'"

    def trait
        LIST_BUTTON_QUERY
    end

    def await(opts={})
      wait_for_elements_exist([trait])
      self
    end
end

运行bundle exec calabash-android run .\app-releaseStaging.apk会得到:

uninitialized constant Calabash::ABase (NameError)

1 个答案:

答案 0 :(得分:0)

require 'calabash-android'添加到页面对象的顶部即可解决此问题:

require 'calabash-android'

class LocationScanPage < Calabash::ABase  
    LIST_BUTTON_QUERY="com.facebook.react.views.text.ReactTextView marked:'List'"

    def trait
        LIST_BUTTON_QUERY
    end

    def await(opts={})
      wait_for_elements_exist([trait])
      self
    end
end

Calabash::ABase被定义为here