lib/capybara/screenshot/diff/test_methods.rb in capybara-screenshot-diff-0.12.0 vs lib/capybara/screenshot/diff/test_methods.rb in capybara-screenshot-diff-0.12.1

- old
+ new

@@ -47,10 +47,11 @@ current_capybara_driver_class <= Capybara::Selenium::Driver end def poltergeist? return false unless defined?(Capybara::Poltergeist::Driver) + current_capybara_driver_class <= Capybara::Poltergeist::Driver end def screenshot_section(name) @screenshot_section = name.to_s @@ -58,17 +59,19 @@ def screenshot_group(name) @screenshot_group = name.to_s @screenshot_counter = 0 return unless Screenshot.active? && name.present? + FileUtils.rm_rf screenshot_dir end def screenshot(name, color_distance_limit: Diff.color_distance_limit, shift_distance_limit: Diff.shift_distance_limit, area_size_limit: Diff.area_size_limit) return unless Screenshot.active? return if window_size_is_wrong? + if @screenshot_counter name = "#{format('%02i', @screenshot_counter)}_#{name}" @screenshot_counter += 1 end name = full_name(name) @@ -81,9 +84,10 @@ checkout_vcs(name, comparison) take_stable_screenshot(comparison, color_distance_limit: color_distance_limit, shift_distance_limit: shift_distance_limit, area_size_limit: area_size_limit) return unless comparison.old_file_exists? + (@test_screenshots ||= []) << [caller(1..1).first, name, comparison] end def window_size_is_wrong? selenium? && Screenshot.window_size &&