lib/capybara/screenshot/diff/test_methods.rb in capybara-screenshot-diff-0.10.2 vs lib/capybara/screenshot/diff/test_methods.rb in capybara-screenshot-diff-0.11.0
- old
+ new
@@ -62,11 +62,11 @@
return unless Screenshot.active? && name.present?
FileUtils.rm_rf screenshot_dir
end
def screenshot(name, color_distance_limit: Diff.color_distance_limit,
- area_size_limit: Diff.area_size_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
@@ -78,10 +78,11 @@
comparison = ImageCompare.new(file_name,
dimensions: Screenshot.window_size, color_distance_limit: color_distance_limit,
area_size_limit: area_size_limit)
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
@@ -106,15 +107,15 @@
comparison.max_color_distance.ceil
end
# ODOT
"Screenshot does not match for '#{name}' (area: #{comparison.size}px #{comparison.dimensions}" \
- ", max_color_distance: #{max_color_distance})\n" \
+ ", max_color_distance: #{max_color_distance}" \
+ ", max_shift_distance: #{comparison.max_shift_distance})\n" \
"#{comparison.new_file_name}\n#{comparison.annotated_old_file_name}\n" \
"#{comparison.annotated_new_file_name}\n" \
"at #{caller}"
end
end
end
end
end
-# rubocop:enable Metrics/ClassLength