lib/capybara/screenshot/diff/capybara_setup.rb in capybara-screenshot-diff-0.6.0 vs lib/capybara/screenshot/diff/capybara_setup.rb in capybara-screenshot-diff-0.7.0
- old
+ new
@@ -194,10 +194,11 @@
end
end
private def take_stable_screenshot(comparison)
assert_images_loaded
+ execute_script('document.activeElement.blur()') if Capybara::Screenshot.blur_active_element
previous_file_size = comparison.old_file_size
screeenshot_started_at = last_image_change_at = Time.now
loop do
save_screenshot(comparison.new_file_name)
@@ -234,10 +235,10 @@
resized_image.save(file_name)
end
def assert_image_not_changed(caller, name, comparison)
return unless comparison.different?
- "Screenshot does not match for '#{name}' (area: #{comparison.size} #{comparison.dimensions}" \
+ "Screenshot does not match for '#{name}' (area: #{comparison.size}px #{comparison.dimensions}" \
", max_color_distance: #{comparison.max_color_distance.round(1)})\n" \
"#{comparison.new_file_name}\n#{comparison.annotated_old_file_name}\n" \
"#{comparison.annotated_new_file_name}\n" \
"at #{caller}"
end