Module: SitePrism::ElementChecker
Instance Method Summary collapse
-
#all_there?(recursion: 'none') ⇒ Boolean
Runnable in the scope of any SitePrism::Page or Section.
- #elements_present ⇒ Object
Instance Method Details
#all_there?(recursion: 'none') ⇒ Boolean
Runnable in the scope of any SitePrism::Page or Section. Returns true
when “every item” that is being checked is present within the current scope. See #elements_to_check for how the definition of “every item” is derived.
Example { element => :button_one, element => :button_two, section => :filters } @my_page.all_there?
> true - If the three items above are all present
Note that #elements_to_check will affect the hash of mapped_items
When using the recursion parameter, one of three values is valid.
Default: ‘none’ => Perform no recursion when calling #all_there? Override: ‘one’ => Perform one recursive dive into all section items and call #all_there? on those items too.
23 24 25 26 27 28 29 30 31 |
# File 'lib/site_prism/element_checker.rb', line 23 def all_there?(recursion: 'none') SitePrism.logger.info('Setting for recursion is being ignored for now.') if %w[none one].include?(recursion) elements_to_check.all? { |item_name| there?(item_name) } else SitePrism.logger.error('Invalid recursion setting, Will not run.') end end |
#elements_present ⇒ Object
33 34 35 |
# File 'lib/site_prism/element_checker.rb', line 33 def elements_present _mapped_items.select { |item_name| there?(item_name) } end |