capybara-screenshot-diff 1.1.0 → 1.2.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: c4b74b3421312a6837944115244ae03eb5b59b65b28dd21fed17ad9f13672b32
4
- data.tar.gz: 9d60292db9261447214601ff3e498adb81cb5ce51899db8c19f18ac66ea53d6c
3
+ metadata.gz: 2dc2b0fb0ecc0721b9a857dbd62e0136e156fac4392203fe43b09e8b92fed361
4
+ data.tar.gz: dc70029a9a9d8b66a7e499e3c8fc1d86e9cd313fcb207b9e9232cc1ad3ff3975
5
5
  SHA512:
6
- metadata.gz: c529cfbf50e5b11251d4c44115713a99aac84c712dc62770d6cdc735adeba814ffc62e68acaa2fdf8e77fc6171b37269b37fbb2d669915a80a44c4d9ef7a523a
7
- data.tar.gz: 9b6f02f0c296a53fca5acba02b36b838bc83ac8616606029f44122a08537b930e122ce1398ec152f2dfc02e65b207042ba24c37f899cb7d6586c2588c6cd60f6
6
+ metadata.gz: 146567ed853d61596d5e88705d5da091f36f8cfd8f2c1503f30cbd916dcf59af652471fd12999ba77ede4fb15fff40c931bd1eb7e391feca83f8eb4a84fc97ae
7
+ data.tar.gz: b0ac70b70be9577603253e21a591f4031897f2ef0b78bf470a5b6b0c942837aa454b9b0069f7a38578f0afbd3708d9958c790bb9bc345da240ffcdff637c05ea
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2019-04-11 18:39:44 +0200 using RuboCop version 0.67.2.
3
+ # on 2019-08-29 00:41:08 +0200 using RuboCop version 0.68.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -19,11 +19,11 @@ Metrics/BlockLength:
19
19
  # Offense count: 1
20
20
  # Configuration parameters: CountComments.
21
21
  Metrics/ClassLength:
22
- Max: 305
22
+ Max: 304
23
23
 
24
- # Offense count: 6
24
+ # Offense count: 5
25
25
  Metrics/CyclomaticComplexity:
26
- Max: 18
26
+ Max: 17
27
27
 
28
28
  # Offense count: 15
29
29
  # Configuration parameters: CountComments, ExcludedMethods.
@@ -33,16 +33,16 @@ Metrics/MethodLength:
33
33
  # Offense count: 1
34
34
  # Configuration parameters: CountComments.
35
35
  Metrics/ModuleLength:
36
- Max: 109
36
+ Max: 107
37
37
 
38
38
  # Offense count: 1
39
39
  # Configuration parameters: CountKeywordArgs.
40
40
  Metrics/ParameterLists:
41
41
  Max: 7
42
42
 
43
- # Offense count: 6
43
+ # Offense count: 5
44
44
  Metrics/PerceivedComplexity:
45
- Max: 18
45
+ Max: 17
46
46
 
47
47
  # Offense count: 2
48
48
  # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
data/.travis.yml CHANGED
@@ -2,12 +2,11 @@ language: ruby
2
2
  sudo: false
3
3
  cache: bundler
4
4
  rvm:
5
- - jruby-9.2.7.0
5
+ - jruby-9.2.8.0
6
6
  - ruby-2.6.3
7
7
  - ruby-2.5.5
8
8
  - ruby-2.4.6
9
- - ruby-2.3.8
10
- - truffleruby-1.0.0-rc16
9
+ - truffleruby-19.2.0
11
10
 
12
11
  gemfile:
13
12
  - gemfiles/rails60.gemfile
@@ -20,14 +19,12 @@ env:
20
19
  - JRUBY_OPTS="--dev --debug"
21
20
 
22
21
  jdk:
23
- - oraclejdk8
22
+ - oraclejdk14
24
23
 
25
24
  matrix:
26
25
  fast_finish: true
27
26
  exclude:
28
27
  - rvm: ruby-2.4.6
29
28
  gemfile: gemfiles/rails60.gemfile
30
- - rvm: ruby-2.3.8
31
- gemfile: gemfiles/rails60.gemfile
32
29
  allow_failures:
33
- - rvm: truffleruby-1.0.0-rc16
30
+ - rvm: truffleruby-19.2.0
data/README.md CHANGED
@@ -295,9 +295,17 @@ shot will be taken and compared to the first. This is repeated until two
295
295
  subsequent screen shots are identical.
296
296
 
297
297
  ```ruby
298
- Capybara::Screenshot.stability_time_limit = 0.5
298
+ Capybara::Screenshot.stability_time_limit = 0.1
299
299
  ```
300
300
 
301
+ This can be overridden on a single screenshot:
302
+
303
+ ```ruby
304
+ test 'stability_time_limit' do
305
+ visit '/'
306
+ screenshot 'index', stability_time_limit: 0.5
307
+ end
308
+ ```
301
309
 
302
310
 
303
311
  ### Removing focus from the active element
@@ -2,4 +2,4 @@
2
2
 
3
3
  eval File.read("#{__dir__}/common.gemfile")
4
4
 
5
- gem 'actionpack', '~>6.0.0.rc1'
5
+ gem 'actionpack', '~>6.0.0'
@@ -21,14 +21,14 @@ module Capybara
21
21
  JS
22
22
 
23
23
  def take_stable_screenshot(comparison, color_distance_limit:, shift_distance_limit:,
24
- area_size_limit:, skip_area:)
24
+ area_size_limit:, skip_area:, stability_time_limit:)
25
25
  blurred_input = prepare_page_for_screenshot
26
26
  previous_file_name = comparison.old_file_name
27
27
  screenshot_started_at = last_image_change_at = Time.now
28
28
  1.step do |i|
29
29
  take_right_size_screenshot(comparison)
30
30
 
31
- break unless Capybara::Screenshot.stability_time_limit
31
+ break unless stability_time_limit
32
32
 
33
33
  if comparison.quick_equal?
34
34
  clean_stabilization_images(comparison.new_file_name)
@@ -42,7 +42,7 @@ module Capybara
42
42
  color_distance_limit: color_distance_limit, shift_distance_limit: shift_distance_limit,
43
43
  area_size_limit: area_size_limit, skip_area: skip_area)
44
44
  if stabilization_comparison.quick_equal?
45
- if (Time.now - last_image_change_at) > Capybara::Screenshot.stability_time_limit
45
+ if (Time.now - last_image_change_at) > stability_time_limit
46
46
  clean_stabilization_images(comparison.new_file_name)
47
47
  break
48
48
  end
@@ -68,9 +68,10 @@ module Capybara
68
68
  end
69
69
 
70
70
  # @return [Boolean] wether a screenshot was taken
71
- def screenshot(name, color_distance_limit: Diff.color_distance_limit,
72
- shift_distance_limit: Diff.shift_distance_limit, area_size_limit: Diff.area_size_limit,
73
- skip_area: Diff.skip_area)
71
+ def screenshot(name, area_size_limit: Diff.area_size_limit,
72
+ color_distance_limit: Diff.color_distance_limit,
73
+ shift_distance_limit: Diff.shift_distance_limit, skip_area: Diff.skip_area,
74
+ stability_time_limit: Screenshot.stability_time_limit)
74
75
  return unless Screenshot.active?
75
76
  return if window_size_is_wrong?
76
77
 
@@ -92,7 +93,8 @@ module Capybara
92
93
  take_stable_screenshot(comparison, color_distance_limit: color_distance_limit,
93
94
  shift_distance_limit: shift_distance_limit,
94
95
  area_size_limit: area_size_limit,
95
- skip_area: skip_area)
96
+ skip_area: skip_area,
97
+ stability_time_limit: stability_time_limit)
96
98
  return unless comparison.old_file_exists?
97
99
 
98
100
  (@test_screenshots ||= []) << [caller(1..1).first, name, comparison]
@@ -3,7 +3,7 @@
3
3
  module Capybara
4
4
  module Screenshot
5
5
  module Diff
6
- VERSION = '1.1.0'
6
+ VERSION = '1.2.0'
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: 1.1.0
4
+ version: 1.2.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: 2019-08-27 00:00:00.000000000 Z
11
+ date: 2019-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack