module SpecTest
Constants
- VERSION
Attributes
@return [TerminusSpec::Platforms::WatirWebDriver::PlatformObject] the platform object @return [TerminusSpec::Platforms::SeleniumWebDriver::PlatformObject] the platform object
Public Class Methods
This makes sure that any page classes that include SpecTest
will be given access to the generator and encloser methods based on web objects that are declared in the page class.
# File lib/spectest.rb, line 23 def self.included(caller) caller.extend SpecTest::Generators caller.extend SpecTest::Enclosers end
# File lib/spectest.rb, line 28 def initialize(browser, visit=nil) @browser = browser establish_platform_driver_for browser goto if visit && respond_to?(:goto) end
# File lib/spectest/logger.rb, line 2 def self.trace(message, level=1) puts("*" * level + " #{message}") if ENV['TRACE'] == 'on' end
# File lib/spectest.rb, line 16 def self.version_info "SpecTest version #{SpecTest::VERSION}" end
Public Instance Methods
Used to identify a web object as existing within an enclosing object like a frame or an iframe. There is a duplicate method in enclosers.rb. This method needs to be here so that test steps can be placed in an enclosed context.
@param [String] identifier how an encloser will be referred to @param encloser a parent encloser that is passed from a previous call @param [optional] block that contains calls to web objects within the encloser
# File lib/spectest.rb, line 64 def is_enclosed_by(identifier, encloser=nil, &block) encloser = [] if encloser.nil? encloser << identifier block.call(encloser) end
Returns the text of the current page.
# File lib/spectest.rb, line 52 def text @platform.text end
Returns the title of the current page as displayed in the browser.
# File lib/spectest.rb, line 47 def title @platform.title end
Private Instance Methods
# File lib/spectest.rb, line 72 def establish_platform_driver_for(browser) @platform = platform_for browser, SpecTest::Platforms.list end
# File lib/spectest.rb, line 76 def process_block(&block) block.arity == 1 ? block.call(self) : self.instance_eval(&block) end