Search code examples
calabashcalabash-android

Why am I getting uninitialized constant Calabash::ABase (NameError)?


I'm using Calabash. I ran calabash-android gen as described here. I have a step definition, a page object and a feature. Here's my page object:

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

When I run bundle exec calabash-android run .\app-releaseStaging.apk I get:

uninitialized constant Calabash::ABase (NameError)

Solution

  • Adding require 'calabash-android' to the top of the page object fixed it:

    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 is defined here.