Module: WebStepsHelpers

Defined in:
lib/spreewald_support/web_steps_helpers.rb

Instance Method Summary collapse

Instance Method Details

#assert_hidden(options) ⇒ Object



9
10
11
# File 'lib/spreewald_support/web_steps_helpers.rb', line 9

def assert_hidden(options)
  visibility_test(options.merge(:expectation => :hidden))
end

#assert_visible(options) ⇒ Object



5
6
7
# File 'lib/spreewald_support/web_steps_helpers.rb', line 5

def assert_visible(options)
  visibility_test(options.merge(:expectation => :visible))
end

#find_with_disabled(*args, **options, &optional_filter_block) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/spreewald_support/web_steps_helpers.rb', line 13

def find_with_disabled(*args, **options, &optional_filter_block)
  if Spreewald::Comparison.compare_versions(Capybara::VERSION, :<, "2.0")
    find(:xpath, XPath::HTML.send(args[0], args[1])) # Versions < 2.0 will find both enabled and disabled fields, nothing to do
  elsif Spreewald::Comparison.compare_versions(Capybara::VERSION, :<, "2.6")
    begin
      find(*args, **options, disabled: false, &optional_filter_block)
    rescue Capybara::ElementNotFound
      find(*args, **options, disabled: true, &optional_filter_block)
    end
  else
    options_with_disabled = { disabled: :all }.merge(options)
    find(*args, **options_with_disabled, &optional_filter_block)
  end
end