aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2018-11-13 17:21:04 -0500
committerGitHub <noreply@github.com>2018-11-13 17:21:04 -0500
commit6741e70518b55c4bbd7a53346b5937319a31a15f (patch)
tree79904838dbcaaced3a5567ff80d5ac872acf442e /railties
parent5e9a3e7763673c0e5f58bdfbe2263d135198e9d7 (diff)
parent59895db44b73b9a333387eee2078fda8feec9ce5 (diff)
downloadrails-6741e70518b55c4bbd7a53346b5937319a31a15f.tar.gz
rails-6741e70518b55c4bbd7a53346b5937319a31a15f.tar.bz2
rails-6741e70518b55c4bbd7a53346b5937319a31a15f.zip
Merge pull request #34411 from N0xFF/master
Reset Capybara sessions if failed system test screenshot raising an exception
Diffstat (limited to 'railties')
-rw-r--r--railties/test/application/test_runner_test.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/railties/test/application/test_runner_test.rb b/railties/test/application/test_runner_test.rb
index 0046fec062..0d7645e794 100644
--- a/railties/test/application/test_runner_test.rb
+++ b/railties/test/application/test_runner_test.rb
@@ -727,6 +727,31 @@ module ApplicationTests
end
end
+ def test_reset_sessions_on_failed_system_test_screenshot
+ app_file "test/system/reset_sessions_on_failed_system_test_screenshot_test.rb", <<~RUBY
+ require "application_system_test_case"
+
+ class ResetSessionsOnFailedSystemTestScreenshotTest < ApplicationSystemTestCase
+ ActionDispatch::SystemTestCase.class_eval do
+ def take_failed_screenshot
+ raise Capybara::CapybaraError
+ end
+ end
+
+ Capybara.instance_eval do
+ def reset_sessions!
+ puts "Capybara.reset_sessions! called"
+ end
+ end
+
+ test "dummy" do
+ end
+ end
+ RUBY
+ output = run_test_command("test/system/reset_sessions_on_failed_system_test_screenshot_test.rb")
+ assert_match "Capybara.reset_sessions! called", output
+ end
+
def test_system_tests_are_not_run_with_the_default_test_command
app_file "test/system/dummy_test.rb", <<-RUBY
require "application_system_test_case"