lib/snapshot/runner.rb in snapshot-0.1.0 vs lib/snapshot/runner.rb in snapshot-0.2.1.beta1
- old
+ new
@@ -11,25 +11,27 @@
def work
SnapshotConfig.shared_instance.js_file # to verify the file can be found
Builder.new.build_app
+ counter = 0
SnapshotConfig.shared_instance.devices.each do |device|
SnapshotConfig.shared_instance.languages.each do |language|
begin
run_tests(device, language)
- copy_screenshots(language)
+ counter += copy_screenshots(language)
rescue Exception => ex
Helper.log.error(ex)
end
end
end
- Helper.log.info "Successfully finished generating screenshots.".green
+ Helper.log.info "Successfully finished generating #{counter} screenshots.".green
Helper.log.info "Check it out here: #{SnapshotConfig.shared_instance.screenshots_path}".green
+ ReportsGenerator.new.generate
end
def clean_old_traces
FileUtils.rm_rf(TRACE_DIR)
FileUtils.mkdir_p(TRACE_DIR)
@@ -83,16 +85,16 @@
end
end
def copy_screenshots(language)
resulting_path = [SnapshotConfig.shared_instance.screenshots_path, language].join('/')
- resulting_path.gsub!("~", ENV['HOME']) # some strange bug requires this
FileUtils.mkdir_p resulting_path
Dir.glob("#{TRACE_DIR}/**/*.png") do |file|
FileUtils.cp_r(file, resulting_path + '/')
end
+ return Dir.glob("#{TRACE_DIR}/**/*.png").count
end
def generate_test_command(device, language, app_path)
script_path = SnapshotConfig.shared_instance.js_file
\ No newline at end of file