2017-07-24 16:20:53 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-02-19 11:50:42 -05:00
|
|
|
require "abstract_unit"
|
|
|
|
require "action_dispatch/system_testing/driver"
|
2017-01-22 14:05:51 -05:00
|
|
|
|
|
|
|
class DriverTest < ActiveSupport::TestCase
|
|
|
|
test "initializing the driver" do
|
2017-02-19 11:50:42 -05:00
|
|
|
driver = ActionDispatch::SystemTesting::Driver.new(:selenium)
|
2017-01-22 14:05:51 -05:00
|
|
|
assert_equal :selenium, driver.instance_variable_get(:@name)
|
|
|
|
end
|
2017-03-05 09:38:27 -05:00
|
|
|
|
|
|
|
test "initializing the driver with a browser" do
|
2017-03-08 07:17:44 -05:00
|
|
|
driver = ActionDispatch::SystemTesting::Driver.new(:selenium, using: :chrome, screen_size: [1400, 1400], options: { url: "http://example.com/wd/hub" })
|
2017-03-05 09:38:27 -05:00
|
|
|
assert_equal :selenium, driver.instance_variable_get(:@name)
|
2017-03-06 12:33:34 -05:00
|
|
|
assert_equal :chrome, driver.instance_variable_get(:@browser)
|
|
|
|
assert_equal [1400, 1400], driver.instance_variable_get(:@screen_size)
|
2017-03-08 07:17:44 -05:00
|
|
|
assert_equal ({ url: "http://example.com/wd/hub" }), driver.instance_variable_get(:@options)
|
2017-03-05 09:38:27 -05:00
|
|
|
end
|
|
|
|
|
2017-06-01 15:58:42 -04:00
|
|
|
test "initializing the driver with a poltergeist" do
|
|
|
|
driver = ActionDispatch::SystemTesting::Driver.new(:poltergeist, screen_size: [1400, 1400], options: { js_errors: false })
|
|
|
|
assert_equal :poltergeist, driver.instance_variable_get(:@name)
|
|
|
|
assert_equal [1400, 1400], driver.instance_variable_get(:@screen_size)
|
|
|
|
assert_equal ({ js_errors: false }), driver.instance_variable_get(:@options)
|
|
|
|
end
|
|
|
|
|
|
|
|
test "initializing the driver with a webkit" do
|
|
|
|
driver = ActionDispatch::SystemTesting::Driver.new(:webkit, screen_size: [1400, 1400], options: { skip_image_loading: true })
|
|
|
|
assert_equal :webkit, driver.instance_variable_get(:@name)
|
|
|
|
assert_equal [1400, 1400], driver.instance_variable_get(:@screen_size)
|
|
|
|
assert_equal ({ skip_image_loading: true }), driver.instance_variable_get(:@options)
|
|
|
|
end
|
|
|
|
|
2017-07-08 11:08:03 -04:00
|
|
|
test "registerable? returns false if driver is rack_test" do
|
|
|
|
assert_not ActionDispatch::SystemTesting::Driver.new(:rack_test).send(:registerable?)
|
2017-03-05 09:38:27 -05:00
|
|
|
end
|
2017-01-22 14:05:51 -05:00
|
|
|
end
|