Class: Kookaburra::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/kookaburra/configuration.rb

Overview

Provides access to the configuration data used throughout Kookaburra

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#app_hostObject

This is the root URL of your running application, including the port number if necessary. (e.g. "http://my.example.com:12345")

Raises:

  • (Kookaburra::ConfigurationError)

    if you try to read this attribute without it having been set



39
# File 'lib/kookaburra/configuration.rb', line 39

dependency_accessor :app_host

#browserObject

This object is used by UIDriver::UIComponent to interface with the web browser. Typically it should be an instance of Capybara::Session

Raises:

  • (Kookaburra::ConfigurationError)

    if you try to read this attribute without it having been set



31
# File 'lib/kookaburra/configuration.rb', line 31

dependency_accessor :browser

#given_driver_classObject

The class to use as your GivenDriver

Raises:

  • (Kookaburra::ConfigurationError)

    if you try to read this attribute without it having been set



15
# File 'lib/kookaburra/configuration.rb', line 15

dependency_accessor :given_driver_class

#loggerObject

This is the logger to which Kookaburra will send various messages about its operation. This would generally be used to allow UIDriver subclasses to provide detailed failure information.



55
# File 'lib/kookaburra/configuration.rb', line 55

dependency_accessor :logger

#mental_modelObject

This is the MentalModel that is shared between your GivenDriver and your UIDriver. This attribute is managed by Kookaburra, so you shouldn't need to change it yourself.

Raises:

  • (Kookaburra::ConfigurationError)

    if you try to read this attribute without it having been set



48
# File 'lib/kookaburra/configuration.rb', line 48

dependency_accessor :mental_model

#ui_driver_classObject

The class to use as your UIDriver

Raises:

  • (Kookaburra::ConfigurationError)

    if you try to read this attribute without it having been set



22
# File 'lib/kookaburra/configuration.rb', line 22

dependency_accessor :ui_driver_class

Instance Method Details

#app_host_uriURI

The parsed version of the #app_host

This is useful if, for example, you are testing a multi-host application and need to change the hostname that will be accessed but want to keep the originally-specified port

Returns:

  • (URI)

    A URI object created from the #app_host string



84
85
86
# File 'lib/kookaburra/configuration.rb', line 84

def app_host_uri
  URI.parse(app_host)
end

#server_error_detection { ... } ⇒ Object

Specify a function that can be used to determine if a server error has occured within your application.

If the function returns true, then Kookaburra will assume that the application has responded with an error.

Examples:

If the page title is "Internal Server Error"

config.server_error_detection { |browser|
  browser.has_css?('head title', :text => 'Internal Server Error')
}

Yields:

  • whichever object was assigned to #browser



69
70
71
72
73
74
75
# File 'lib/kookaburra/configuration.rb', line 69

def server_error_detection(&blk)
  if block_given?
    @server_error_detection = blk
  else
    @server_error_detection
  end
end