capybara-screenshot-diff 1.6.3 → 1.8.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +29 -0
  3. data/capybara-screenshot-diff.gemspec +6 -3
  4. data/gems.rb +8 -2
  5. data/lib/capybara/screenshot/diff/browser_helpers.rb +102 -0
  6. data/lib/capybara/screenshot/diff/cucumber.rb +11 -0
  7. data/lib/capybara/screenshot/diff/difference.rb +63 -0
  8. data/lib/capybara/screenshot/diff/drivers/base_driver.rb +42 -0
  9. data/lib/capybara/screenshot/diff/drivers/chunky_png_driver.rb +193 -252
  10. data/lib/capybara/screenshot/diff/drivers/utils.rb +18 -0
  11. data/lib/capybara/screenshot/diff/drivers/vips_driver.rb +61 -102
  12. data/lib/capybara/screenshot/diff/drivers.rb +16 -0
  13. data/lib/capybara/screenshot/diff/image_compare.rb +138 -154
  14. data/lib/capybara/screenshot/diff/os.rb +1 -1
  15. data/lib/capybara/screenshot/diff/region.rb +86 -0
  16. data/lib/capybara/screenshot/diff/screenshot_matcher.rb +128 -0
  17. data/lib/capybara/screenshot/diff/screenshoter.rb +136 -0
  18. data/lib/capybara/screenshot/diff/stabilization.rb +0 -208
  19. data/lib/capybara/screenshot/diff/stable_screenshoter.rb +106 -0
  20. data/lib/capybara/screenshot/diff/test_methods.rb +57 -63
  21. data/lib/capybara/screenshot/diff/vcs.rb +48 -21
  22. data/lib/capybara/screenshot/diff/version.rb +1 -1
  23. data/lib/capybara/screenshot/diff.rb +15 -19
  24. data/sig/capybara/screenshot/diff/diff.rbs +28 -0
  25. data/sig/capybara/screenshot/diff/difference.rbs +33 -0
  26. data/sig/capybara/screenshot/diff/drivers/base_driver.rbs +63 -0
  27. data/sig/capybara/screenshot/diff/drivers/browser_helpers.rbs +36 -0
  28. data/sig/capybara/screenshot/diff/drivers/chunky_png_driver.rbs +89 -0
  29. data/sig/capybara/screenshot/diff/drivers/utils.rbs +13 -0
  30. data/sig/capybara/screenshot/diff/drivers/vips_driver.rbs +25 -0
  31. data/sig/capybara/screenshot/diff/image_compare.rbs +93 -0
  32. data/sig/capybara/screenshot/diff/os.rbs +11 -0
  33. data/sig/capybara/screenshot/diff/region.rbs +43 -0
  34. data/sig/capybara/screenshot/diff/screenshot_matcher.rbs +60 -0
  35. data/sig/capybara/screenshot/diff/screenshoter.rbs +48 -0
  36. data/sig/capybara/screenshot/diff/stable_screenshoter.rbs +29 -0
  37. data/sig/capybara/screenshot/diff/test_methods.rbs +39 -0
  38. data/sig/capybara/screenshot/diff/vcs.rbs +17 -0
  39. metadata +30 -25
  40. data/.gitattributes +0 -4
  41. data/.github/workflows/lint.yml +0 -25
  42. data/.github/workflows/test.yml +0 -120
  43. data/.gitignore +0 -12
  44. data/.standard.yml +0 -12
  45. data/CONTRIBUTING.md +0 -22
  46. data/Dockerfile +0 -60
  47. data/README.md +0 -555
  48. data/bin/bundle +0 -114
  49. data/bin/console +0 -15
  50. data/bin/install-vips +0 -11
  51. data/bin/rake +0 -27
  52. data/bin/setup +0 -8
  53. data/bin/standardrb +0 -29
  54. data/gemfiles/rails52.gemfile +0 -6
  55. data/gemfiles/rails60_gems.rb +0 -8
  56. data/gemfiles/rails61_gems.rb +0 -7
  57. data/gemfiles/rails70_gems.rb +0 -7
  58. data/tmp/.keep +0 -0
@@ -0,0 +1,93 @@
1
+ module Capybara
2
+ module Screenshot
3
+ module Diff
4
+ LOADED_DRIVERS: { vips: ImageCompare::driver_entity, chunky_png: ImageCompare::driver_entity }
5
+
6
+ # Compare two images_entities and determine if they are equal, different, or within some comparison
7
+ # range considering color values and difference area size.
8
+ class ImageCompare
9
+ TOLERABLE_OPTIONS: [:tolerance, :color_distance_limit, :shift_distance_limit, :area_size_limit]
10
+
11
+ class Comparison
12
+
13
+ end
14
+
15
+ type driver_entity = (Drivers::VipsDriver | Drivers::ChunkyPNGDriver)
16
+ type image_entity = (ChunkyPNG::Canvas | Vips::Image)
17
+ type images_entities = [image_entity, image_entity]
18
+ type cache_entity = (::Hash[Symbol, top] | top)
19
+
20
+ @annotated_base_image_path: Pathname
21
+ @annotated_image_path: Pathname
22
+ @difference: Difference
23
+ @error_message: String?
24
+
25
+ attr_reader error_message: String?
26
+ attr_reader annotated_base_image_path: Pathname
27
+ attr_reader annotated_image_path: Pathname
28
+ attr_reader driver: driver_entity
29
+ attr_reader driver_options: Drivers::BaseDriver::options_entity
30
+ attr_reader annotated_new_file_name: TestMethods::path_entity
31
+ attr_reader annotated_old_file_name: TestMethods::path_entity
32
+ attr_reader new_file_name: String
33
+ attr_reader old_file_name: String
34
+ attr_reader skip_area: Array[Region]?
35
+ attr_accessor shift_distance_limit: Numeric?
36
+ attr_accessor area_size_limit: Numeric?
37
+ attr_accessor color_distance_limit: Numeric?
38
+
39
+ @median_filter_window_size: Numeric?
40
+ @dimensions: Drivers::BaseDriver::dimension_entity?
41
+ @tolerance: Numeric?
42
+
43
+ def initialize: (TestMethods::path_entity new_file_name, TestMethods::path_entity old_file_name, ?Drivers::BaseDriver::options_entity options) -> void
44
+
45
+ # Compare the two image_entity files and return `true` or `false` as quickly as possible.
46
+ # Return falsely if the old file does not exist or the image_entity dimensions do not match.
47
+ def quick_equal?: () -> boolish
48
+
49
+ # Compare the two images_entities referenced by this object, and return `true` if they are different,
50
+ # and `false` if they are the same.
51
+ def different?: () -> bool
52
+
53
+ def clean_tmp_files: () -> void
54
+
55
+ def save: (image_entity, TestMethods::path_entity) -> void
56
+
57
+ def old_file_exists?: () -> boolish
58
+
59
+ def reset: () -> void
60
+
61
+ NEW_LINE: "\n"
62
+
63
+ private
64
+
65
+ def _different?: -> String?
66
+
67
+ def different: (Difference images) -> String
68
+
69
+ def preprocess_images: (images_entities images) -> images_entities
70
+
71
+ def preprocess_image: (image_entity image) -> image_entity
72
+
73
+ def old_file_size: () -> Integer
74
+
75
+ def new_file_size: () -> Integer
76
+
77
+ def not_different: () -> nil
78
+
79
+ def annotate_and_save_images: (Difference) -> void
80
+
81
+ def annotate_and_save_image: (Difference, image_entity, TestMethods::path_entity) -> void
82
+
83
+ DIFF_COLOR: [255, 0, 0, 255]
84
+
85
+ def annotate_difference: (image_entity, Region) -> void
86
+
87
+ SKIP_COLOR: [255, 192, 0, 255]
88
+
89
+ def annotate_skip_areas: (image_entity, Array[Region] skip_areas) -> void
90
+ end
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,11 @@
1
+ module Capybara
2
+ module Screenshot
3
+ module Os
4
+ ON_WINDOWS: bool
5
+ ON_MAC: bool
6
+ ON_LINUX: bool
7
+
8
+ def self.name: () -> ("windows" | "macos" | "linux" | "unknown")
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,43 @@
1
+ class Region
2
+ type raw_region_entity = [Numeric, Numeric, Numeric, Numeric]
3
+
4
+ attr_accessor x: Numeric
5
+
6
+ attr_accessor y: Numeric
7
+
8
+ attr_accessor width: Numeric
9
+
10
+ attr_accessor height: Numeric
11
+
12
+ def initialize: (Numeric x, Numeric y, Numeric width, Numeric height) -> void
13
+
14
+ def self.from_top_left_corner_coordinates: (Numeric x, Numeric y, Numeric width, Numeric height) -> Region?
15
+
16
+ def self.from_edge_coordinates: (Numeric left, Numeric `top`, Numeric right, Numeric bottom) -> Region?
17
+
18
+ def to_edge_coordinates: () -> ::Array[Numeric]
19
+
20
+ def to_top_left_corner_coordinates: () -> ::Array[Numeric]
21
+
22
+ def top: () -> Numeric
23
+
24
+ def bottom: () -> Numeric
25
+
26
+ def left: () -> Numeric
27
+
28
+ def right: () -> Numeric
29
+
30
+ def size: () -> Numeric
31
+
32
+ def to_a: () -> ::Array[Numeric]
33
+
34
+ def find_intersect_with: (Region region) -> Region?
35
+
36
+ def intersect?: (Region region) -> boolish
37
+
38
+ def move_by: (Numeric right_by, Numeric down_by) -> Region
39
+
40
+ def find_relative_intersect: (Region region) -> Region?
41
+
42
+ def cover?: (Numeric x, Numeric y) -> boolish
43
+ end
@@ -0,0 +1,60 @@
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
@@ -0,0 +1,48 @@
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
@@ -0,0 +1,29 @@
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
@@ -0,0 +1,39 @@
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
@@ -0,0 +1,17 @@
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
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.6.3
4
+ version: 1.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uwe Kubosch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-21 00:00:00.000000000 Z
11
+ date: 2023-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.2'
19
+ version: '6.1'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '8'
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '4.2'
29
+ version: '6.1'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '8'
@@ -71,40 +71,45 @@ executables: []
71
71
  extensions: []
72
72
  extra_rdoc_files: []
73
73
  files:
74
- - ".gitattributes"
75
- - ".github/workflows/lint.yml"
76
- - ".github/workflows/test.yml"
77
- - ".gitignore"
78
- - ".standard.yml"
79
- - CONTRIBUTING.md
80
- - Dockerfile
81
74
  - LICENSE.txt
82
- - README.md
83
75
  - Rakefile
84
- - bin/bundle
85
- - bin/console
86
- - bin/install-vips
87
- - bin/rake
88
- - bin/setup
89
- - bin/standardrb
90
76
  - capybara-screenshot-diff.gemspec
91
- - gemfiles/rails52.gemfile
92
- - gemfiles/rails60_gems.rb
93
- - gemfiles/rails61_gems.rb
94
- - gemfiles/rails70_gems.rb
95
77
  - gems.rb
96
78
  - lib/capybara-screenshot-diff.rb
97
79
  - lib/capybara/screenshot/diff.rb
80
+ - lib/capybara/screenshot/diff/browser_helpers.rb
81
+ - lib/capybara/screenshot/diff/cucumber.rb
82
+ - lib/capybara/screenshot/diff/difference.rb
83
+ - lib/capybara/screenshot/diff/drivers.rb
84
+ - lib/capybara/screenshot/diff/drivers/base_driver.rb
98
85
  - lib/capybara/screenshot/diff/drivers/chunky_png_driver.rb
99
86
  - lib/capybara/screenshot/diff/drivers/utils.rb
100
87
  - lib/capybara/screenshot/diff/drivers/vips_driver.rb
101
88
  - lib/capybara/screenshot/diff/image_compare.rb
102
89
  - lib/capybara/screenshot/diff/os.rb
90
+ - lib/capybara/screenshot/diff/region.rb
91
+ - lib/capybara/screenshot/diff/screenshot_matcher.rb
92
+ - lib/capybara/screenshot/diff/screenshoter.rb
103
93
  - lib/capybara/screenshot/diff/stabilization.rb
94
+ - lib/capybara/screenshot/diff/stable_screenshoter.rb
104
95
  - lib/capybara/screenshot/diff/test_methods.rb
105
96
  - lib/capybara/screenshot/diff/vcs.rb
106
97
  - lib/capybara/screenshot/diff/version.rb
107
- - tmp/.keep
98
+ - sig/capybara/screenshot/diff/diff.rbs
99
+ - sig/capybara/screenshot/diff/difference.rbs
100
+ - sig/capybara/screenshot/diff/drivers/base_driver.rbs
101
+ - sig/capybara/screenshot/diff/drivers/browser_helpers.rbs
102
+ - sig/capybara/screenshot/diff/drivers/chunky_png_driver.rbs
103
+ - sig/capybara/screenshot/diff/drivers/utils.rbs
104
+ - sig/capybara/screenshot/diff/drivers/vips_driver.rbs
105
+ - sig/capybara/screenshot/diff/image_compare.rbs
106
+ - sig/capybara/screenshot/diff/os.rbs
107
+ - sig/capybara/screenshot/diff/region.rbs
108
+ - sig/capybara/screenshot/diff/screenshot_matcher.rbs
109
+ - sig/capybara/screenshot/diff/screenshoter.rbs
110
+ - sig/capybara/screenshot/diff/stable_screenshoter.rbs
111
+ - sig/capybara/screenshot/diff/test_methods.rbs
112
+ - sig/capybara/screenshot/diff/vcs.rbs
108
113
  homepage: https://github.com/donv/capybara-screenshot-diff
109
114
  licenses:
110
115
  - MIT
@@ -118,14 +123,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
123
  requirements:
119
124
  - - ">="
120
125
  - !ruby/object:Gem::Version
121
- version: 2.5.0
126
+ version: 3.0.0
122
127
  required_rubygems_version: !ruby/object:Gem::Requirement
123
128
  requirements:
124
129
  - - ">="
125
130
  - !ruby/object:Gem::Version
126
131
  version: '0'
127
132
  requirements: []
128
- rubygems_version: 3.3.7
133
+ rubygems_version: 3.4.10
129
134
  signing_key:
130
135
  specification_version: 4
131
136
  summary: Track your GUI changes with diff assertions
data/.gitattributes DELETED
@@ -1,4 +0,0 @@
1
- *.gemspec diff=ruby
2
- *.rake diff=ruby
3
- *.rb diff=ruby
4
- *.md diff=md
@@ -1,25 +0,0 @@
1
- name: Ruby Linter
2
-
3
- on:
4
- pull_request:
5
- paths:
6
- - '*.rb'
7
- - '!bin/**'
8
-
9
- jobs:
10
- lint:
11
- name: Lint
12
- runs-on: ubuntu-latest
13
-
14
- steps:
15
- - name: Checkout code
16
- uses: actions/checkout@v2
17
-
18
- - name: Set up Ruby
19
- uses: ruby/setup-ruby@v1
20
- with:
21
- ruby-version: '3.1'
22
- bundler-cache: true
23
-
24
- - name: Run Standard Ruby linter
25
- run: bin/standardrb --no-fix --fail-fast
@@ -1,120 +0,0 @@
1
- name: Test
2
-
3
- on:
4
- push:
5
- branches: [ master ]
6
- pull_request:
7
- paths:
8
- - '**.rb'
9
- - '**.gemfile'
10
- - '!bin/**'
11
-
12
- env:
13
- BUNDLE_GEMFILE: 'gemfiles/rails70_gems.rb'
14
- FERRUM_PROCESS_TIMEOUT: '15'
15
- WD_CACHE_TIME: '864000' # 10 days
16
-
17
- jobs:
18
- test:
19
- name: Functional Testing
20
- runs-on: ubuntu-20.04 # In order to install libvips 8.9+ version
21
-
22
- steps:
23
- - name: Checkout code
24
- uses: actions/checkout@v2
25
-
26
- - name: Set up Ruby
27
- uses: ruby/setup-ruby@v1
28
- with:
29
- ruby-version: '3.0'
30
- bundler-cache: true
31
-
32
- - name: Install libvips
33
- run: sudo apt install libvips libvips-dev libvips-tools
34
-
35
- - name: Run Tests with coverage
36
- run: bundle exec rake test
37
- env:
38
- COVERAGE: enabled
39
-
40
- - name: Upload Screenshots
41
- if: ${{ always() }}
42
- uses: actions/upload-artifact@v2
43
- with:
44
- path: test/fixtures/app/doc/screenshots/
45
-
46
- - name: Upload Coverage
47
- uses: actions/upload-artifact@v2
48
- with:
49
- name: coverage
50
- path: coverage
51
-
52
- matrix:
53
- name: Test Integration Rails & Ruby
54
- needs: [ 'test' ]
55
- runs-on: ubuntu-20.04
56
-
57
- strategy:
58
- matrix:
59
- ruby-version: [ '3.1', '3.0', '2.7', '2.6', 'jruby' ]
60
- gemfile:
61
- - 'rails61_gems.rb'
62
- - 'rails60_gems.rb'
63
- - 'rails52.gemfile'
64
- include:
65
- - ruby-version: 2.7
66
- gemfile: rails70_gems.rb
67
- - ruby-version: 3.0
68
- gemfile: rails70_gems.rb
69
- - ruby-version: 3.1
70
- gemfile: rails70_gems.rb
71
- env:
72
- BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}
73
-
74
- steps:
75
- - name: Checkout code
76
- uses: actions/checkout@v2
77
-
78
- - name: Set up Ruby
79
- uses: ruby/setup-ruby@v1
80
- with:
81
- ruby-version: ${{ matrix.ruby-version }}
82
- bundler-cache: true
83
-
84
- - name: Install libvips
85
- run: sudo apt install libvips libvips-dev libvips-tools
86
-
87
- - name: Run tests
88
- run: bundle exec rake test
89
-
90
- matrix_screenshot_driver:
91
- name: Test Integration Capybara & Image Drivers
92
- needs: [ 'test' ]
93
- runs-on: ubuntu-20.04
94
-
95
- strategy:
96
- matrix:
97
- screenshot-driver: [ 'vips', 'chunky_png' ]
98
- capybara-driver: [ 'selenium_headless', 'selenium_chrome_headless' ]
99
- include:
100
- - screenshot-driver: 'chunky_png'
101
- capybara-driver: 'cuprite'
102
-
103
- steps:
104
- - name: Checkout code
105
- uses: actions/checkout@v2
106
-
107
- - name: Set up Ruby
108
- uses: ruby/setup-ruby@v1
109
- with:
110
- ruby-version: '3.1'
111
- bundler-cache: true
112
-
113
- - name: Install libvips
114
- run: sudo apt install libvips libvips-dev libvips-tools
115
-
116
- - name: Run tests
117
- run: bundle exec rake test:integration
118
- env:
119
- SCREENSHOT_DRIVER: ${{ matrix.screenshot-driver }}
120
- CAPYBARA_DRIVER: ${{ matrix.capybara-driver }}
data/.gitignore DELETED
@@ -1,12 +0,0 @@
1
- *~
2
- /.bundle/
3
- /.idea
4
- /.yardoc
5
- /_yardoc/
6
- /coverage/
7
- /doc/
8
- /gemfiles/*.lock
9
- /gems.locked
10
- /pkg/
11
- /spec/reports/
12
- /tmp/
data/.standard.yml DELETED
@@ -1,12 +0,0 @@
1
- fix: true # default: false
2
- parallel: true # default: false
3
- format: progress # default: Standard::Formatter
4
- ruby_version: 2.7 # default: RUBY_VERSION
5
- default_ignores: false # default: true
6
-
7
- ignore: # default: []
8
- - 'bin/**/*'
9
- - 'gemfiles/vendor/**/*'
10
- - 'gemfiles/**/*':
11
- - Security/Eval
12
- - 'vendor/**/*'
data/CONTRIBUTING.md DELETED
@@ -1,22 +0,0 @@
1
- Contributing
2
- ============
3
-
4
- Bug reports and pull requests are welcome on GitHub at https://github.com/donv/capybara-screenshot-diff.
5
- This project is intended to be a safe, welcoming space for collaboration, and contributors are expected
6
- to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
7
-
8
- ## Testing
9
-
10
- Run the tests before committing using Rake
11
-
12
- rake
13
-
14
- ### Matrix testing
15
-
16
- Run the tests for a matrix of configurations of Ruby implementations and Rails versions
17
-
18
- ./matrix_text.rb
19
-
20
- ## Merging to master
21
-
22
- Before merging to master, please have a member of the project review your changes, and make sure the tests are green in travis-ci.