Class: Cornucopia::Capybara::FinderDiagnostics
- Inherits:
-
Object
- Object
- Cornucopia::Capybara::FinderDiagnostics
- Defined in:
- lib/cornucopia/capybara/finder_diagnostics.rb
Defined Under Namespace
Classes: FindAction
Class Method Summary collapse
-
.diagnose_finder(test_object, function_name, *args, &block) ⇒ Object
This takes the same arguments as the #test_finder function, but it will always output a diagnostic report.
-
.test_finder(test_object, function_name, *args, &block) ⇒ Object
This function calls a “finder” function with the passed in arguments on the passed in object.
Class Method Details
.diagnose_finder(test_object, function_name, *args, &block) ⇒ Object
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.
41 42 43 44 45 46 47 48 49 |
# 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) ⇒ Object
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>
31 32 33 |
# 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 |