capybara-screenshot-diff 0.12.2 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed2393bc584bf55e0674c72042d3dabee546469f44f38a0591aa0dd2f4d41026
4
- data.tar.gz: '08bbc8ecda72aabb18e8780f199727cf398e9a62ba6c1f2670d1d5c5d2ec77e1'
3
+ metadata.gz: 11886bd0655733369d7cd16134b9be22e9136eddafa13115e43e0e07b735e161
4
+ data.tar.gz: 4b565158bae633f9a9c9a6a6ed3104146be2ef4fda71895a9f39bd56206a9648
5
5
  SHA512:
6
- metadata.gz: ebefa1bb2fe1475a3bb8ec49f275e63bbd94b56e22c70359ab0ed79881ec125cad73e3bf6e5da1c156400b21783449e9fffa41d1ab0b2fef438aae4d21400ec6
7
- data.tar.gz: ab88403460a0b2612da358bd839d5e7eecdd03944bf1a9a8bdbb6dbb1d4a7fba8b11c4a59dd604c1dfbe8cfef6e85b76a69ead02b9887b187584996752ccc28c
6
+ metadata.gz: 6252dd995f47da9dfe88d8c12d6d003eb1f0083327ca0c1f34fba8ec3ca3f30cb38a050ff4aef1ae924c61379d0aa71c29ca29b69facd1b03d746dd9abe51667
7
+ data.tar.gz: d4d175eb563b78793fa15ebe12c9326ed65902be9760d4f6aa26cd86c120faa84cb16af6a5db1099575e708ad05133e8a60d5cd7fd1d1e2b843a133baa51ea43
@@ -32,7 +32,7 @@ Metrics/MethodLength:
32
32
  # Offense count: 1
33
33
  # Configuration parameters: CountComments.
34
34
  Metrics/ModuleLength:
35
- Max: 103
35
+ Max: 106
36
36
 
37
37
  # Offense count: 1
38
38
  # Configuration parameters: CountKeywordArgs.
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 `blur_active_element` option:
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
- input = prepare_page_for_screenshot
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
- input.click if input
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
- input = page.driver.send :unwrap_script_result, active_element
101
+ blurred_input = page.driver.send :unwrap_script_result, active_element
102
102
  end
103
- input
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)
@@ -3,7 +3,7 @@
3
3
  module Capybara
4
4
  module Screenshot
5
5
  module Diff
6
- VERSION = '0.12.2'.freeze
6
+ VERSION = '0.13.0'.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.12.2
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-09 00:00:00.000000000 Z
11
+ date: 2018-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack