capybara-screenshot-diff 1.10.0 → 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: b035794cdcf21a354847ddc368d0eeedade734ee20c42f68552baaab5e10adce
4
- data.tar.gz: 52053bf5f927c67478b1b5532e42fbaba493000196d55cad9e7f9229207ff9d2
3
+ metadata.gz: ffbb0b50c61fc1dcab03db91256897bed64caa09d65d37ee39765aec52e3d6fb
4
+ data.tar.gz: 1c762e2084bf2629eae25fb5e38792ce2232bdd62edbdbf1bff5381c074b3edd
5
5
  SHA512:
6
- metadata.gz: bf40f14eff9443d32aa8e179f97e33f4c36e4ad16a0fa49a23ebbfd50056b916bf74bdd1f64ac4cacf19b2ed1aaf6d948851879b5c814cae4701d94ee5d68287
7
- data.tar.gz: '096e47818809b8f8cbca41b77b0044c0a91aa449e635315f090f74325be46a868ae3ee2958b518a29b59f294e9173c46ce4c4bb901349ffea46a2afc7edad0c8'
6
+ metadata.gz: 97356f772b607b1ff67b146d1726baabbef696b362187c5aa5833657a4a443e8a6e8a30dedec49a07bda4d115e2a7a5c8482e4ba64a958072d1aaf6cd9dab8a3
7
+ data.tar.gz: '05880832a40006772c5fd72b28a4ebe9c28ca36ef49e70f132cab55acf1b97135bcd86bdb4d1b19893961fb344b0268d1c5d708354412c9c99efad03d3da85ab'
data/gems.rb CHANGED
@@ -13,7 +13,8 @@ gem "oily_png", platform: :ruby, git: "https://github.com/wvanbergen/oily_png",
13
13
  gem "ruby-vips", require: false
14
14
 
15
15
  group :test do
16
- gem 'mutex_m' # Needed for RubyMine
16
+ gem "capybara", ">= 3.26"
17
+ gem "mutex_m" # Needed for RubyMine debugging. Try removing it.
17
18
  gem "minitest", require: false
18
19
  gem "minitest-stub-const", require: false
19
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.0'
6
+ VERSION = "1.10.2"
7
7
  end
8
8
  end
9
9
  end
@@ -21,7 +21,7 @@ module CapybaraScreenshotDiff
21
21
 
22
22
  def screenshot(*args, skip_stack_frames: 0, **opts)
23
23
  assert_nothing_raised do
24
- super(*args, skip_stack_frames: skip_stack_frames + 1, **opts)
24
+ super(*args, skip_stack_frames: skip_stack_frames + 3, **opts)
25
25
  end
26
26
  end
27
27
 
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.0
4
+ version: 1.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uwe Kubosch