module SitePrism::Loadable::ClassMethods
SitePrism::Loadable::ClassMethods
-
This exposes all of the
DSL
definitions users will use when generating “loadables”A “Loadable” is a definition whereby the page object once loaded must pass a boolean check These loadables are typically provided using the method `load_validation`
Public Instance Methods
Appends a load validation block to the page class.
When `loaded?` is called, these blocks are instance_eval'd against the current page instance. This allows users to wait for specific events to occur on the page or certain elements to be loaded before performing any actions on the page.
@param block [&block] A block which returns true if the page loaded successfully, or false if it did not. This block can contain up to 2 elements in an array The first is the physical validation test to be truthily evaluated.
If this does not pass, then the 2nd item (if defined), is output as an error message to the FailedLoadValidationError
that is thrown
@return [Proc]
# File lib/site_prism/loadable.rb, line 106 def load_validation(&block) _load_validations << block end
The list of load_validations. They will be executed in the order they are defined.
@return [Array]
# File lib/site_prism/loadable.rb, line 81 def load_validations if superclass.respond_to?(:load_validations) superclass.load_validations + _load_validations else _load_validations end end
Private Instance Methods
# File lib/site_prism/loadable.rb, line 112 def _load_validations @_load_validations ||= [] end