capybara-screenshot-diff 0.12.2 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +1 -1
- data/README.md +13 -1
- data/lib/capybara/screenshot/diff.rb +1 -0
- data/lib/capybara/screenshot/diff/stabilization.rb +7 -4
- data/lib/capybara/screenshot/diff/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11886bd0655733369d7cd16134b9be22e9136eddafa13115e43e0e07b735e161
|
4
|
+
data.tar.gz: 4b565158bae633f9a9c9a6a6ed3104146be2ef4fda71895a9f39bd56206a9648
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6252dd995f47da9dfe88d8c12d6d003eb1f0083327ca0c1f34fba8ec3ca3f30cb38a050ff4aef1ae924c61379d0aa71c29ca29b69facd1b03d746dd9abe51667
|
7
|
+
data.tar.gz: d4d175eb563b78793fa15ebe12c9326ed65902be9760d4f6aa26cd86c120faa84cb16af6a5db1099575e708ad05133e8a60d5cd7fd1d1e2b843a133baa51ea43
|
data/.rubocop_todo.yml
CHANGED
data/README.md
CHANGED
@@ -303,7 +303,19 @@ Capybara::Screenshot.stability_time_limit = 0.5
|
|
303
303
|
### Removing focus from the active element
|
304
304
|
|
305
305
|
In Chrome the screenshot includes the blinking input cursor. This can make it impossible to get a
|
306
|
-
stable screenshot. To get around this you can set the `
|
306
|
+
stable screenshot. To get around this you can set the `hide caret` option:
|
307
|
+
|
308
|
+
```ruby
|
309
|
+
Capybara::Screenshot.hide_caret = true
|
310
|
+
```
|
311
|
+
|
312
|
+
This will make the cursor (caret) transparent (invisible), so the blinking does not delay the screen shot.
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
### Removing focus from the active element
|
317
|
+
|
318
|
+
Another way to avoid the cursor blinking is to set the `blur_active_element` option:
|
307
319
|
|
308
320
|
```ruby
|
309
321
|
Capybara::Screenshot.blur_active_element = true
|
@@ -10,6 +10,7 @@ module Capybara
|
|
10
10
|
mattr_accessor :add_os_path
|
11
11
|
mattr_accessor :blur_active_element
|
12
12
|
mattr_accessor :enabled
|
13
|
+
mattr_accessor :hide_caret
|
13
14
|
mattr_accessor(:root) { (defined?(Rails.root) && Rails.root) || File.expand_path('.') }
|
14
15
|
mattr_accessor :stability_time_limit
|
15
16
|
mattr_accessor :window_size
|
@@ -20,7 +20,7 @@ module Capybara
|
|
20
20
|
|
21
21
|
def take_stable_screenshot(comparison, color_distance_limit:, shift_distance_limit:,
|
22
22
|
area_size_limit:)
|
23
|
-
|
23
|
+
blurred_input = prepare_page_for_screenshot
|
24
24
|
previous_file_name = comparison.old_file_name
|
25
25
|
screenshot_started_at = last_image_change_at = Time.now
|
26
26
|
loop.with_index do |_x, i|
|
@@ -57,7 +57,7 @@ module Capybara
|
|
57
57
|
FileUtils.mv comparison.new_file_name, previous_file_name
|
58
58
|
end
|
59
59
|
ensure
|
60
|
-
|
60
|
+
blurred_input.click if blurred_input
|
61
61
|
end
|
62
62
|
|
63
63
|
private
|
@@ -98,9 +98,12 @@ module Capybara
|
|
98
98
|
}
|
99
99
|
return null;
|
100
100
|
JS
|
101
|
-
|
101
|
+
blurred_input = page.driver.send :unwrap_script_result, active_element
|
102
102
|
end
|
103
|
-
|
103
|
+
if Capybara::Screenshot.hide_caret
|
104
|
+
execute_script("$('*').css('caret-color','transparent !important')")
|
105
|
+
end
|
106
|
+
blurred_input
|
104
107
|
end
|
105
108
|
|
106
109
|
def take_right_size_screenshot(comparison)
|
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.13.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: 2018-11-
|
11
|
+
date: 2018-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|