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?
I've made an issue and an first attempt at a PR:
see related discussion: