diff options
author | eileencodes <eileencodes@gmail.com> | 2016-10-01 11:17:43 -0400 |
---|---|---|
committer | eileencodes <eileencodes@gmail.com> | 2017-02-20 15:07:33 -0500 |
commit | f482eddbeff9fe3d0dc6cdaa9a4b53df839f667c (patch) | |
tree | d9b70ef78d4e1ee3e67430dd6e7cfc8e5a2bec4d /actionpack/test/system_testing/rails_selenium_driver_test.rb | |
parent | b44320254167152383b1fa8792cb17847a51fb49 (diff) | |
download | rails-f482eddbeff9fe3d0dc6cdaa9a4b53df839f667c.tar.gz rails-f482eddbeff9fe3d0dc6cdaa9a4b53df839f667c.tar.bz2 rails-f482eddbeff9fe3d0dc6cdaa9a4b53df839f667c.zip |
Reconfigure how the drivers work
This removes the useless Rack Test Driver that Rails was providing and
moves to a shim like approach for default adapters.
If someone wants to use one of the default Capybara Drivers then we will
initialize a new `CapybaraDriver` that simply sets the default driver.
Rails though is much more opinionated than Capybara and to make system
testing a "works out of the box" framework in Rails we have the
`RailsSeleniumDriver`. This driver sets defaults that Rails deems
important for selenium testing. The purpose of this is to simply add a
test and it just works.
Diffstat (limited to 'actionpack/test/system_testing/rails_selenium_driver_test.rb')
-rw-r--r-- | actionpack/test/system_testing/rails_selenium_driver_test.rb | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/actionpack/test/system_testing/rails_selenium_driver_test.rb b/actionpack/test/system_testing/rails_selenium_driver_test.rb new file mode 100644 index 0000000000..c239444838 --- /dev/null +++ b/actionpack/test/system_testing/rails_selenium_driver_test.rb @@ -0,0 +1,58 @@ +require 'abstract_unit' + +class RailsSeleniumDriverTest < ActiveSupport::TestCase + def setup + Rails::SystemTestCase.driver = :rails_selenium_driver + end + + def test_default_driver_adapter + assert_kind_of SystemTesting::DriverAdapters::RailsSeleniumDriver, Rails::SystemTestCase.driver + end + + def test_default_settings + assert_equal :chrome, Rails::SystemTestCase.driver.browser + assert_equal :puma, Rails::SystemTestCase.driver.server + assert_equal 28100, Rails::SystemTestCase.driver.port + assert_equal [1400,1400], Rails::SystemTestCase.driver.screen_size + end + + def test_setting_browser + Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::RailsSeleniumDriver.new( + browser: :firefox + ) + + assert_equal :firefox, Rails::SystemTestCase.driver.browser + end + + def test_setting_server + Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::RailsSeleniumDriver.new( + server: :webrick + ) + + assert_equal :webrick, Rails::SystemTestCase.driver.server + end + + def test_setting_port + Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::RailsSeleniumDriver.new( + port: 3000 + ) + + assert_equal 3000, Rails::SystemTestCase.driver.port + end + + def test_setting_screen_size + Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::RailsSeleniumDriver.new( + screen_size: [ 800, 800 ] + ) + + assert_equal [ 800, 800 ], Rails::SystemTestCase.driver.screen_size + end + + def test_does_not_accept_nonsense_kwargs + assert_raises ArgumentError do + Rails::SystemTestCase.driver = SystemTesting::DriverAdapters::RailsSeleniumDriver.new( + made_up_arg: 'x' + ) + end + end +end |