Module: Kookaburra::UIDriver::HasBrowser

Included in:
Kookaburra::UIDriver, UIComponent
Defined in:
lib/kookaburra/ui_driver/mixins/has_browser.rb

Constant Summary collapse

Unexpected500 =
Class.new(StandardError)

Instance Method Summary collapse

Instance Method Details

#browserObject



12
13
14
# File 'lib/kookaburra/ui_driver/mixins/has_browser.rb', line 12

def browser
  @browser ||= @opts.fetch(:browser)
end

#initialize(options = {}) ⇒ Object

This will fail if the options hash does not include a value for the key :browser



7
8
9
10
# File 'lib/kookaburra/ui_driver/mixins/has_browser.rb', line 7

def initialize(options = {})
  super()
  @opts = options
end

#no_500_error!Object



21
22
23
24
25
26
# File 'lib/kookaburra/ui_driver/mixins/has_browser.rb', line 21

def no_500_error!
  if browser.has_css?('head title', :text => 'Internal Server Error')
    sleep 30 if ENV['GIMME_CRAP']
    raise Unexpected500, browser.body
  end
end

#visit(*args) ⇒ Object



16
17
18
19
# File 'lib/kookaburra/ui_driver/mixins/has_browser.rb', line 16

def visit(*args)
  browser.visit *args
  no_500_error!
end