From ec99107a2982236c726699cbbefc8839de278b93 Mon Sep 17 00:00:00 2001 From: Fumiaki MATSUSHIMA Date: Wed, 8 Mar 2017 21:17:44 +0900 Subject: Pass options to `driven_by` Capybara drivers can handle some options such like `url`. ### before ``` # test/test_helper.rb Capybara.register_driver :remote_chrome do |app| Capybara::Selenium::Driver.new(app, browser: :chrome, url: "http://example.com/wd/hub") end # test/application_system_test_case.rb class ApplicationSystemTestCase < ActionDispatch::SystemTestCase driven_by :remote_chrome end ``` ### after ``` # test/application_system_test_case.rb class ApplicationSystemTestCase < ActionDispatch::SystemTestCase driven_by :selenium, using: :chrome, screen_size: [1400, 1400], options: {url: "http://chrome:4444/wd/hub"} end ``` --- actionpack/test/dispatch/system_testing/driver_test.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'actionpack/test/dispatch/system_testing/driver_test.rb') diff --git a/actionpack/test/dispatch/system_testing/driver_test.rb b/actionpack/test/dispatch/system_testing/driver_test.rb index 8f8777b19f..814e1d707b 100644 --- a/actionpack/test/dispatch/system_testing/driver_test.rb +++ b/actionpack/test/dispatch/system_testing/driver_test.rb @@ -8,10 +8,11 @@ class DriverTest < ActiveSupport::TestCase end test "initializing the driver with a browser" do - driver = ActionDispatch::SystemTesting::Driver.new(:selenium, using: :chrome, screen_size: [1400, 1400]) + driver = ActionDispatch::SystemTesting::Driver.new(:selenium, using: :chrome, screen_size: [1400, 1400], options: { url: "http://example.com/wd/hub" }) assert_equal :selenium, driver.instance_variable_get(:@name) assert_equal :chrome, driver.instance_variable_get(:@browser) assert_equal [1400, 1400], driver.instance_variable_get(:@screen_size) + assert_equal ({ url: "http://example.com/wd/hub" }), driver.instance_variable_get(:@options) end test "selenium? returns false if driver is poltergeist" do -- cgit v1.2.3