lib/calabash-android/operations.rb in calabash-android-0.0.14 vs lib/calabash-android/operations.rb in calabash-android-0.0.15

- old
+ new

@@ -13,15 +13,18 @@ def log(message) $stdout.puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S")} - #{message}" if (ARGV.include? "-v" or ARGV.include? "--verbose") end def take_screenshot + path = ENV["SCREENSHOT_PATH_PREFIX"] || "results" + FileUtils.mkdir_p path unless Dir.exists? path + filename_prefix = FeatureNameMemory.feature_name.gsub(/\s+/, '_').downcase begin Timeout.timeout(30) do - file_name = "#{ENV['SCREENSHOT_PATH_PREFIX']}screenshot_#{StepCounter.step_line}.png" + file_name = "#{path}/#{filename_prefix}_#{StepCounter.step_line}.png" log "Taking screenshoot to #{file_name} from device: #{ENV['ADB_DEVICE_ARG']}" system("java -jar #{File.dirname(__FILE__)}/lib/screenShotTaker.jar #{file_name} #{ENV['ADB_DEVICE_ARG']}") - log "Screenshot taken" + log "Screenshot stored in: #{file_name}" end rescue Timeout::Error raise Exception, "take_screenshot timed out" end end