Module: SitePrism

Defined in:
lib/site_prism.rb,
lib/site_prism/dsl.rb,
lib/site_prism/page.rb,
lib/site_prism/error.rb,
lib/site_prism/timer.rb,
lib/site_prism/logger.rb,
lib/site_prism/waiter.rb,
lib/site_prism/section.rb,
lib/site_prism/version.rb,
lib/site_prism/loadable.rb,
lib/site_prism/deprecator.rb,
lib/site_prism/dsl/builder.rb,
lib/site_prism/dsl/methods.rb,
lib/site_prism/dsl/locators.rb,
lib/site_prism/dsl/validator.rb,
lib/site_prism/rspec_matchers.rb,
lib/site_prism/element_checker.rb,
lib/site_prism/addressable_url_matcher.rb

Overview

SitePrism

Defined Under Namespace

Modules: DSL, ElementChecker, Loadable Classes: AddressableUrlMatcher, AttributeValidationError, BlockError, Deprecator, ElementInvisibilityTimeoutError, ElementVisibilityTimeoutError, FailedLoadValidationError, InvalidDSLNameError, InvalidElementError, InvalidUrlMatcherError, Logger, MissingBlockError, NoUrlForPageError, NoUrlMatcherForPageError, Page, PageLoadError, RSpecMatchers, Section, SitePrismError, TimeoutError, Timer, UnsupportedBlockError, UnsupportedGemVersionError, Waiter

Constant Summary collapse

VERSION =
'5.0.4'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.dsl_validation_disabledObject

SitePrism will enforce strict validation on all generated DSL items i.e. ‘element` The validations are found inside the SitePrism::DSL::Validator module NB: To ensure no unwanted validation issues, this must be disabled BEFORE any page / section code is autoloaded



28
29
30
# File 'lib/site_prism.rb', line 28

def dsl_validation_disabled
  @dsl_validation_disabled
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (SitePrism)

    the object that the method was called on



30
31
32
# File 'lib/site_prism.rb', line 30

def configure
  yield self
end

.log_levelObject

To query what level is being logged

SitePrism.log_level # => :UNKNOWN # By default


72
73
74
# File 'lib/site_prism.rb', line 72

def log_level
  %i[DEBUG INFO WARN ERROR FATAL UNKNOWN][logger.level]
end

.log_level=(value) ⇒ Object

To enable full logging (This uses the Ruby API, so can accept any of a Symbol / String / Integer as an input

SitePrism.log_level = :DEBUG
SitePrism.log_level = 'DEBUG'
SitePrism.log_level = 0

To disable all logging (Done by default)

SitePrism.log_level = :UNKNOWN


66
67
68
# File 'lib/site_prism.rb', line 66

def log_level=(value)
  logger.level = value
end

.log_path=(logdev) ⇒ Object

Configure where you want the output of the site_prism logs to go (Default is $stdout)

To save all logs to a specific output file

SitePrism.log_path = 'site_prism.log'


54
55
56
# File 'lib/site_prism.rb', line 54

def log_path=(logdev)
  logger.reopen(logdev)
end

.loggerObject

The SitePrism logger object - This is called automatically in several locations and will log messages according to the normal Ruby protocol To alter (or check), the log level; call .log_level= or .log_level

This logger object can also be used to manually log messages

To Manually log a message

SitePrism.logger.info('Information')
SitePrism.logger.debug('Input debug message')

By default the logger will output all messages to $stdout, but can be altered to log to a file or another IO location by calling ‘.log_path=`



46
47
48
# File 'lib/site_prism.rb', line 46

def logger
  @logger ||= SitePrism::Logger.new.create
end