capybara-screenshot-diff 1.8.3 → 1.10.2

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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -11
  3. data/capybara-screenshot-diff.gemspec +3 -4
  4. data/gems.rb +11 -8
  5. data/lib/capybara/screenshot/diff/area_calculator.rb +56 -0
  6. data/lib/capybara/screenshot/diff/browser_helpers.rb +5 -5
  7. data/lib/capybara/screenshot/diff/comparison.rb +6 -0
  8. data/lib/capybara/screenshot/diff/cucumber.rb +1 -9
  9. data/lib/capybara/screenshot/diff/difference.rb +8 -4
  10. data/lib/capybara/screenshot/diff/drivers/base_driver.rb +0 -5
  11. data/lib/capybara/screenshot/diff/drivers/chunky_png_driver.rb +10 -5
  12. data/lib/capybara/screenshot/diff/drivers/vips_driver.rb +14 -3
  13. data/lib/capybara/screenshot/diff/drivers.rb +1 -1
  14. data/lib/capybara/screenshot/diff/image_compare.rb +84 -114
  15. data/lib/capybara/screenshot/diff/region.rb +28 -7
  16. data/lib/capybara/screenshot/diff/reporters/default.rb +121 -0
  17. data/lib/capybara/screenshot/diff/screenshot_matcher.rb +36 -74
  18. data/lib/capybara/screenshot/diff/screenshoter.rb +46 -54
  19. data/lib/capybara/screenshot/diff/stable_screenshoter.rb +65 -63
  20. data/lib/capybara/screenshot/diff/test_methods.rb +78 -10
  21. data/lib/capybara/screenshot/diff/{drivers/utils.rb → utils.rb} +0 -7
  22. data/lib/capybara/screenshot/diff/vcs.rb +25 -23
  23. data/lib/capybara/screenshot/diff/version.rb +1 -1
  24. data/lib/capybara/screenshot/diff.rb +1 -111
  25. data/lib/capybara-screenshot-diff.rb +1 -1
  26. data/lib/capybara_screenshot_diff/attempts_reporter.rb +49 -0
  27. data/lib/capybara_screenshot_diff/cucumber.rb +12 -0
  28. data/lib/capybara_screenshot_diff/dsl.rb +11 -0
  29. data/lib/capybara_screenshot_diff/minitest.rb +49 -0
  30. data/lib/capybara_screenshot_diff/rspec.rb +32 -0
  31. data/lib/capybara_screenshot_diff/snap.rb +55 -0
  32. data/lib/capybara_screenshot_diff/snap_manager.rb +76 -0
  33. data/lib/capybara_screenshot_diff.rb +86 -0
  34. metadata +20 -42
  35. data/lib/capybara/screenshot/diff/stabilization.rb +0 -0
  36. data/sig/capybara/screenshot/diff/diff.rbs +0 -28
  37. data/sig/capybara/screenshot/diff/difference.rbs +0 -33
  38. data/sig/capybara/screenshot/diff/drivers/base_driver.rbs +0 -63
  39. data/sig/capybara/screenshot/diff/drivers/browser_helpers.rbs +0 -36
  40. data/sig/capybara/screenshot/diff/drivers/chunky_png_driver.rbs +0 -89
  41. data/sig/capybara/screenshot/diff/drivers/utils.rbs +0 -13
  42. data/sig/capybara/screenshot/diff/drivers/vips_driver.rbs +0 -25
  43. data/sig/capybara/screenshot/diff/image_compare.rbs +0 -93
  44. data/sig/capybara/screenshot/diff/os.rbs +0 -11
  45. data/sig/capybara/screenshot/diff/region.rbs +0 -43
  46. data/sig/capybara/screenshot/diff/screenshot_matcher.rbs +0 -60
  47. data/sig/capybara/screenshot/diff/screenshoter.rbs +0 -48
  48. data/sig/capybara/screenshot/diff/stable_screenshoter.rbs +0 -29
  49. data/sig/capybara/screenshot/diff/test_methods.rbs +0 -39
  50. data/sig/capybara/screenshot/diff/vcs.rbs +0 -17
@@ -1,60 +0,0 @@
1
- module Capybara
2
- module Screenshot
3
- module Diff
4
- class ScreenshotMatcher
5
-
6
- type job_entity = Array[top]
7
-
8
- attr_reader base_screenshot_path: TestMethods::path_entity
9
- attr_reader driver_options: Drivers::BaseDriver::options_entity
10
- attr_reader screenshot_full_name: TestMethods::path_entity
11
- attr_reader screenshot_path: Pathname
12
-
13
- def build_screenshot_matches_job: -> job_entity?
14
- def cleanup: -> void
15
-
16
- def self.base_image_path_from: (TestMethods::path_entity) -> Pathname
17
-
18
- private
19
-
20
- def build_screenshoter_for: (capture_options_entity capture_options, Drivers::BaseDriver::options_entity driver_options) -> (Screenshoter | StableScreenshoter)
21
-
22
- def checkout_base_screenshot: -> void
23
-
24
- def take_comparison_screenshot: (capture_options_entity capture_options, Drivers::BaseDriver::options_entity driver_options, TestMethods::path_entity screenshot_path) -> void
25
-
26
- def create_output_directory_for: (Pathname file_name) -> void
27
-
28
- type skip_area_entity = String | Region::raw_region_entity
29
- type flex_skip_area_entity = (skip_area_entity | Array[skip_area_entity])
30
- type flex_crop_entity = (nil | String | Region | Region::raw_region_entity)
31
-
32
- def calculate_skip_area: (flex_skip_area_entity skip_area, flex_crop_entity crop) -> Array[Region]
33
-
34
- type input_region = (Region::raw_region_entity | String | Region)
35
-
36
- type input_options = {
37
- area_size_limit: Numeric?,
38
- color_distance_limit: Numeric?,
39
- driver: (:auto | :vips | :chunky_png | ImageCompare::driver_entity)?,
40
- median_filter_window_size: Numeric?,
41
- shift_distance_limit: Numeric?,
42
- skip_area: nil | Array[input_region] | input_region,
43
- stability_time_limit: Numeric?,
44
- tolerance: Numeric?,
45
- wait: Numeric?
46
- }
47
-
48
- def calculate_crop_region: (input_options driver_options) -> Region?
49
-
50
- type capture_options_entity = {
51
- stability_time_limit: Numeric?,
52
- wait: Numeric?,
53
- crop: Region?
54
- }
55
-
56
- def build_regions_for: ((Enumerable[Region::raw_region_entity]) coordinates) -> Array[Region?]
57
- end
58
- end
59
- end
60
- end
@@ -1,48 +0,0 @@
1
- module Capybara
2
- module Screenshot
3
- class Screenshoter
4
- @_csd_retina_warned: bool?
5
-
6
- attr_reader capture_options: Diff::ScreenshotMatcher::capture_options_entity
7
-
8
- attr_reader comparison_options: Diff::Drivers::BaseDriver::options_entity
9
-
10
- attr_reader driver: Diff::ImageCompare::driver_entity
11
-
12
- def initialize: (?Diff::ScreenshotMatcher::capture_options_entity capture_options, Diff::ImageCompare::driver_entity driver) -> void
13
-
14
- def crop: () -> Numeric?
15
-
16
- def wait: () -> Numeric?
17
-
18
- def self.attempts_screenshot_paths: (Diff::TestMethods::path_entity base_file) -> Array[String]
19
-
20
- def self.cleanup_attempts_screenshots: (Diff::TestMethods::path_entity base_file) -> void
21
-
22
- # Try to get screenshot from browser.
23
- # On `stability_time_limit` it checks that page stop updating by comparison several screenshot attempts
24
- # On reaching `wait` limit then it has been failed. On failing we annotate screenshot attempts to help to debug
25
- def take_comparison_screenshot: (Diff::TestMethods::path_entity screenshot_path) -> void
26
-
27
- def self.gen_next_attempt_path: (Diff::TestMethods::path_entity screenshot_path, Integer iteration) -> Pathname
28
-
29
- def take_screenshot: (Diff::TestMethods::path_entity screenshot_path) -> void
30
-
31
- def browser_save_screenshot: (Diff::TestMethods::path_entity screenshot_path) -> void
32
-
33
- def process_screenshot: (Diff::TestMethods::path_entity screenshot_path) -> void
34
-
35
- def reduce_retina_image_size: (Diff::TestMethods::path_entity file_name) -> void
36
-
37
- def notice_how_to_avoid_this: () -> void
38
-
39
- def prepare_page_for_screenshot: (timeout: Numeric) -> BrowserHelpers::capybara_element?
40
-
41
- def wait_images_loaded: (timeout: Numeric) -> void
42
-
43
- private
44
-
45
- def selenium_with_retina_screen?: () -> boolish
46
- end
47
- end
48
- end
@@ -1,29 +0,0 @@
1
- module Capybara
2
- module Screenshot
3
- module Diff
4
- class StableScreenshoter
5
- STABILITY_OPTIONS: [:stability_time_limit, :wait]
6
-
7
- @_csd_retina_warned: boolish
8
-
9
- @comparison_options: Drivers::BaseDriver::options_entity
10
- @screenshoter: (StableScreenshoter | Screenshoter)
11
- @stability_time_limit: Numeric
12
-
13
- def take_comparison_screenshot: (TestMethods::path_entity screenshot_path) -> void
14
-
15
- def take_stable_screenshot: (TestMethods::path_entity) -> Pathname?
16
-
17
- private
18
-
19
- def annotate_attempts_and_fail!: (TestMethods::path_entity screenshot_path) -> void
20
-
21
- def build_comparison_for: (TestMethods::path_entity attempt_path, TestMethods::path_entity previous_attempt_path) -> ImageCompare
22
-
23
- def prepare_page_for_screenshot: (timeout: Numeric) -> top?
24
-
25
- def annotate_stabilization_images: (Array[String]) -> void
26
- end
27
- end
28
- end
29
- end
@@ -1,39 +0,0 @@
1
- # Add the `screenshot` method to ActionDispatch::IntegrationTest
2
- module Capybara
3
- module Screenshot
4
- module Diff
5
- module TestMethods
6
- type name_entity = (Symbol | String)
7
- type path_entity = (string | Pathname)
8
-
9
- @screenshot_counter: Numeric?
10
- @screenshot_group: String?
11
- @screenshot_section: String?
12
- @test_screenshot_errors: Array[top]?
13
- @test_screenshots: Array[[Array[String]?, String, ImageCompare]]?
14
-
15
- def initialize: (*untyped) -> untyped
16
-
17
- def group_parts: () -> Array[String]
18
-
19
- def build_full_name: (name_entity name) -> String
20
-
21
- def schedule_match_job: ([untyped, untyped, untyped] job) -> true
22
-
23
- def screenshot_dir: () -> String
24
-
25
- def screenshot_section: (name_entity name) -> void
26
-
27
- def screenshot_group: (name_entity? name) -> void
28
-
29
- def screenshot: (name_entity name, ?skip_stack_frames: ::Integer, **untyped options) -> boolish
30
-
31
- def assert_image_not_changed: (String caller, String name, ImageCompare comparison) -> ::String?
32
-
33
- private
34
-
35
- def build_screenshot_matches_job: (String, Drivers::BaseDriver::options_entity) -> ScreenshotMatcher::job_entity?
36
- end
37
- end
38
- end
39
- end
@@ -1,17 +0,0 @@
1
- module Capybara
2
- module Screenshot
3
- module Diff
4
- module Vcs
5
- SILENCE_ERRORS: String
6
-
7
- def self.checkout_vcs: (Pathname screenshot_path, Pathname checkout_path) -> bool
8
-
9
- def self.restore_git_revision: (Pathname screenshot_path, Pathname checkout_path) -> bool
10
-
11
- def self.restore_svn_revision: -> bool
12
-
13
- def self.svn?: -> bool
14
- end
15
- end
16
- end
17
- end