Add rack_test driver to System Tests

This commit is contained in:
Frédéric Planté 2021-02-17 00:50:28 +01:00
parent fe912cb1a7
commit adab999e09
2 changed files with 6 additions and 5 deletions

View File

@ -24,7 +24,7 @@ module ActionDispatch
private
def registerable?
[:selenium, :poltergeist, :webkit].include?(@name)
[:selenium, :poltergeist, :webkit, :rack_test].include?(@name)
end
def register
@ -35,6 +35,7 @@ module ActionDispatch
when :selenium then register_selenium(app)
when :poltergeist then register_poltergeist(app)
when :webkit then register_webkit(app)
when :rack_test then register_rack_test(app)
end
end
end
@ -59,6 +60,10 @@ module ActionDispatch
end
end
def register_rack_test(app)
Capybara::RackTest::Driver.new(app, { respect_data_method: true }.merge(@options))
end
def setup
Capybara.current_driver = @name
end

View File

@ -51,10 +51,6 @@ class DriverTest < ActiveSupport::TestCase
assert_equal ({ skip_image_loading: true }), driver.instance_variable_get(:@options)
end
test "registerable? returns false if driver is rack_test" do
assert_not ActionDispatch::SystemTesting::Driver.new(:rack_test).send(:registerable?)
end
test "define extra capabilities using chrome" do
driver = ActionDispatch::SystemTesting::Driver.new(:selenium, screen_size: [1400, 1400], using: :chrome) do |option|
option.add_argument("start-maximized")