diff options
Diffstat (limited to 'actionpack/lib/system_testing/driver_adapters')
-rw-r--r-- | actionpack/lib/system_testing/driver_adapters/capybara_rack_test_driver.rb | 23 | ||||
-rw-r--r-- | actionpack/lib/system_testing/driver_adapters/capybara_selenium_driver.rb | 50 |
2 files changed, 69 insertions, 4 deletions
diff --git a/actionpack/lib/system_testing/driver_adapters/capybara_rack_test_driver.rb b/actionpack/lib/system_testing/driver_adapters/capybara_rack_test_driver.rb index 2890686e29..78abfa05ee 100644 --- a/actionpack/lib/system_testing/driver_adapters/capybara_rack_test_driver.rb +++ b/actionpack/lib/system_testing/driver_adapters/capybara_rack_test_driver.rb @@ -1,13 +1,32 @@ module SystemTesting module DriverAdapters + # == CapybaraRackTestDriver for System Testing + # + # This is the default driver for Capybara. This driver does not support + # JavaScript because it doesn't open a browser when running the test suite. + # + # Although it does not support JavaScript testing the + # <tt>CapybaraRackTestDriver</tt> is fast and efficient. This driver requires + # no setup and becasue it does not need a webserver, additional configuration + # is not required. + # + # The <tt>CapybaraRackTestDriver</tt> only takes one argument for initialization + # which is +:useragent+. + # + # To set the useragent add the following to your + # Rails' configuration file: + # + # config.system_testing.driver = SystemTesting::DriverAdapters::CapybaraRackTestDriver.new( + # useragent: 'My UserAgent' + # ) class CapybaraRackTestDriver attr_reader :useragent - def initialize(useragent: 'Capybara') + def initialize(useragent: 'Capybara') # :nodoc: @useragent = useragent end - def call + def call # :nodoc: registration end diff --git a/actionpack/lib/system_testing/driver_adapters/capybara_selenium_driver.rb b/actionpack/lib/system_testing/driver_adapters/capybara_selenium_driver.rb index b4cb10da4f..5585b3e9f1 100644 --- a/actionpack/lib/system_testing/driver_adapters/capybara_selenium_driver.rb +++ b/actionpack/lib/system_testing/driver_adapters/capybara_selenium_driver.rb @@ -3,17 +3,63 @@ require 'selenium-webdriver' module SystemTesting module DriverAdapters + # == CapybaraSeleniumDriver for System Testing + # + # The <tt>CapybaraSeleniumDriver</t> uses the Selenium 2.0 webdriver. The + # selenium-webdriver gem is required by this driver. + # + # The CapybaraSeleniumDriver is useful for real browser testing and + # support Chrome and Firefox. + # + # To set your system testing to use the Selenium web driver add the + # following to your Rails' configuration test environment: + # + # config.system_testing.driver = :capybara_selenium_driver + # + # Because this driver supports real browser testing it is required that a + # server is configured. + # + # If no server is specified when the driver is initialized, Puma will be used + # by default. The default settings for the <tt>CapybaraSeleniumDriver</tt> + # are: + # + # #<SystemTesting::DriverAdapters::CapybaraSeleniumDriver:0x007ff0e992c1d8 + # @browser=:chrome, + # @server=:puma, + # @port=28100, + # @screen_size=[ 1400, 1400 ] + # > + # + # The settings for the <tt>CapybaraSeleniumDriver</tt> can be changed from + # Rails' configuration file. + # + # config.system_testing.driver = SystemTesting::DriverAdapters::CapybaraSeleniumDriver.new( + # server: :webkit, + # port: 28100, + # screen_size: [ 800, 800 ] + # ) + # + # The default browser is set to chrome because the current version of + # Firefox does not work with selenium-webdriver. If you want to use Firefox, + # you will need to use Firefox 45.0esr or 47.0 and ensure + # that selenium-webdriver is version 2.53.4. To change the browser from + # +:chrome+ to +:firefox+, initialize the selenium driver in your Rails' + # test environment: + # + # config.system_testing.driver = SystemTesting::DriverAdapters::CapybaraSeleniumDriver.new( + # browser: :firefox + # ) class CapybaraSeleniumDriver attr_reader :browser, :server, :port, :screen_size - def initialize(browser: :chrome, server: :puma, port: 28100, screen_size: [1400,1400]) + def initialize(browser: :chrome, server: :puma, port: 28100, screen_size: [1400,1400]) # :nodoc: @browser = browser @server = server @port = port @screen_size = screen_size end - def call + def call # :nodoc: registration setup end |