module Wrapybara
To use Wrapybara's focus handling capabilities, require wrapybara/ext/focus_handling in some file that gets loaded (I use support/extras.rb so I don't pollute env.rb) and then optionally set Wrapybara.focus_attribute
to whatever the element attribute will be. As you can see below, Wrapybara
checks the value of the attribute against what you say it should be when the element has focus.
Public Class Methods
focus_attribute()
click to toggle source
# File lib/wrapybara/ext/focus_tracking.rb, line 17 def self.focus_attribute @focus_attribute || 'has-focus' end
focus_attribute=(attribute)
click to toggle source
# File lib/wrapybara/ext/focus_tracking.rb, line 13 def self.focus_attribute=(attribute) @focus_attribute = attribute end
focus_value()
click to toggle source
# File lib/wrapybara/ext/focus_tracking.rb, line 25 def self.focus_value @focus_value || 'true' end
focus_value=(value)
click to toggle source
# File lib/wrapybara/ext/focus_tracking.rb, line 21 def self.focus_value=(value) @focus_value = value end
Public Instance Methods
current_path()
click to toggle source
# File lib/wrapybara/methods.rb, line 12 def current_path Capybara.current_path end
current_path_is?(path)
click to toggle source
# File lib/wrapybara/methods.rb, line 20 def current_path_is?(path) path = path.gsub('/', '\/').gsub('?', '\?') (current_url || current_path) =~ /#{path}/ end
current_path_should_be(path)
click to toggle source
# File lib/wrapybara/methods.rb, line 25 def current_path_should_be(path) raise UnmetExpectation, "Expected the current path to be '#{path}'" unless current_path_is?(path) end
current_path_should_not_be(path)
click to toggle source
# File lib/wrapybara/methods.rb, line 29 def current_path_should_not_be(path) raise UnmetExpectation, "Did not expect the current path to be '#{path}'" if current_path_is?(path) end
current_url()
click to toggle source
# File lib/wrapybara/methods.rb, line 16 def current_url Capybara.current_url end
host()
click to toggle source
# File lib/wrapybara/methods.rb, line 8 def host Capybara.app_host end