class Cornucopia::Capybara::FinderDiagnostics

Public Class Methods

diagnose_finder(test_object, function_name, *args, &block) click to toggle source

This takes the same arguments as the test_finder function, but it will always output a diagnostic report.

This is for the times when the finder finds something, but you think that it may be wrong, or for whatever reason, you want more information about it to be output.

# File lib/cornucopia/capybara/finder_diagnostics.rb, line 41
def self.diagnose_finder(test_object, function_name, *args, &block)
  find_action = Cornucopia::Capybara::FinderDiagnostics::FindAction.new(test_object, {}, {}, function_name, *args, &block)

  results = find_action.run
  results = results.to_a if function_name == :all
  find_action.generate_report "Diagnostic report on \"#{function_name.to_s}\":", nil

  results
end
test_finder(test_object, function_name, *args, &block) click to toggle source

This function calls a “finder” function with the passed in arguments on the passed in object. If the function succeeds, it doesn't do anything else. If the function fails, it tries to figure out why, and provide diagnostic information for further analysis.

Parameters:

 test_object - the object to call the finder function on.  Examples could be:
   self
   page
   test_finder(:find, ...)
 function_name - this is the "finder" function to be called.  Examples could be:
   all
   find
   fill_in
   click_link
   select
   etc.
 args - the arguments that you would pass into the function normally.

Usage:
 Instead of calling: <test_object>.<function> <args>
 you would call:     test_finder <test_object>, :<function>, <args>
# File lib/cornucopia/capybara/finder_diagnostics.rb, line 31
def self.test_finder(test_object, function_name, *args, &block)
  Cornucopia::Capybara::FinderDiagnostics::FindAction.new(test_object, {}, {}, function_name, *args, &block).run
end