capybara-screenshot-diff 1.7.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +29 -0
  3. data/capybara-screenshot-diff.gemspec +7 -4
  4. data/gems.rb +8 -2
  5. data/lib/capybara/screenshot/diff/browser_helpers.rb +29 -28
  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 +188 -260
  10. data/lib/capybara/screenshot/diff/drivers/utils.rb +16 -0
  11. data/lib/capybara/screenshot/diff/drivers/vips_driver.rb +53 -103
  12. data/lib/capybara/screenshot/diff/drivers.rb +16 -0
  13. data/lib/capybara/screenshot/diff/image_compare.rb +125 -154
  14. data/lib/capybara/screenshot/diff/os.rb +1 -1
  15. data/lib/capybara/screenshot/diff/screenshot_matcher.rb +128 -0
  16. data/lib/capybara/screenshot/diff/screenshoter.rb +137 -0
  17. data/lib/capybara/screenshot/diff/stabilization.rb +0 -184
  18. data/lib/capybara/screenshot/diff/stable_screenshoter.rb +106 -0
  19. data/lib/capybara/screenshot/diff/test_methods.rb +51 -90
  20. data/lib/capybara/screenshot/diff/vcs.rb +44 -22
  21. data/lib/capybara/screenshot/diff/version.rb +1 -1
  22. data/lib/capybara/screenshot/diff.rb +13 -17
  23. data/sig/capybara/screenshot/diff/diff.rbs +28 -0
  24. data/sig/capybara/screenshot/diff/difference.rbs +33 -0
  25. data/sig/capybara/screenshot/diff/drivers/base_driver.rbs +63 -0
  26. data/sig/capybara/screenshot/diff/drivers/browser_helpers.rbs +36 -0
  27. data/sig/capybara/screenshot/diff/drivers/chunky_png_driver.rbs +89 -0
  28. data/sig/capybara/screenshot/diff/drivers/utils.rbs +13 -0
  29. data/sig/capybara/screenshot/diff/drivers/vips_driver.rbs +25 -0
  30. data/sig/capybara/screenshot/diff/image_compare.rbs +93 -0
  31. data/sig/capybara/screenshot/diff/os.rbs +11 -0
  32. data/sig/capybara/screenshot/diff/region.rbs +43 -0
  33. data/sig/capybara/screenshot/diff/screenshot_matcher.rbs +60 -0
  34. data/sig/capybara/screenshot/diff/screenshoter.rbs +48 -0
  35. data/sig/capybara/screenshot/diff/stable_screenshoter.rbs +29 -0
  36. data/sig/capybara/screenshot/diff/test_methods.rbs +39 -0
  37. data/sig/capybara/screenshot/diff/vcs.rbs +17 -0
  38. metadata +36 -27
  39. data/.gitattributes +0 -4
  40. data/.github/dependabot.yml +0 -8
  41. data/.github/workflows/lint.yml +0 -25
  42. data/.github/workflows/test.yml +0 -138
  43. data/.gitignore +0 -14
  44. data/.standard.yml +0 -12
  45. data/CONTRIBUTING.md +0 -24
  46. data/Dockerfile +0 -59
  47. data/README.md +0 -567
  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/rails60_gems.rb +0 -8
  55. data/gemfiles/rails61_gems.rb +0 -7
  56. data/gemfiles/rails70_gems.rb +0 -7
  57. 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 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.7.0
4
+ version: 1.8.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: 2022-09-27 00:00:00.000000000 Z
11
+ date: 2023-09-13 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: '6.0'
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: '6.0'
29
+ version: '6.1'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '8'
@@ -54,16 +54,22 @@ dependencies:
54
54
  name: chunky_png
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - "~>"
57
+ - - ">="
58
58
  - !ruby/object:Gem::Version
59
59
  version: '1.3'
60
+ - - "<"
61
+ - !ruby/object:Gem::Version
62
+ version: '2'
60
63
  type: :runtime
61
64
  prerelease: false
62
65
  version_requirements: !ruby/object:Gem::Requirement
63
66
  requirements:
64
- - - "~>"
67
+ - - ">="
65
68
  - !ruby/object:Gem::Version
66
69
  version: '1.3'
70
+ - - "<"
71
+ - !ruby/object:Gem::Version
72
+ version: '2'
67
73
  description: Save screen shots and track changes with graphical diff
68
74
  email:
69
75
  - uwe@kubosch.no
@@ -71,42 +77,45 @@ executables: []
71
77
  extensions: []
72
78
  extra_rdoc_files: []
73
79
  files:
74
- - ".gitattributes"
75
- - ".github/dependabot.yml"
76
- - ".github/workflows/lint.yml"
77
- - ".github/workflows/test.yml"
78
- - ".gitignore"
79
- - ".standard.yml"
80
- - CONTRIBUTING.md
81
- - Dockerfile
82
80
  - LICENSE.txt
83
- - README.md
84
81
  - Rakefile
85
- - bin/bundle
86
- - bin/console
87
- - bin/install-vips
88
- - bin/rake
89
- - bin/setup
90
- - bin/standardrb
91
82
  - capybara-screenshot-diff.gemspec
92
- - gemfiles/rails60_gems.rb
93
- - gemfiles/rails61_gems.rb
94
- - gemfiles/rails70_gems.rb
95
83
  - gems.rb
96
84
  - lib/capybara-screenshot-diff.rb
97
85
  - lib/capybara/screenshot/diff.rb
98
86
  - lib/capybara/screenshot/diff/browser_helpers.rb
87
+ - lib/capybara/screenshot/diff/cucumber.rb
88
+ - lib/capybara/screenshot/diff/difference.rb
89
+ - lib/capybara/screenshot/diff/drivers.rb
90
+ - lib/capybara/screenshot/diff/drivers/base_driver.rb
99
91
  - lib/capybara/screenshot/diff/drivers/chunky_png_driver.rb
100
92
  - lib/capybara/screenshot/diff/drivers/utils.rb
101
93
  - lib/capybara/screenshot/diff/drivers/vips_driver.rb
102
94
  - lib/capybara/screenshot/diff/image_compare.rb
103
95
  - lib/capybara/screenshot/diff/os.rb
104
96
  - lib/capybara/screenshot/diff/region.rb
97
+ - lib/capybara/screenshot/diff/screenshot_matcher.rb
98
+ - lib/capybara/screenshot/diff/screenshoter.rb
105
99
  - lib/capybara/screenshot/diff/stabilization.rb
100
+ - lib/capybara/screenshot/diff/stable_screenshoter.rb
106
101
  - lib/capybara/screenshot/diff/test_methods.rb
107
102
  - lib/capybara/screenshot/diff/vcs.rb
108
103
  - lib/capybara/screenshot/diff/version.rb
109
- - tmp/.keep
104
+ - sig/capybara/screenshot/diff/diff.rbs
105
+ - sig/capybara/screenshot/diff/difference.rbs
106
+ - sig/capybara/screenshot/diff/drivers/base_driver.rbs
107
+ - sig/capybara/screenshot/diff/drivers/browser_helpers.rbs
108
+ - sig/capybara/screenshot/diff/drivers/chunky_png_driver.rbs
109
+ - sig/capybara/screenshot/diff/drivers/utils.rbs
110
+ - sig/capybara/screenshot/diff/drivers/vips_driver.rbs
111
+ - sig/capybara/screenshot/diff/image_compare.rbs
112
+ - sig/capybara/screenshot/diff/os.rbs
113
+ - sig/capybara/screenshot/diff/region.rbs
114
+ - sig/capybara/screenshot/diff/screenshot_matcher.rbs
115
+ - sig/capybara/screenshot/diff/screenshoter.rbs
116
+ - sig/capybara/screenshot/diff/stable_screenshoter.rbs
117
+ - sig/capybara/screenshot/diff/test_methods.rbs
118
+ - sig/capybara/screenshot/diff/vcs.rbs
110
119
  homepage: https://github.com/donv/capybara-screenshot-diff
111
120
  licenses:
112
121
  - MIT
@@ -120,14 +129,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
120
129
  requirements:
121
130
  - - ">="
122
131
  - !ruby/object:Gem::Version
123
- version: 2.7.0
132
+ version: 3.0.0
124
133
  required_rubygems_version: !ruby/object:Gem::Requirement
125
134
  requirements:
126
135
  - - ">="
127
136
  - !ruby/object:Gem::Version
128
137
  version: '0'
129
138
  requirements: []
130
- rubygems_version: 3.3.7
139
+ rubygems_version: 3.4.10
131
140
  signing_key:
132
141
  specification_version: 4
133
142
  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,8 +0,0 @@
1
- ---
2
- version: 2
3
-
4
- updates:
5
- - package-ecosystem: "github-actions"
6
- directory: "/"
7
- schedule:
8
- interval: "weekly"
@@ -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@v3
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,138 +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
- concurrency:
18
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
19
- cancel-in-progress: true
20
-
21
- jobs:
22
- test:
23
- name: Functional Testing
24
- runs-on: ubuntu-22.04 # In order to install libvips 8.9+ version
25
- timeout-minutes: 5
26
-
27
- steps:
28
- - name: Checkout code
29
- uses: actions/checkout@v3
30
-
31
- - name: Set up Ruby
32
- uses: ruby/setup-ruby@v1
33
- with:
34
- ruby-version: '3.1'
35
- bundler-cache: true
36
-
37
- - name: Install libvips
38
- run: sudo apt install libvips libvips-dev libvips-tools
39
-
40
- - name: Run Tests with coverage
41
- run: bundle exec rake test
42
- env:
43
- COVERAGE: enabled
44
-
45
- - name: Upload Screenshots
46
- if: always()
47
- uses: actions/upload-artifact@v3
48
- with:
49
- name: screenshots
50
- retention-days: 1
51
- path: |
52
- test/fixtures/app/doc/screenshots/
53
- tmp/capybara/screenshots-diffs/
54
-
55
- - name: Upload Coverage
56
- uses: actions/upload-artifact@v3
57
- with:
58
- name: coverage
59
- retention-days: 1
60
- path: coverage
61
-
62
- matrix:
63
- name: Test Integration Rails & Ruby
64
- needs: [ 'test' ]
65
- runs-on: ubuntu-20.04
66
- timeout-minutes: 5
67
-
68
- strategy:
69
- matrix:
70
- ruby-version: [ '3.1', '3.0', '2.7', 'jruby' ]
71
- gemfile:
72
- - 'rails70_gems.rb'
73
- - 'rails61_gems.rb'
74
- - 'rails60_gems.rb'
75
- exclude:
76
- - ruby-version: 'jruby'
77
- gemfile: 'rails70_gems.rb'
78
- env:
79
- BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}
80
-
81
- steps:
82
- - name: Checkout code
83
- uses: actions/checkout@v3
84
-
85
- - name: Set up Ruby
86
- uses: ruby/setup-ruby@v1
87
- with:
88
- ruby-version: ${{ matrix.ruby-version }}
89
- bundler-cache: true
90
-
91
- - name: Install libvips
92
- run: sudo apt install libvips libvips-dev libvips-tools
93
-
94
- - name: Run tests
95
- run: bundle exec rake test
96
-
97
- matrix_screenshot_driver:
98
- name: Test Integration Capybara & Image Drivers
99
- needs: [ 'test' ]
100
- runs-on: ubuntu-20.04
101
- timeout-minutes: 5
102
-
103
- strategy:
104
- matrix:
105
- screenshot-driver: [ 'vips', 'chunky_png' ]
106
- capybara-driver: [ 'selenium_headless', 'selenium_chrome_headless' ]
107
- include:
108
- - screenshot-driver: 'chunky_png'
109
- capybara-driver: 'cuprite'
110
-
111
- steps:
112
- - name: Checkout code
113
- uses: actions/checkout@v3
114
-
115
- - name: Set up Ruby
116
- uses: ruby/setup-ruby@v1
117
- with:
118
- ruby-version: '3.1'
119
- bundler-cache: true
120
-
121
- - name: Install libvips
122
- run: sudo apt install libvips libvips-dev libvips-tools
123
-
124
- - name: Run tests
125
- run: bundle exec rake test:integration
126
- env:
127
- SCREENSHOT_DRIVER: ${{ matrix.screenshot-driver }}
128
- CAPYBARA_DRIVER: ${{ matrix.capybara-driver }}
129
-
130
- - name: Upload Screenshots
131
- uses: actions/upload-artifact@v3
132
- if: failure()
133
- with:
134
- name: screenshots-${{ matrix.screenshot-driver }}-${{ matrix.capybara-driver }}
135
- retention-days: 1
136
- path: |
137
- test/fixtures/app/doc/screenshots/
138
- tmp/capybara/screenshots-diffs/
data/.gitignore DELETED
@@ -1,14 +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/
13
- /test/fixtures/**/*.committed.png
14
- /test/fixtures/**/*.latest.png