2009-12-20 10:22:47 -05:00
|
|
|
require 'timeout'
|
2009-11-16 16:02:16 -05:00
|
|
|
require 'nokogiri'
|
|
|
|
|
|
|
|
module Capybara
|
2009-12-13 09:08:12 -05:00
|
|
|
VERSION = '0.2.0'
|
2009-11-16 16:02:16 -05:00
|
|
|
|
|
|
|
class CapybaraError < StandardError; end
|
|
|
|
class DriverNotFoundError < CapybaraError; end
|
|
|
|
class ElementNotFound < CapybaraError; end
|
2009-12-12 07:33:00 -05:00
|
|
|
class NotSupportedByDriverError < CapybaraError; end
|
2009-11-16 16:02:16 -05:00
|
|
|
|
|
|
|
class << self
|
2009-12-18 11:40:51 -05:00
|
|
|
attr_accessor :debug, :asset_root, :app_host
|
2009-12-20 10:22:47 -05:00
|
|
|
attr_writer :default_selector, :default_condition_timeout
|
2009-12-03 12:50:03 -05:00
|
|
|
|
|
|
|
def default_selector
|
|
|
|
@default_selector ||= :xpath
|
|
|
|
end
|
2009-12-20 10:22:47 -05:00
|
|
|
|
|
|
|
def default_condition_timeout
|
|
|
|
@default_condition_timeout ||= 10
|
|
|
|
end
|
2009-12-12 07:33:00 -05:00
|
|
|
|
2009-11-16 16:02:16 -05:00
|
|
|
def log(message)
|
|
|
|
puts "[capybara] #{message}" if debug
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-12-09 15:43:40 -05:00
|
|
|
autoload :Server, 'capybara/server'
|
2009-11-16 16:02:16 -05:00
|
|
|
autoload :Session, 'capybara/session'
|
2009-12-09 15:43:40 -05:00
|
|
|
autoload :Node, 'capybara/node'
|
|
|
|
autoload :XPath, 'capybara/xpath'
|
2009-11-16 16:02:16 -05:00
|
|
|
|
|
|
|
module Driver
|
2009-12-09 15:43:40 -05:00
|
|
|
autoload :Base, 'capybara/driver/base'
|
2009-11-16 16:02:16 -05:00
|
|
|
autoload :RackTest, 'capybara/driver/rack_test_driver'
|
2009-12-16 15:42:37 -05:00
|
|
|
autoload :Celerity, 'capybara/driver/celerity_driver'
|
2009-12-18 11:40:51 -05:00
|
|
|
autoload :Culerity, 'capybara/driver/culerity_driver'
|
2009-11-16 16:02:16 -05:00
|
|
|
autoload :Selenium, 'capybara/driver/selenium_driver'
|
|
|
|
end
|
|
|
|
end
|