capybara-screenshot-diff 0.14.0 → 0.14.1

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
- SHA1:
3
- metadata.gz: ab8bfbb400b5ee5a1f4652513e8769cbb142de67
4
- data.tar.gz: '093da4d426368045c0faebaf77feb81b891249e3'
2
+ SHA256:
3
+ metadata.gz: e293e6dcd7578d372e90ef1f3cf024043bbcae24b068d937f9f03a09c9e78207
4
+ data.tar.gz: a01091f8e30348f9730f7f5832969984760f1e278bf9fbbb17199e37b96816b4
5
5
  SHA512:
6
- metadata.gz: 2be6089d1f06236e9e5bb855c0cf69cb3c3885420e1bf02df4920211078c4ea25f01572275655903b178d603ebc16465e936d1926ee3e5730ba34577aec90fcb
7
- data.tar.gz: 6e2b67f3c4eb7784e6280ec4aac9f8061a96232e351d48440f23eb7e68459c79c7ad32cb7652615a494c8f1e0847a8fcd44b6d2b82f55f82566310cb8242dcc3
6
+ metadata.gz: 5f078b115a1110dfc843a8a698bf98a2fece1ce2276606b463144b84ac945bb12f77bd7e58765bd58b7067d03e9036fc523f0435b133add23dfa6f8e66ea8dab
7
+ data.tar.gz: cb763fb16dafb73c933494fb0b6a87eecfabeeac5a1bc39d99bf6fe43f7a7145ca5aef66af70a1eca6cf2d25af4d799599d72502167a6c9205070463261a0c47
data/README.md CHANGED
@@ -355,7 +355,7 @@ method:
355
355
  ```ruby
356
356
  test 'color threshold' do
357
357
  visit '/'
358
- screenshot 'index', shift_distance_limit: 6
358
+ screenshot 'index', shift_distance_limit: 2
359
359
  end
360
360
  ```
361
361
 
@@ -363,9 +363,12 @@ The difference is calculated as maximum distance in either the X or the Y axis.
363
363
  You can also set this globally:
364
364
 
365
365
  ```ruby
366
- Capybara::Screenshot::Diff.shift_distance_limit = 4
366
+ Capybara::Screenshot::Diff.shift_distance_limit = 1
367
367
  ```
368
368
 
369
+ **Note:** For each increase in `shift_distance_limit` more pixels are searched for a matching color value, and
370
+ this will impact performance **severely** if a match cannot be found.
371
+
369
372
  If `shift_distance_limit` is `nil` shift distance is not measured. If `shift_distance_limit` is set,
370
373
  even to `0`, shift distabnce is measured and reported on image differences.
371
374
 
@@ -49,7 +49,7 @@ module Capybara
49
49
  last_image_change_at = Time.now
50
50
  end
51
51
 
52
- check_max_wait_time(comparison, screenshot_started_at)
52
+ check_max_wait_time(comparison, screenshot_started_at, shift_distance_limit: shift_distance_limit)
53
53
  end
54
54
 
55
55
  previous_file_name = "#{comparison.new_file_name.chomp('.png')}_x#{format('%02i', i)}.png~"
@@ -112,9 +112,11 @@ module Capybara
112
112
  # ODOT
113
113
  end
114
114
 
115
- def check_max_wait_time(comparison, screenshot_started_at)
116
- assert (Time.now - screenshot_started_at) < Capybara.default_max_wait_time,
117
- "Could not get stable screenshot within #{Capybara.default_max_wait_time}s\n" \
115
+ def check_max_wait_time(comparison, screenshot_started_at, shift_distance_limit:)
116
+ shift_factor = shift_distance_limit ? (shift_distance_limit * 2 + 1) ^ 2 : 1
117
+ max_wait_time = Capybara.default_max_wait_time * shift_factor
118
+ assert (Time.now - screenshot_started_at) < max_wait_time,
119
+ "Could not get stable screenshot within #{max_wait_time}s\n" \
118
120
  "#{stabilization_images(comparison.new_file_name).join("\n")}"
119
121
  end
120
122
 
@@ -3,7 +3,7 @@
3
3
  module Capybara
4
4
  module Screenshot
5
5
  module Diff
6
- VERSION = '0.14.0'.freeze
6
+ VERSION = '0.14.1'.freeze
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-screenshot-diff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uwe Kubosch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-31 00:00:00.000000000 Z
11
+ date: 2019-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
201
  version: '0'
202
202
  requirements: []
203
203
  rubyforge_project:
204
- rubygems_version: 2.5.2.3
204
+ rubygems_version: 2.7.6
205
205
  signing_key:
206
206
  specification_version: 4
207
207
  summary: Track your GUI changes with diff assertions