blob: d246106717e095d8aa734a87f43828e32dc8b5fa (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
module SystemTesting
# == System Testing Driver Adapters
#
# By default Rails supports Capybara with the Selenium Driver. Rails provides
# configuration setup for using the selenium driver with Capybara.
# Additionally Rails can be used as a layer between Capybara and its other
# supported drivers: +:rack_test+, +:selenium+, +:webkit+, or +:poltergeist+.
#
# *{RackTest}[https://github.com/jnicklas/capybara#racktest]
# *{Selenium}[http://seleniumhq.org/docs/01_introducing_selenium.html#selenium-2-aka-selenium-webdriver]
# *{Webkit}[https://github.com/thoughtbot/capybara-webkit]
# *{Poltergeist}[https://github.com/teampoltergeist/poltergeist]
#
# === Driver Features
#
# | | Default Browser | Supports Screenshots? |
# |-----------------|-----------------------|-----------------------|
# | Rails' Selenium | Chrome | Yes |
# | Rack Test | No JS Support | No |
# | Selenium | Firefox | Yes |
# | WebKit | Headless w/ Qt | Yes |
# | Poltergeist | Headless w/ PhantomJS | Yes |
module DriverAdapters
extend ActiveSupport::Autoload
autoload :CapybaraDriver
autoload :RailsSeleniumDriver
class << self
# Returns driver for specified name.
#
# SystemTesting::DriverAdapters.lookup(:rails_selenium_driver)
# # => SystemTesting::DriverAdapters::RailsSeleniumDriver
def lookup(driver)
if CapybaraDriver::CAPYBARA_DEFAULTS.include?(driver)
CapybaraDriver.new(name: driver)
elsif driver.is_a?(Symbol)
klass = const_get(driver.to_s.camelize)
klass.new
else
driver
end
end
end
end
end
|