capybara-screenshot-diff 0.13.1 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop_todo.yml +1 -1
- data/README.md +24 -0
- data/lib/capybara/screenshot/diff/image_compare.rb +2 -6
- data/lib/capybara/screenshot/diff/stabilization.rb +1 -3
- data/lib/capybara/screenshot/diff/test_methods.rb +1 -1
- 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
|
+
SHA1:
|
3
|
+
metadata.gz: ab8bfbb400b5ee5a1f4652513e8769cbb142de67
|
4
|
+
data.tar.gz: '093da4d426368045c0faebaf77feb81b891249e3'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2be6089d1f06236e9e5bb855c0cf69cb3c3885420e1bf02df4920211078c4ea25f01572275655903b178d603ebc16465e936d1926ee3e5730ba34577aec90fcb
|
7
|
+
data.tar.gz: 6e2b67f3c4eb7784e6280ec4aac9f8061a96232e351d48440f23eb7e68459c79c7ad32cb7652615a494c8f1e0847a8fcd44b6d2b82f55f82566310cb8242dcc3
|
data/.rubocop_todo.yml
CHANGED
data/README.md
CHANGED
@@ -345,6 +345,30 @@ Capybara::Screenshot::Diff.color_distance_limit = 42
|
|
345
345
|
```
|
346
346
|
|
347
347
|
|
348
|
+
### Allowed shift distance
|
349
|
+
|
350
|
+
Sometimes you want to allow small movements in the images. For example, jquer-tablesorter
|
351
|
+
renders the same table slightly differently sometimes. You can set set the shift distance
|
352
|
+
threshold for the comparison using the `shift_distance_limit` option to the `screenshot`
|
353
|
+
method:
|
354
|
+
|
355
|
+
```ruby
|
356
|
+
test 'color threshold' do
|
357
|
+
visit '/'
|
358
|
+
screenshot 'index', shift_distance_limit: 6
|
359
|
+
end
|
360
|
+
```
|
361
|
+
|
362
|
+
The difference is calculated as maximum distance in either the X or the Y axis.
|
363
|
+
You can also set this globally:
|
364
|
+
|
365
|
+
```ruby
|
366
|
+
Capybara::Screenshot::Diff.shift_distance_limit = 4
|
367
|
+
```
|
368
|
+
|
369
|
+
If `shift_distance_limit` is `nil` shift distance is not measured. If `shift_distance_limit` is set,
|
370
|
+
even to `0`, shift distabnce is measured and reported on image differences.
|
371
|
+
|
348
372
|
### Allowed difference size
|
349
373
|
|
350
374
|
You can set set a threshold for the differing area size for the comparison
|
@@ -282,12 +282,8 @@ module Capybara
|
|
282
282
|
color_distance <= @color_distance_limit)
|
283
283
|
return color_matches if !@shift_distance_limit || @max_shift_distance == Float::INFINITY
|
284
284
|
|
285
|
-
shift_distance =
|
286
|
-
|
287
|
-
0
|
288
|
-
else
|
289
|
-
shift_distance_at(new_img, old_img, x, y, color_distance_limit: @color_distance_limit)
|
290
|
-
end
|
285
|
+
shift_distance = (color_matches && 0) ||
|
286
|
+
shift_distance_at(new_img, old_img, x, y, color_distance_limit: @color_distance_limit)
|
291
287
|
if shift_distance && (@max_shift_distance.nil? || shift_distance > @max_shift_distance)
|
292
288
|
@max_shift_distance = shift_distance
|
293
289
|
end
|
@@ -100,9 +100,7 @@ module Capybara
|
|
100
100
|
JS
|
101
101
|
blurred_input = page.driver.send :unwrap_script_result, active_element
|
102
102
|
end
|
103
|
-
if Capybara::Screenshot.hide_caret
|
104
|
-
execute_script("$('*').css('caret-color','transparent')")
|
105
|
-
end
|
103
|
+
execute_script("$('*').css('caret-color','transparent')") if Capybara::Screenshot.hide_caret
|
106
104
|
blurred_input
|
107
105
|
end
|
108
106
|
|
@@ -80,7 +80,7 @@ module Capybara
|
|
80
80
|
FileUtils.mkdir_p File.dirname(file_name)
|
81
81
|
comparison = ImageCompare.new(file_name,
|
82
82
|
dimensions: Screenshot.window_size, color_distance_limit: color_distance_limit,
|
83
|
-
area_size_limit: area_size_limit)
|
83
|
+
area_size_limit: area_size_limit, shift_distance_limit: shift_distance_limit)
|
84
84
|
checkout_vcs(name, comparison)
|
85
85
|
take_stable_screenshot(comparison, color_distance_limit: color_distance_limit,
|
86
86
|
shift_distance_limit: shift_distance_limit,
|
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.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Uwe Kubosch
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-31 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.5.2.3
|
205
205
|
signing_key:
|
206
206
|
specification_version: 4
|
207
207
|
summary: Track your GUI changes with diff assertions
|