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 +5 -5
- data/README.md +5 -2
- data/lib/capybara/screenshot/diff/stabilization.rb +6 -4
- data/lib/capybara/screenshot/diff/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e293e6dcd7578d372e90ef1f3cf024043bbcae24b068d937f9f03a09c9e78207
|
4
|
+
data.tar.gz: a01091f8e30348f9730f7f5832969984760f1e278bf9fbbb17199e37b96816b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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:
|
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 =
|
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
|
-
|
117
|
-
|
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
|
|
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.
|
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-
|
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.
|
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
|