I've been trying to get capybara-screenshot integrated with rails projects 
using system specs and it has been really tricky. It worked fine with 
feature specs.

I've done quite a lot of reading and my understanding of the problem is 
that capybara screenshot is attaching information about the screenshot in 
an after lifecycle hook and then trying to format that in a custom notifier 
(after_failure) . 

But the system specs are causing the Capybara.reset_sessions! to occur in 
between these, because the after_teardown (minitest/rails) hook is being 
called during the after lifecycle hook.

However in other (non-system) specs the after_teardown hook occurs after 
all the arounds (and the after_failure notifications I believe) as part of 
an around hook.

There was no other way to do this with Rails 5.2 and below because the 
after_teardown was where the (rails) take_screenshot happened. As of Rails 
6.0 this occurs in before_teardown, and we could thus fix this and make the 
rails-initiated Capybara.reset_sessions! happen later in the lifecycle.

What do you think? 

References: 

I've made an issue and an first attempt at a PR:

https://github.com/rspec/rspec-rails/issues/2595
https://github.com/rspec/rspec-rails/pull/2596

see related discussion:

https://github.com/mattheworiordan/capybara-screenshot/issues/225


-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/3eb7145b-8725-40cd-bb26-234975242dacn%40googlegroups.com.

Reply via email to