lib/nakal/dsl.rb in nakal-0.0.4 vs lib/nakal/dsl.rb in nakal-0.0.5

- old
+ new

@@ -1,13 +1,23 @@ require_relative '../nakal' +require 'timeout' module Nakal module DSL def current_screen_vs_base_image image_file_name orignal_screen = Nakal.current_platform::Screen.new(image_file_name, :load) current_screen = Nakal.current_platform::Screen.new("#{image_file_name}_current", :capture) diff_screen, diff_metric = orignal_screen.compare(current_screen) + + Timeout::timeout(Nakal.timeout) { + until diff_metric < 0.05 do + sleep 1 + current_screen = Nakal.current_platform::Screen.new("#{image_file_name}_current", :capture) + diff_screen, diff_metric = orignal_screen.compare(current_screen) + end + } rescue nil + if diff_metric==0 current_screen.delete! else diff_screen.save Nakal.diff_screens << image_file_name \ No newline at end of file