Reputation: 16383
I am following this tutorial to test system specs with rails 5.1. If I deliberately fail a test, I get the following output in the terminal
WARN: Screenshot could not be saved. `page.current_path` is empty.
F
Failures:
1) Homepage shows greeting
Failure/Error: expect(page).to have_content 'Hello Worlds'
expected to find text "Hello Worlds" in "Hello World"
[Screenshot]: tmp/screenshots/failures_r_spec_example_groups_homepage_shows_greeting_506.png
# ./spec/spec/system/home_spec.rb:10:in `block (2 levels) in <top (required)>'
The file specified for the screenshot exists, but the screen shot is not shown in the terminal. I can open the screen shot manually, so it is being generated correctly.
If I type chromedriver --version
I get
ChromeDriver 2.35.528157 (4429ca2590d6988c0745c24c8858745aaaec01ef)
and I am using version 63.0.3239.132 of Chrome.
How do I get the screenshots to open in terminal on Mac OSX?
Upvotes: 4
Views: 1456
Reputation: 1254
Screenshot display depends on what kind of terminal you use and RAILS_SYSTEM_TESTING_SCREENSHOT
environment variable.
For build-in terminal:
ENV['RAILS_SYSTEM_TESTING_SCREENSHOT'] = 'artifact'
For iTerm2:
ENV['RAILS_SYSTEM_TESTING_SCREENSHOT'] = 'inline'
Upvotes: 4