module Symbiont

Constants

VERSION

Attributes

selectable[RW]
settable[RW]
use_implicit_waits[RW]
browser[R]

@return [Object] browser driver reference

Public Class Methods

browser() click to toggle source
# File lib/symbiont.rb, line 52
def self.browser
  @browser
end
browser=(browser) click to toggle source
# File lib/symbiont.rb, line 48
def self.browser=(browser)
  @browser = browser
end
configure() { |self| ... } click to toggle source
# File lib/symbiont.rb, line 90
def configure
  yield self
end
elements() click to toggle source
# File lib/symbiont/elements.rb, line 9
def elements
  unless @elements
    @elements = Watir::Container.instance_methods
    @elements.delete(:extract_selector)
  end
  @elements
end
included(caller) click to toggle source

@param caller [Class] the class including the framework

# File lib/symbiont.rb, line 28
def self.included(caller)
  caller.extend Symbiont::Assertion
  caller.extend Symbiont::Elements
  caller.send :include, Symbiont::Pages
  caller.send :include, Symbiont::Ready
  caller.send :include, Symbiont::Accessor
  caller.send :include, Symbiont::DataSetter
  caller.send :include, Symbiont::DataBuilder

  caller.page_ready do
    [displayed?, "Expected #{current_url} to match #{url_match} but it did not."]
  end

  Symbiont.trace("#{caller.class} #{caller} has attached the Symbiont.")
end
new(browser = nil, &block) click to toggle source

@param browser [Object] a tool driver instance

# File lib/symbiont.rb, line 69
def initialize(browser = nil, &block)
  Symbiont.trace("Symbiont attached to browser:\n\t#{browser.inspect}")

  @browser = Symbiont.browser unless Symbiont.browser.nil?
  @browser = browser if Symbiont.browser.nil?

  initialize_page if respond_to?(:initialize_page)
  initialize_activity if respond_to?(:initialize_activity)

  instance_eval(&block) if block
end
selectable?(element) click to toggle source
# File lib/symbiont/elements.rb, line 29
def selectable?(element)
  selectable.include? element.to_sym
end
set_browser(app = :firefox, *args) click to toggle source
# File lib/symbiont.rb, line 81
def self.set_browser(app = :firefox, *args)
  @browser = Watir::Browser.new(app, *args)
  Symbiont.browser = @browser
end
settable?(element) click to toggle source
# File lib/symbiont/elements.rb, line 25
def settable?(element)
  settable.include? element.to_sym
end
trace(message, level = 1) click to toggle source
# File lib/symbiont.rb, line 44
def self.trace(message, level = 1)
  puts '*' * level + " #{message}" if ENV['SYMBIONT_TRACE'] == 'on'
end
version() click to toggle source
# File lib/symbiont.rb, line 56
  def self.version
    """
Symbiont v#{Symbiont::VERSION}
Watir-WebDriver: #{Gem.loaded_specs['watir-webdriver'].version}
Selenium-WebDriver: #{Gem.loaded_specs['selenium-webdriver'].version}
Capybara: #{Gem.loaded_specs['capybara'].version}
    """
  end