module Howitzer::Web::CapybaraMethodsProxy

This module proxies required original capybara methods to recipient

Public Instance Methods

click_alert_box(flag) click to toggle source

Accepts or declines JS alert box by given flag @param flag [Boolean] Determines accept or decline alert box

# File lib/howitzer/web/capybara_methods_proxy.rb, line 56
def click_alert_box(flag)
  if %w[selenium sauce].include? Howitzer.driver
    alert = driver.browser.switch_to.alert
    flag ? alert.accept : alert.dismiss
  else
    evaluate_script("window.confirm = function() { return #{flag}; }")
  end
end

Private Instance Methods

capybara_scopes() click to toggle source
# File lib/howitzer/web/capybara_methods_proxy.rb, line 67
def capybara_scopes
  @capybara_scopes ||= Hash.new { |hash, key| hash[key] = [Capybara.current_session] }
  @capybara_scopes[Howitzer.session_name]
end