diff options
Diffstat (limited to 'actionpack/test/dispatch/system_testing')
4 files changed, 35 insertions, 28 deletions
| diff --git a/actionpack/test/dispatch/system_testing/browser_test.rb b/actionpack/test/dispatch/system_testing/browser_test.rb deleted file mode 100644 index b0ad309492..0000000000 --- a/actionpack/test/dispatch/system_testing/browser_test.rb +++ /dev/null @@ -1,10 +0,0 @@ -require "abstract_unit" -require "action_dispatch/system_testing/browser" - -class BrowserTest < ActiveSupport::TestCase -  test "initializing the browser" do -    browser = ActionDispatch::SystemTesting::Browser.new(:chrome, [ 1400, 1400 ]) -    assert_equal :chrome, browser.instance_variable_get(:@name) -    assert_equal [ 1400, 1400 ], browser.instance_variable_get(:@screen_size) -  end -end diff --git a/actionpack/test/dispatch/system_testing/driver_test.rb b/actionpack/test/dispatch/system_testing/driver_test.rb index f0ebdb38db..814e1d707b 100644 --- a/actionpack/test/dispatch/system_testing/driver_test.rb +++ b/actionpack/test/dispatch/system_testing/driver_test.rb @@ -6,4 +6,16 @@ class DriverTest < ActiveSupport::TestCase      driver = ActionDispatch::SystemTesting::Driver.new(:selenium)      assert_equal :selenium, driver.instance_variable_get(:@name)    end + +  test "initializing the driver with a browser" do +    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 +    assert_not ActionDispatch::SystemTesting::Driver.new(:poltergeist).send(:selenium?) +  end  end diff --git a/actionpack/test/dispatch/system_testing/screenshot_helper_test.rb b/actionpack/test/dispatch/system_testing/screenshot_helper_test.rb index 3b4ea96c4f..a83818fd80 100644 --- a/actionpack/test/dispatch/system_testing/screenshot_helper_test.rb +++ b/actionpack/test/dispatch/system_testing/screenshot_helper_test.rb @@ -1,15 +1,16 @@  require "abstract_unit"  require "action_dispatch/system_testing/test_helpers/screenshot_helper" +require "capybara/dsl"  class ScreenshotHelperTest < ActiveSupport::TestCase    test "image path is saved in tmp directory" do -    new_test = ActionDispatch::SystemTestCase.new("x") +    new_test = DrivenBySeleniumWithChrome.new("x")      assert_equal "tmp/screenshots/x.png", new_test.send(:image_path)    end    test "image path includes failures text if test did not pass" do -    new_test = ActionDispatch::SystemTestCase.new("x") +    new_test = DrivenBySeleniumWithChrome.new("x")      new_test.stub :passed?, false do        assert_equal "tmp/screenshots/failures_x.png", new_test.send(:image_path) @@ -17,7 +18,7 @@ class ScreenshotHelperTest < ActiveSupport::TestCase    end    test "image path does not include failures text if test skipped" do -    new_test = ActionDispatch::SystemTestCase.new("x") +    new_test = DrivenBySeleniumWithChrome.new("x")      new_test.stub :passed?, false do        new_test.stub :skipped?, true do @@ -26,3 +27,15 @@ class ScreenshotHelperTest < ActiveSupport::TestCase      end    end  end + +class RackTestScreenshotsTest < DrivenByRackTest +  test "rack_test driver does not support screenshot" do +    assert_not self.send(:supports_screenshot?) +  end +end + +class SeleniumScreenshotsTest < DrivenBySeleniumWithChrome +  test "selenium driver supports screenshot" do +    assert self.send(:supports_screenshot?) +  end +end diff --git a/actionpack/test/dispatch/system_testing/system_test_case_test.rb b/actionpack/test/dispatch/system_testing/system_test_case_test.rb index a384902a14..1a9421c098 100644 --- a/actionpack/test/dispatch/system_testing/system_test_case_test.rb +++ b/actionpack/test/dispatch/system_testing/system_test_case_test.rb @@ -1,21 +1,13 @@  require "abstract_unit" -class SystemTestCaseTest < ActiveSupport::TestCase -  test "driven_by sets Capybara's default driver to poltergeist" do -    ActionDispatch::SystemTestCase.driven_by :poltergeist - -    assert_equal :poltergeist, Capybara.default_driver -  end - -  test "driven_by sets Capybara's drivers respectively" do -    ActionDispatch::SystemTestCase.driven_by :selenium, using: :chrome - -    assert_includes Capybara.drivers, :selenium -    assert_includes Capybara.drivers, :chrome -    assert_equal :chrome, Capybara.default_driver +class SetDriverToRackTestTest < DrivenByRackTest +  test "uses rack_test" do +    assert_equal :rack_test, Capybara.current_driver    end +end -  test "selenium? returns false if driver is poltergeist" do -    assert_not ActionDispatch::SystemTestCase.selenium?(:poltergeist) +class SetDriverToSeleniumTest < DrivenBySeleniumWithChrome +  test "uses selenium" do +    assert_equal :selenium, Capybara.current_driver    end  end | 
