capybara-screenshot-diff 1.10.3.1 → 1.12.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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +64 -0
  3. data/Rakefile +29 -1
  4. data/capybara-screenshot-diff.gemspec +4 -3
  5. data/docs/RELEASE_PREP.md +58 -0
  6. data/docs/UPGRADING.md +390 -0
  7. data/docs/ci-integration.md +208 -0
  8. data/docs/configuration.md +379 -0
  9. data/docs/docker-testing.md +24 -0
  10. data/docs/drivers.md +102 -0
  11. data/docs/framework-setup.md +87 -0
  12. data/docs/images/snap_diff_web_ui.png +0 -0
  13. data/docs/organization.md +226 -0
  14. data/docs/reporters.md +46 -0
  15. data/docs/thread_safety.md +97 -0
  16. data/gems.rb +2 -1
  17. data/lib/capybara/screenshot/diff/area_calculator.rb +1 -1
  18. data/lib/capybara/screenshot/diff/browser_helpers.rb +14 -1
  19. data/lib/capybara/screenshot/diff/comparison.rb +3 -0
  20. data/lib/capybara/screenshot/diff/difference.rb +40 -3
  21. data/lib/capybara/screenshot/diff/difference_finder.rb +97 -0
  22. data/lib/capybara/screenshot/diff/drivers/base_driver.rb +4 -0
  23. data/lib/capybara/screenshot/diff/drivers/chunky_png_driver.rb +22 -24
  24. data/lib/capybara/screenshot/diff/drivers/vips_driver.rb +40 -27
  25. data/lib/capybara/screenshot/diff/image_compare.rb +112 -123
  26. data/lib/capybara/screenshot/diff/image_preprocessor.rb +72 -0
  27. data/lib/capybara/screenshot/diff/reporters/default.rb +10 -11
  28. data/lib/capybara/screenshot/diff/screenshot_matcher.rb +63 -36
  29. data/lib/capybara/screenshot/diff/screenshoter.rb +9 -8
  30. data/lib/capybara/screenshot/diff/stable_screenshoter.rb +7 -9
  31. data/lib/capybara/screenshot/diff/vcs.rb +19 -52
  32. data/lib/capybara/screenshot/diff/version.rb +1 -1
  33. data/lib/capybara_screenshot_diff/backtrace_filter.rb +20 -0
  34. data/lib/capybara_screenshot_diff/cucumber.rb +2 -0
  35. data/lib/capybara_screenshot_diff/dsl.rb +102 -7
  36. data/lib/capybara_screenshot_diff/error_with_filtered_backtrace.rb +15 -0
  37. data/lib/capybara_screenshot_diff/minitest.rb +4 -2
  38. data/lib/capybara_screenshot_diff/reporters/html.rb +137 -0
  39. data/lib/capybara_screenshot_diff/reporters/templates/report.html.erb +463 -0
  40. data/lib/capybara_screenshot_diff/rspec.rb +12 -2
  41. data/lib/capybara_screenshot_diff/screenshot_assertion.rb +60 -22
  42. data/lib/capybara_screenshot_diff/screenshot_namer.rb +81 -0
  43. data/lib/capybara_screenshot_diff/snap.rb +14 -3
  44. data/lib/capybara_screenshot_diff/snap_manager.rb +10 -2
  45. data/lib/capybara_screenshot_diff/static.rb +11 -0
  46. data/lib/capybara_screenshot_diff.rb +30 -5
  47. metadata +47 -8
  48. data/lib/capybara/screenshot/diff/test_methods.rb +0 -157
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b731cca6ca98b0d7a9a6c1cb9db02de35b6898cecbb28aba568b8ae773ae0ff
4
- data.tar.gz: d42ae0a773e80fdd6aaf9ae7c6e2b5106131998c650338d24c20f9bc48d90602
3
+ metadata.gz: 163b89646e7610ebde81e77fb9f6ed8e81bb2fb74dce234846efcfbe9479ed2c
4
+ data.tar.gz: 30e46f9caecc9c705ed19309a246c7ea9353c179635e5be38be5513e187c5fc7
5
5
  SHA512:
6
- metadata.gz: 50bf2196f84506387c16aca897d98e9a5ea4ef9dc1b10216c2473566b001b362afffb1834a843cbdcf83bb35ca33713432dad86bf73cb0cb2a078e3cf2c89e68
7
- data.tar.gz: 69abf40070444fb6a3f2d2d250cb529cdcae957d3c6eefb55ff7e740964f5eae12556ab76b43ccdd9c4b0e14d00366997a7fe4032597bcf41b1a95aeb34471c9
6
+ metadata.gz: 7c58c2d084f4d052591d2f4bd1b4b983a9a933f5e4f4be8d1ef7683c8bc060ae9bf3d3deaaf381bb344ae6c21de723ee61e1fd54e30b825b5741b1f903509da2
7
+ data.tar.gz: e879a7f5f9bc06ca083157fc7cc24a08a38b5419ddfd6ab2e0ef63f5e4379ca6f9e864bb21f869f7d9617b3514ca691d4f3af090a00ec3cc4adec3de5215e095
data/CHANGELOG.md ADDED
@@ -0,0 +1,64 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [v1.12.0] - 2026-04-12
9
+
10
+ ### Added
11
+ - **HTML reporter** — interactive dashboard with 4 comparison modes (both/base/new/heatmap), per-image zoom, keyboard navigation, and search ([#170](https://github.com/snap-diff/snap_diff-capybara/pull/170))
12
+ - **GitHub Actions integration** — inline HTML preview with base64 embedded images + reusable composite action ([#171](https://github.com/snap-diff/snap_diff-capybara/pull/171))
13
+ - **`disable_animations` helper** — inject CSS to stop all animations/transitions during screenshots ([#174](https://github.com/snap-diff/snap_diff-capybara/pull/174))
14
+ - **`snap_diff:clean` rake task** — remove diff artifacts while keeping baselines ([#177](https://github.com/snap-diff/snap_diff-capybara/pull/177))
15
+ - `Diff.compare` for standalone image comparison without Capybara or browser
16
+ - Perceptual color distance (dE00) for anti-aliasing tolerance in VipsDriver
17
+ - `assert_no_screenshot_changes` DSL assertion
18
+ - `Diff.configure` block helper for simplified configuration
19
+ - Ruby 3.5 and 4.0 support
20
+
21
+ ### Changed
22
+ - `blur_active_element` now defaults to `true` — prevents cursor blinking artifacts
23
+ - `hide_caret` now defaults to `true` — stable screenshots without caret
24
+ - `fail_if_new` now defaults to `true` in CI (when `ENV['CI']` is set)
25
+ - Thread-safe reporter notification with mutex ([#175](https://github.com/snap-diff/snap_diff-capybara/pull/175))
26
+
27
+ ### Removed
28
+ - **SVN support** — Git only
29
+ - **ActiveSupport runtime dependency** — pure Ruby, lighter installations
30
+
31
+ ### Fixed
32
+ - VCS path resolution rewritten for thread safety (Open3 + array-form system)
33
+ - Reporter diff artifacts cleaned up properly on `Snap#delete!` ([#173](https://github.com/snap-diff/snap_diff-capybara/pull/173))
34
+ - RSpec matcher now provides `failure_message` and description
35
+ - Missing baseline error includes recording instructions
36
+ - Ruby 4.0 DSLStub ordering compatibility
37
+ - ChunkyPNG `filter_image_with_median` incorrect behavior
38
+ - Tolerance calculation no longer skips large changes
39
+
40
+ ### Performance
41
+ - ChunkyPNG shift-detection: eliminated array allocations (~30% faster for large images)
42
+ - VIPS: cached computations at construction (~15% faster)
43
+ - Memoized region area size, replaced closures with blocks
44
+
45
+ ### Documentation
46
+ - README restructured from 970 to 149 lines with 7 dedicated `docs/` files ([#171](https://github.com/snap-diff/snap_diff-capybara/pull/171))
47
+ - CI integration guide with artifact upload and PR commenting ([docs/ci-integration.md](docs/ci-integration.md))
48
+ - Upgrade guide ([docs/UPGRADING.md](docs/UPGRADING.md))
49
+ - Color comparison guide — tolerance vs perceptual_threshold vs color_distance_limit ([#176](https://github.com/snap-diff/snap_diff-capybara/pull/176))
50
+
51
+ ### Internal
52
+ - Simplified internals: inlined CaptureStrategy, ComparisonLoader, ScreenshotNamerDSL, VipsUtil
53
+ - Unified Screenshoter constructors, consolidated skip_area accessor
54
+ - Upgraded CI dependencies (actions/checkout v5, upload-artifact v7)
55
+
56
+ ---
57
+
58
+ ## [v1.11.0] - Previous Release
59
+
60
+ [Unreleased]: https://github.com/snap-diff/snap_diff-capybara/compare/v1.12.0...HEAD
61
+ [v1.12.0]: https://github.com/snap-diff/snap_diff-capybara/releases/tag/v1.12.0
62
+ [v1.11.0]: https://github.com/snap-diff/snap_diff-capybara/releases/tag/v1.11.0
63
+
64
+ **Upgrade Guide:** See [docs/UPGRADING.md](docs/UPGRADING.md) for detailed migration instructions.
data/Rakefile CHANGED
@@ -11,14 +11,42 @@ Rake::TestTask.new(:test) do |t|
11
11
  t.test_files = FileList["test/**/*_test.rb"]
12
12
  end
13
13
 
14
+ Rake::TestTask.new("test:unit") do |t|
15
+ t.libs << "test"
16
+ t.libs << "lib"
17
+ t.test_files = FileList["test/unit/**/*_test.rb"]
18
+ end
19
+
14
20
  Rake::TestTask.new("test:integration") do |t|
15
21
  t.libs << "test"
16
22
  t.libs << "lib"
17
23
  t.test_files = FileList["test/integration/**/*_test.rb"]
18
24
  end
19
25
 
26
+ desc "Run all tests with coverage"
27
+ task :coverage do
28
+ ENV["COVERAGE"] = "true"
29
+ Rake::Task["test"].invoke
30
+ end
31
+
32
+ desc "Generate sample HTML report. Use bin/rake 'report:sample[embed]' for base64 images"
33
+ task "report:sample", [:embed] do |_t, args|
34
+ embed_arg = args[:embed] ? "--embed" : ""
35
+ ruby "scripts/generate_sample_report.rb #{embed_arg}"
36
+ end
37
+
38
+ desc "Remove screenshot diff artifacts (keeps baselines)"
39
+ task "snap_diff:clean" do
40
+ patterns = ["**/*.diff.png", "**/*.base.png", "**/*.base.diff.png", "**/*.heatmap.diff.png",
41
+ "**/*.diff.webp", "**/*.base.webp", "**/*.base.diff.webp", "**/*.heatmap.diff.webp",
42
+ "**/snap_diff_report.html"]
43
+ removed = patterns.flat_map { |p| Dir.glob("tmp/#{p}") + Dir.glob("doc/screenshots/#{p}") }.uniq
44
+ removed.each { |f| FileUtils.rm_f(f) }
45
+ puts "Removed #{removed.size} diff artifacts"
46
+ end
47
+
20
48
  task "clobber" do
21
- puts "Cleanup tmp/*.png"
49
+ puts "Cleanup tmp/"
22
50
  FileUtils.rm_rf(Dir["./tmp/*"])
23
51
  end
24
52
 
@@ -11,8 +11,8 @@ Gem::Specification.new do |spec|
11
11
  spec.email = ["uwe@kubosch.no"]
12
12
  spec.summary = "Track your GUI changes with diff assertions"
13
13
  spec.description = "Save screen shots and track changes with graphical diff"
14
- spec.homepage = "https://github.com/donv/capybara-screenshot-diff"
15
- spec.required_ruby_version = ">= 3.1"
14
+ spec.homepage = "https://github.com/snap-diff/snap_diff-capybara"
15
+ spec.required_ruby_version = ">= 3.2"
16
16
  spec.license = "MIT"
17
17
  spec.metadata["allowed_push_host"] = "https://rubygems.org/"
18
18
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ["lib"]
25
25
 
26
- spec.add_runtime_dependency "actionpack", ">= 7.0", "< 9"
26
+ spec.add_development_dependency "actionpack", ">= 7.1", "< 9"
27
+ spec.add_development_dependency "activesupport", ">= 7.1", "< 9"
27
28
  spec.add_runtime_dependency "capybara", ">= 2", "< 4"
28
29
  end
@@ -0,0 +1,58 @@
1
+ # Release Preparation — v1.12.0
2
+
3
+ ## Summary
4
+
5
+ 71 commits since v1.11.0 with new features, performance improvements, and default behavior changes.
6
+
7
+ ## Release Checklist
8
+
9
+ ### Pre-Release
10
+
11
+ - [x] Update version to `1.12.0`
12
+ - [x] Run tests: `bundle exec rake test` (218 runs, 0 failures)
13
+ - [x] Add CHANGELOG.md
14
+ - [x] Add docs/UPGRADING.md
15
+
16
+ ### Release (One Click)
17
+
18
+ 1. Push to GitHub
19
+ 2. Go to [Actions → Release](https://github.com/snap-diff/snap_diff-capybara/actions/workflows/release.yml)
20
+ 3. Click **Run workflow**, enter `1.12.0`
21
+ 4. Workflow will: test → tag → publish to RubyGems → create GitHub Release
22
+
23
+ ### Post-Release
24
+
25
+ - [ ] Verify on [RubyGems](https://rubygems.org/gems/capybara-screenshot-diff)
26
+ - [ ] Verify GitHub Release created
27
+
28
+ ## What Changed
29
+
30
+ ### New Features
31
+ - HTML reporter with premium UI, 4 comparison modes, zoom, keyboard navigation
32
+ - GitHub Actions artifact integration with inline preview + reusable composite action
33
+ - `disable_animations` helper for stable screenshots
34
+ - `snap_diff:clean` rake task for diff artifact cleanup
35
+ - `Diff.compare` for standalone image comparison
36
+ - Perceptual color distance (dE00) for anti-aliasing
37
+ - `assert_no_screenshot_changes` DSL method
38
+ - `Diff.configure` block helper
39
+ - Ruby 3.5 & 4.0 support
40
+
41
+ ### Behavior Changes
42
+ - `blur_active_element` defaults to `true`
43
+ - `hide_caret` defaults to `true`
44
+ - `fail_if_new` defaults to `true` in CI
45
+ - Thread-safe reporter notification with mutex
46
+ - SVN support removed
47
+ - ActiveSupport no longer required
48
+
49
+ ### Performance
50
+ - Faster ChunkyPNG shift-detection (eliminated allocations)
51
+ - Cached computations in VIPS driver
52
+ - Memoized region area size
53
+
54
+ ### Documentation
55
+ - README restructured (970→149 lines) with 7 dedicated docs/ files
56
+ - CI integration guide, upgrade guide, color comparison guide
57
+
58
+ See [CHANGELOG.md](../CHANGELOG.md) for full details.
data/docs/UPGRADING.md ADDED
@@ -0,0 +1,390 @@
1
+ # Upgrading to v1.12.0
2
+
3
+ ## Overview
4
+
5
+ Version 1.12.0 is a **minor release** with new features, performance improvements, and default behavior changes. This guide will help you upgrade smoothly.
6
+
7
+ **Estimated upgrade time:** 5-15 minutes depending on your setup
8
+
9
+ ---
10
+
11
+ ## Quick Upgrade Path (Most Users)
12
+
13
+ For **most users**, upgrading is as simple as:
14
+
15
+ ```ruby
16
+ # In your Gemfile
17
+ gem 'capybara-screenshot-diff', '~> 1.12.0'
18
+ ```
19
+
20
+ ```bash
21
+ bundle update capybara-screenshot-diff
22
+ bundle exec rake test # Verify tests still pass
23
+ ```
24
+
25
+ **That's it!** The zero-config setup still works out of the box. Your existing screenshot comparisons will continue to work with v1.12.0.
26
+
27
+ ---
28
+
29
+ ## Breaking Changes & Migration Steps
30
+
31
+ ### 1. Default Behavior Changes (Most Important)
32
+
33
+ Three settings now have different defaults. This is the most likely source of unexpected test failures.
34
+
35
+ #### `blur_active_element` — Now defaults to `true`
36
+
37
+ **Before (v1.11.x):** Cursor blinking could delay screenshots
38
+ **After (v1.12.0):** Cursor is automatically hidden
39
+
40
+ **Action required:** Only if you want the old behavior
41
+
42
+ ```ruby
43
+ # To restore v1.x behavior:
44
+ Capybara::Screenshot.blur_active_element = false
45
+ ```
46
+
47
+ #### `hide_caret` — Now defaults to `true`
48
+
49
+ **Before (v1.11.x):** Input caret visible in screenshots
50
+ **After (v1.12.0):** Caret is transparent for stable screenshots
51
+
52
+ **Action required:** Only if you want the old behavior
53
+
54
+ ```ruby
55
+ # To restore v1.x behavior:
56
+ Capybara::Screenshot.hide_caret = false
57
+ ```
58
+
59
+ #### `fail_if_new` — Now defaults to `true` in CI
60
+
61
+ **Before (v1.11.x):** New screenshots allowed in CI
62
+ **After (v1.12.0):** New screenshots fail tests in CI (when `ENV['CI']` is set)
63
+
64
+ **Action required:** Only if you want to allow new screenshots in CI
65
+
66
+ ```ruby
67
+ # To allow new screenshots in CI:
68
+ Capybara::Screenshot::Diff.fail_if_new = false
69
+ ```
70
+
71
+ **Why this changed:** This prevents accidental baseline additions in CI pipelines. Most teams want this behavior.
72
+
73
+ ---
74
+
75
+ ### 2. SVN Support Removed
76
+
77
+ **Before (v1.11.x):** Could use SVN for version control
78
+ **After (v1.12.0):** Git only
79
+
80
+ **Action required:** If using SVN, migrate to Git
81
+
82
+ ```bash
83
+ # Check if you're using SVN for screenshots
84
+ git grep svn test/ # Look for svn commands in your tests
85
+ ```
86
+
87
+ If you find SVN usage:
88
+ 1. Export your SVN repository to Git
89
+ 2. Update your CI/CD to use Git
90
+ 3. Re-commit all screenshot baselines with Git
91
+
92
+ **Why this changed:** SVN support was rarely used and added maintenance burden.
93
+
94
+ ---
95
+
96
+ ### 3. ActiveSupport No Longer Required
97
+
98
+ **Before (v1.11.x):** ActiveSupport was a runtime dependency
99
+ **After (v1.12.0):** Pure Ruby, no ActiveSupport required
100
+
101
+ **Action required:** None (this is a positive change!)
102
+
103
+ If your project only had ActiveSupport because of this gem, you can now remove it:
104
+
105
+ ```ruby
106
+ # In your Gemfile — can likely be removed if only used for this gem
107
+ # gem 'activesupport' # ← Remove if not used elsewhere
108
+ ```
109
+
110
+ **Why this changed:** Lighter installations, faster boot times.
111
+
112
+ ---
113
+
114
+ ### 4. Internal API Changes
115
+
116
+ **Before (v1.11.x):** Could use internal classes like `CaptureStrategy`, `ComparisonLoader`
117
+ **After (v1.12.0):** These have been inlined/refactored
118
+
119
+ **Action required:** Only if using internal APIs
120
+
121
+ Check your codebase:
122
+
123
+ ```bash
124
+ # Search for internal API usage
125
+ grep -r "CaptureStrategy" test/ lib/
126
+ grep -r "ComparisonLoader" test/ lib/
127
+ grep -r "ScreenshotCoordinator" test/ lib/
128
+ grep -r "ImagePreprocessor" test/ lib/
129
+ ```
130
+
131
+ If you find usage, these were never part of the public API and should be replaced with the documented public API.
132
+
133
+ **Why this changed:** Simplified architecture, better performance, easier maintenance.
134
+
135
+ ---
136
+
137
+ ## New Features to Try
138
+
139
+ ### HTML Reporter (Recommended)
140
+
141
+ Get an interactive dashboard showing all screenshot differences:
142
+
143
+ ```ruby
144
+ # Add to test_helper.rb or spec_helper.rb
145
+ require 'capybara_screenshot_diff/reporters/html'
146
+ ```
147
+
148
+ After running tests:
149
+
150
+ ```bash
151
+ open doc/screenshots/snap_diff_report.html
152
+ ```
153
+
154
+ **Features:**
155
+ - Side-by-side comparison with diff toggle
156
+ - Thumbnail sidebar for navigation
157
+ - Search functionality
158
+ - Summary statistics
159
+
160
+ ---
161
+
162
+ ### Standalone Image Comparison
163
+
164
+ Compare any two images without Capybara or a browser:
165
+
166
+ ```ruby
167
+ result = Capybara::Screenshot::Diff.compare("baseline.png", "current.png")
168
+ result.quick_equal? # => true if byte-identical
169
+ result.different? # => true if visually different
170
+ ```
171
+
172
+ **Use cases:**
173
+ - PDF regression testing
174
+ - Generated image validation
175
+ - CI artifact verification
176
+
177
+ ---
178
+
179
+ ### Perceptual Color Distance (Anti-aliasing Fix)
180
+
181
+ Eliminate false positives from font rendering differences:
182
+
183
+ ```ruby
184
+ # Global configuration
185
+ Capybara::Screenshot::Diff.perceptual_threshold = 2.0
186
+
187
+ # Or per-screenshot
188
+ screenshot 'dashboard', perceptual_threshold: 2.0
189
+ ```
190
+
191
+ **dE00 Scale Reference:**
192
+ - `< 1.0` — Not perceptible by human eyes
193
+ - `1-2` — Perceptible through close observation (anti-aliasing, font hinting)
194
+ - `2-10` — Perceptible at a glance (color shifts, layout changes)
195
+ - `> 10` — Clearly different colors
196
+
197
+ **Why use this:** If you see false positives from font rendering differences across CI environments.
198
+
199
+ ---
200
+
201
+ ### `assert_no_screenshot_changes`
202
+
203
+ Assert that an action produces no visual change:
204
+
205
+ ```ruby
206
+ test "clicking cancel doesn't change page" do
207
+ visit '/edit'
208
+ screenshot 'before_cancel'
209
+
210
+ click_button 'Cancel'
211
+
212
+ assert_no_screenshot_changes 'after_cancel'
213
+ end
214
+ ```
215
+
216
+ ---
217
+
218
+ ### Simplified Configuration
219
+
220
+ Use the new `Diff.configure` block:
221
+
222
+ ```ruby
223
+ # In test_helper.rb — one line, that's it
224
+ Capybara::Screenshot::Diff.configure do |screenshot, diff|
225
+ screenshot.window_size = [1280, 1024]
226
+ screenshot.stability_time_limit = 1
227
+ diff.driver = :vips
228
+ diff.tolerance = 0.0005
229
+ end
230
+ ```
231
+
232
+ ---
233
+
234
+ ## Performance Improvements
235
+
236
+ Enjoy faster screenshot comparisons:
237
+
238
+ - **ChunkyPNG:** Eliminated array allocations in shift-detection (~30% faster for large images)
239
+ - **VIPS:** Cached computations at construction (~15% faster)
240
+ - **General:** Memoized region area size, replaced closures with blocks
241
+
242
+ **No action required** — these are automatic improvements.
243
+
244
+ ---
245
+
246
+ ## Ruby & Rails Compatibility
247
+
248
+ ### Supported Versions
249
+
250
+ - **Ruby:** 3.2, 3.3, 3.4, 3.5 (new!), 4.0 (new!)
251
+ - **Rails:** 7.1, 7.2, 8.0
252
+
253
+ ### Upgrade Notes
254
+
255
+ **Ruby 4.0:** Fully compatible! If you see DSLStub ordering issues, they're fixed in v1.12.0.
256
+
257
+ **Rails 8.0:** Works out of the box with updated dependencies.
258
+
259
+ ---
260
+
261
+ ## Testing Your Upgrade
262
+
263
+ ### Step 1: Update Gemfile
264
+
265
+ ```ruby
266
+ gem 'capybara-screenshot-diff', '~> 1.12.0'
267
+ ```
268
+
269
+ ### Step 2: Bundle Update
270
+
271
+ ```bash
272
+ bundle update capybara-screenshot-diff
273
+ ```
274
+
275
+ ### Step 3: Run Tests
276
+
277
+ ```bash
278
+ bundle exec rake test
279
+ ```
280
+
281
+ ### Step 4: Check for New Screenshot Failures
282
+
283
+ If tests fail with new screenshot errors in CI:
284
+
285
+ 1. **Option A:** Commit the new baselines (recommended if changes are intentional)
286
+ 2. **Option B:** Set `fail_if_new = false` temporarily (not recommended long-term)
287
+
288
+ ### Step 5: Enable HTML Reporter (Optional)
289
+
290
+ ```ruby
291
+ require 'capybara_screenshot_diff/reporters/html'
292
+ ```
293
+
294
+ Run tests and open `doc/screenshots/snap_diff_report.html` to review differences.
295
+
296
+ ---
297
+
298
+ ## Troubleshooting
299
+
300
+ ### "Tests fail with new screenshots in CI"
301
+
302
+ **Cause:** `fail_if_new` now defaults to `true` in CI
303
+
304
+ **Solution:**
305
+
306
+ ```bash
307
+ # Commit the new baselines
308
+ git add doc/screenshots/
309
+ git commit -m "Add screenshot baselines for v1.12.0 upgrade"
310
+ ```
311
+
312
+ Or temporarily allow them:
313
+
314
+ ```ruby
315
+ Capybara::Screenshot::Diff.fail_if_new = false
316
+ ```
317
+
318
+ ### "Screenshots look different after upgrade"
319
+
320
+ **Cause:** `blur_active_element` and `hide_caret` now default to `true`
321
+
322
+ **Solution:** Restore v1.x behavior temporarily:
323
+
324
+ ```ruby
325
+ Capybara::Screenshot.blur_active_element = false
326
+ Capybara::Screenshot.hide_caret = false
327
+ ```
328
+
329
+ Then re-record baselines with the new defaults (recommended):
330
+
331
+ ```bash
332
+ # Delete old baselines
333
+ rm doc/screenshots/*.png
334
+
335
+ # Run tests to generate new baselines
336
+ bundle exec rake test
337
+
338
+ # Commit new baselines
339
+ git add doc/screenshots/
340
+ git commit -m "Re-record baselines with v1.12.0 defaults"
341
+ ```
342
+
343
+ ### "NoMethodError on internal class"
344
+
345
+ **Cause:** Using internal APIs that were refactored
346
+
347
+ **Solution:** Use the public API instead. Check the documentation for the correct interface.
348
+
349
+ ---
350
+
351
+ ## Rollback Plan
352
+
353
+ If you need to rollback:
354
+
355
+ ```ruby
356
+ # Pin to previous version
357
+ gem 'capybara-screenshot-diff', '~> 1.12.0'
358
+ ```
359
+
360
+ ```bash
361
+ bundle update capybara-screenshot-diff
362
+ ```
363
+
364
+ All screenshot baselines are compatible — no data loss.
365
+
366
+ ---
367
+
368
+ ## Need Help?
369
+
370
+ - **Documentation:** [README.md](README.md)
371
+ - **Changelog:** [CHANGELOG.md](CHANGELOG.md)
372
+ - **Issues:** [GitHub Issues](https://github.com/snap-diff/snap_diff-capybara/issues)
373
+ - **DeepWiki:** [Code Documentation](https://deepwiki.com/snap-diff/snap_diff-capybara)
374
+
375
+ ---
376
+
377
+ ## Summary Checklist
378
+
379
+ - [ ] Update gem version to `~> 1.12.0`
380
+ - [ ] Run `bundle update capybara-screenshot-diff`
381
+ - [ ] Run test suite
382
+ - [ ] Check for new screenshot failures in CI
383
+ - [ ] Decide on `fail_if_new` behavior
384
+ - [ ] Decide on `blur_active_element` and `hide_caret` defaults
385
+ - [ ] Enable HTML reporter (optional)
386
+ - [ ] Re-record baselines if needed
387
+ - [ ] Commit changes
388
+ - [ ] Review upgrade issues in [GitHub Issues](https://github.com/snap-diff/snap_diff-capybara/issues)
389
+
390
+ **Congratulations!** You're now running v1.12.0 🎉