Skip to content

Instantly share code, notes, and snippets.

@eric-hemasystems
Created October 5, 2018 14:31
Show Gist options
  • Save eric-hemasystems/3f5148a7c3af614577a8f0efce4fcbdd to your computer and use it in GitHub Desktop.
Save eric-hemasystems/3f5148a7c3af614577a8f0efce4fcbdd to your computer and use it in GitHub Desktop.
Screenshot Support in Solano for Rails 5.1+

Hook into RSpec via:

config.include SolanoHelpers, type: :system
concern :SolanoHelpers do
included do
after do
# Are we running under Solano?
next if %w[SESSION_ID TEST_EXEC_ID].any? { |env| ENV["TDDIUM_#{env}"].blank? }
# Do we have screenshots to move?
screenshots = Dir["#{Rails.root}/tmp/screenshots/*.png"]
next if screenshots.empty?
# Ensure test-specific artifact directory exists
artifact_dir = "#{ENV['HOME']}/results/#{ENV['TDDIUM_SESSION_ID']}/#{ENV['TDDIUM_TEST_EXEC_ID']}"
FileUtils.mkdir_p artifact_dir
# Move the screenshots
FileUtils.move screenshots, artifact_dir
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment