-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Teardown hooks are called in the wrong order, resulting in a blank screenshot in Rails 6. #2153
Comments
Have you tried this on the |
I've updated to |
Thanks for the detailed report @alexsanderson. Do you think you can provide a fresh repo with a rails app with a reproduction case? Cheers |
Sure thing, here we are @benoittgt -> https://github.com/alexsanderson/rspec-teardown I've added how to reproduce in the README, but it's essentially: clone, bundle and run rspec. |
@alexsanderson can you see if #2164 fixes your issue? |
Yes, it works now @JonRowe. Perfect! |
Closed in |
Thank you! @JonRowe |
What Ruby, Rails and RSpec versions are you using?
Ruby version: ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
Rails version: 6.0.0.rc1
RSpec version: 3.8
Observed behaviour
after_teardown
is run beforebefore_teardown
Which results in
Capybara.reset_sessions!
being called beforetake_failed_screenshot
and that results in a blank screenshot due toCapybara.reset_sessions!
navigating toabout:blank
.Expected behaviour
before_teardown
is run beforeafter_teardown
Can you provide an example app?
spec/system/teardown.rb
rails_helper.rb
That spec will fail (correctly) and produce a screenshot, which is blank.
Here's
byebug
(positioned before the expect):Investigation
Looking at Rails 5.2 https://github.com/rails/rails/blob/f64de36c29b4dee412dd7fa8359849dabdcc54b9/actionpack/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb#L19-L27 there is no
before_teardown
. Bothtake_failed_screenshot
andCapybara.reset_sessions!
are called in the same method in the right order.This bug appears to have been introduced with a change in Rails 6.0 where that single method is split up into two: https://github.com/rails/rails/blob/23cdeceef6373614e1a1c6fa0c5d687d04bfab92/actionpack/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb#L19-L29
The text was updated successfully, but these errors were encountered: