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 |