capybara-screenshot-diff 1.10.1 → 1.10.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bfdd68a006e25a2b4eb1a8e96899b8ed168cb9e84311bc3c883e9a44a66920f8
4
- data.tar.gz: 298366cf80e500f29a7c05b45f5eeeaf0db735cf6dda8b2e7622fbf059dfbdef
3
+ metadata.gz: ffbb0b50c61fc1dcab03db91256897bed64caa09d65d37ee39765aec52e3d6fb
4
+ data.tar.gz: 1c762e2084bf2629eae25fb5e38792ce2232bdd62edbdbf1bff5381c074b3edd
5
5
  SHA512:
6
- metadata.gz: bf437d7b0ff41f9a9ecc696cec94a018079ff980faff96aa194ad050fd75940940042dc63f367d411d98084d67de81e01a36c26cda6127c9f2440ec576e49de6
7
- data.tar.gz: 4e203cd3339974151eb7ab7261eef59b3896875144462970dcded50c665e939bbd845cb4f78741e2e4a7f0180be31bb1e96561ed3ef71600959dfaeca76b9001
6
+ metadata.gz: 97356f772b607b1ff67b146d1726baabbef696b362187c5aa5833657a4a443e8a6e8a30dedec49a07bda4d115e2a7a5c8482e4ba64a958072d1aaf6cd9dab8a3
7
+ data.tar.gz: '05880832a40006772c5fd72b28a4ebe9c28ca36ef49e70f132cab55acf1b97135bcd86bdb4d1b19893961fb344b0268d1c5d708354412c9c99efad03d3da85ab'
data/gems.rb CHANGED
@@ -14,7 +14,7 @@ gem "ruby-vips", require: false
14
14
 
15
15
  group :test do
16
16
  gem "capybara", ">= 3.26"
17
- gem 'mutex_m' # Needed for RubyMine debugging. Try removing it.
17
+ gem "mutex_m" # Needed for RubyMine debugging. Try removing it.
18
18
  gem "minitest", require: false
19
19
  gem "minitest-stub-const", require: false
20
20
  gem "simplecov", require: false
@@ -59,6 +59,10 @@ module Capybara
59
59
  processed.difference.different?
60
60
  end
61
61
 
62
+ def dimensions_changed?
63
+ difference.failed_by&.[](:different_dimensions)
64
+ end
65
+
62
66
  def reporter
63
67
  @reporter ||= begin
64
68
  current_difference = difference || build_no_difference(nil)
@@ -39,7 +39,7 @@ module Capybara::Screenshot::Diff
39
39
  .map { |image| driver.dimension(image).join("x") }
40
40
  .join(" => ")
41
41
 
42
- "Screenshot dimension has been changed for #{image_path.to_path}: #{change_msg}"
42
+ "Dimensions have changed: #{change_msg}\n#{base_image_path.to_path}\n#{image_path.to_path}"
43
43
  end
44
44
 
45
45
  def annotate_and_save_images
@@ -101,6 +101,10 @@ module Capybara::Screenshot::Diff
101
101
  difference.comparison.new_image
102
102
  end
103
103
 
104
+ def base_image_path
105
+ comparison.base_image_path
106
+ end
107
+
104
108
  def image_path
105
109
  comparison.new_image_path
106
110
  end
@@ -158,13 +158,13 @@ module Capybara
158
158
  # Cleanup after comparisons
159
159
  if !result && comparison.base_image_path.exist?
160
160
  FileUtils.mv(comparison.base_image_path, comparison.image_path, force: true)
161
- else
161
+ elsif !comparison.dimensions_changed?
162
162
  FileUtils.rm_rf(comparison.base_image_path)
163
163
  end
164
164
 
165
165
  return unless result
166
166
 
167
- "Screenshot does not match for '#{name}' #{comparison.error_message}\n#{caller.join("\n")}"
167
+ "Screenshot does not match for '#{name}': #{comparison.error_message}\n#{caller.join("\n")}"
168
168
  end
169
169
 
170
170
  private
@@ -3,7 +3,7 @@
3
3
  module Capybara
4
4
  module Screenshot
5
5
  module Diff
6
- VERSION = '1.10.1'
6
+ VERSION = "1.10.2"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-screenshot-diff
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.1
4
+ version: 1.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uwe Kubosch