Reputation: 479
Using the following gems:
gem 'rails', '~> 5.1', '>= 5.1.4'
gem 'capybara', '~> 2.17'
gem 'rspec', '~> 3.7'
gem 'rspec-rails', '~> 3.7'
gem 'guard-rspec', '~> 4.7', '>= 4.7.3'
gem 'selenium-webdriver', '~> 3.8'
When I run a rails system spec and it fails, the screenshot is helpfully saved to my tmp folder. However it is also outputs the entire text contents of the screenshot to the console which clogs up my terminal and slows down debugging. It looks like this:
I'd love to keep the screenshot but not have this printed to the console. Any help would be greatly appreciated!
Cheers :)
Upvotes: 0
Views: 389
Reputation: 49900
This is part of the Rails system test, which is attempting to display the image in your terminal, however it appears your terminal doesn't support that. From the code that does this - https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb#L59 - you can see it can be controlled through a couple of environment variables. You probably want to set
RAILS_SYSTEM_TESTING_SCREENSHOT=simple
when running your tests.
Upvotes: 2