snap_diff-capybara 0.0.1 → 2.0.0.beta1

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 (95) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +190 -0
  3. data/CODE_OF_CONDUCT.md +129 -0
  4. data/LICENSE.txt +21 -0
  5. data/Rakefile +65 -0
  6. data/capybara-screenshot-diff.gemspec +29 -0
  7. data/docs/RELEASE_PREP.md +44 -0
  8. data/docs/UPGRADING.md +702 -0
  9. data/docs/architecture.md +289 -0
  10. data/docs/ci-integration.md +238 -0
  11. data/docs/configuration.md +395 -0
  12. data/docs/docker-testing.md +24 -0
  13. data/docs/drivers.md +102 -0
  14. data/docs/framework-setup.md +87 -0
  15. data/docs/images/snap_diff_annotated.png +0 -0
  16. data/docs/images/snap_diff_web_ui.png +0 -0
  17. data/docs/migration-guide.md +286 -0
  18. data/docs/organization.md +204 -0
  19. data/docs/reporters.md +46 -0
  20. data/docs/thread_safety.md +112 -0
  21. data/gems.rb +39 -0
  22. data/lib/capybara/screenshot/diff/annotation_service.rb +7 -0
  23. data/lib/capybara/screenshot/diff/area_calculator.rb +7 -0
  24. data/lib/capybara/screenshot/diff/browser_helpers.rb +7 -0
  25. data/lib/capybara/screenshot/diff/config_legacy.rb +113 -0
  26. data/lib/capybara/screenshot/diff/cucumber.rb +3 -0
  27. data/lib/capybara/screenshot/diff/difference.rb +8 -0
  28. data/lib/capybara/screenshot/diff/drivers/base_driver.rb +9 -0
  29. data/lib/capybara/screenshot/diff/drivers/chunky_png_driver.rb +7 -0
  30. data/lib/capybara/screenshot/diff/drivers/vips_driver.rb +7 -0
  31. data/lib/capybara/screenshot/diff/drivers.rb +9 -0
  32. data/lib/capybara/screenshot/diff/image_compare.rb +12 -0
  33. data/lib/capybara/screenshot/diff/image_preprocessor.rb +7 -0
  34. data/lib/capybara/screenshot/diff/os.rb +14 -0
  35. data/lib/capybara/screenshot/diff/region.rb +107 -0
  36. data/lib/capybara/screenshot/diff/reporters/default.rb +109 -0
  37. data/lib/capybara/screenshot/diff/screenshot_matcher.rb +7 -0
  38. data/lib/capybara/screenshot/diff/screenshoter.rb +7 -0
  39. data/lib/capybara/screenshot/diff/stable_screenshoter.rb +7 -0
  40. data/lib/capybara/screenshot/diff/utils.rb +7 -0
  41. data/lib/capybara/screenshot/diff/vcs.rb +7 -0
  42. data/lib/capybara/screenshot/diff/version.rb +15 -0
  43. data/lib/capybara/screenshot/diff.rb +3 -0
  44. data/lib/capybara-screenshot-diff.rb +3 -0
  45. data/lib/capybara_screenshot_diff/attempts_reporter.rb +7 -0
  46. data/lib/capybara_screenshot_diff/cucumber.rb +8 -0
  47. data/lib/capybara_screenshot_diff/dsl.rb +12 -0
  48. data/lib/capybara_screenshot_diff/error_with_filtered_backtrace.rb +8 -0
  49. data/lib/capybara_screenshot_diff/minitest.rb +14 -0
  50. data/lib/capybara_screenshot_diff/reporters/html.rb +7 -0
  51. data/lib/capybara_screenshot_diff/rspec.rb +8 -0
  52. data/lib/capybara_screenshot_diff/screenshot_assertion.rb +71 -0
  53. data/lib/capybara_screenshot_diff/screenshot_namer.rb +7 -0
  54. data/lib/capybara_screenshot_diff/snap.rb +7 -0
  55. data/lib/capybara_screenshot_diff/snap_manager.rb +7 -0
  56. data/lib/capybara_screenshot_diff/static.rb +9 -0
  57. data/lib/capybara_screenshot_diff.rb +50 -0
  58. data/lib/snap_diff/annotation_service.rb +84 -0
  59. data/lib/snap_diff/area_calculator.rb +56 -0
  60. data/lib/snap_diff/attempts_reporter.rb +51 -0
  61. data/lib/snap_diff/browser_helpers.rb +121 -0
  62. data/lib/snap_diff/capture/viewport.rb +40 -0
  63. data/lib/snap_diff/comparison.rb +238 -0
  64. data/lib/snap_diff/comparison_result.rb +104 -0
  65. data/lib/snap_diff/config.rb +78 -0
  66. data/lib/snap_diff/deprecation.rb +84 -0
  67. data/lib/snap_diff/driver.rb +37 -0
  68. data/lib/snap_diff/drivers/chunky_png_driver.rb +298 -0
  69. data/lib/snap_diff/drivers/vips_driver.rb +171 -0
  70. data/lib/snap_diff/drivers.rb +14 -0
  71. data/lib/snap_diff/dsl.rb +143 -0
  72. data/lib/snap_diff/error_with_filtered_backtrace.rb +32 -0
  73. data/lib/snap_diff/image_preprocessor.rb +68 -0
  74. data/lib/snap_diff/integrations/cucumber.rb +22 -0
  75. data/lib/snap_diff/integrations/minitest.rb +70 -0
  76. data/lib/snap_diff/integrations/rspec.rb +68 -0
  77. data/lib/snap_diff/legacy_shims.rb +99 -0
  78. data/lib/snap_diff/os.rb +17 -0
  79. data/lib/snap_diff/reporters/html.rb +143 -0
  80. data/lib/snap_diff/reporters/templates/report.html.erb +463 -0
  81. data/lib/snap_diff/reporting.rb +53 -0
  82. data/lib/snap_diff/screenshot_assertion.rb +143 -0
  83. data/lib/snap_diff/screenshot_matcher.rb +113 -0
  84. data/lib/snap_diff/screenshot_namer.rb +81 -0
  85. data/lib/snap_diff/screenshoter.rb +129 -0
  86. data/lib/snap_diff/snap.rb +66 -0
  87. data/lib/snap_diff/snap_manager.rb +125 -0
  88. data/lib/snap_diff/stable_screenshoter.rb +103 -0
  89. data/lib/snap_diff/static.rb +11 -0
  90. data/lib/snap_diff/utils.rb +38 -0
  91. data/lib/snap_diff/vcs.rb +35 -0
  92. data/lib/snap_diff/version.rb +5 -0
  93. data/lib/snap_diff.rb +65 -0
  94. metadata +160 -10
  95. data/README.md +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b0ed0acab1f365fa867a736a6e191af5994ed247b89347d3139c52d2e6e0c2b
4
- data.tar.gz: be3f02855e30d530d5afc801ad73c13424c0283dc77955fc9e5be53edb2c077b
3
+ metadata.gz: a063da3ec86978a0e66baaa0c64692c40f18db15ce66b40cab390df9a90be5a1
4
+ data.tar.gz: c34b6fe46a10353ed94d738832cd9dafca06ef0f7a53b2c678408010198f58d2
5
5
  SHA512:
6
- metadata.gz: 0a5453eb7eb3a1f45a4c86d125ee6ccc9098ff84d75ec61197d54eceab335a75a265982601bd4b730aa6dbf8e5df351c3efb2809e7de4c36cd775c3ba0e41cc0
7
- data.tar.gz: 3aa51d497d6195a33d5d36d3c15fd20e8f89083c0c353c9b9e150614af1d4003bb435fac42a624b93e7338271bd68eaf892e0889910dfb7acb34dca7e63820ef
6
+ metadata.gz: '0828945cb79fbf911727deeac0b4cf868f34b5787c37720bc216a6d893115a2d9486a43284cf3f3467834951d1ae438f969a7ea5e1dcdd8ae387fb2cf9f263b9'
7
+ data.tar.gz: 3fc96895702aac83fa636bf8cfd1ac73953b4049b2629104ccbde592af150f3829c3eda7e73e8912b0342793cbf3e45d07056ffffb68c4f3b5594758406cd932
data/CHANGELOG.md ADDED
@@ -0,0 +1,190 @@
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
+ ## [v2.0.0.beta1] - 2026-08-22
9
+
10
+ Second prerelease of the 2.0 opt-in experiment (see the v2.0.0.alpha1 notes
11
+ below for the namespace change, deprecation warnings, and caveats). Final
12
+ 2.0.0 remains gated on adopter feedback — [#166](https://github.com/snap-diff/snap_diff-capybara/issues/166).
13
+
14
+ ### Added
15
+ - **Dual gem names** — releases now also publish as
16
+ [`snap_diff-capybara`](https://rubygems.org/gems/snap_diff-capybara):
17
+ identical content and versions under the forward-looking name matching this
18
+ repository (the alpha1 mirror was backfilled). Install either, not both.
19
+ - **Migration guide** — [docs/UPGRADING.md](docs/UPGRADING.md) covers the v2
20
+ namespace move, every renamed constant, silencing, and the alpha caveats
21
+ ([#220](https://github.com/snap-diff/snap_diff-capybara/pull/220))
22
+
23
+ ### Internal
24
+ - Test suite exercises the canonical `SnapDiff` names; legacy names remain
25
+ covered by dedicated forwarding/deprecation tests, and a strict warning
26
+ guard now fails the suite on any accidental legacy-name use
27
+ ([#221](https://github.com/snap-diff/snap_diff-capybara/pull/221))
28
+
29
+ ---
30
+
31
+ ## [v2.0.0.alpha1] - 2026-08-22
32
+
33
+ **Opt-in experiment prerelease.** RubyGems never installs prereleases by default
34
+ resolution — to try it: `gem "capybara-screenshot-diff", "2.0.0.alpha1"`. The
35
+ final 2.0.0 ships only after adopter feedback on this train; please report
36
+ anything surprising on [#166](https://github.com/snap-diff/snap_diff-capybara/issues/166).
37
+
38
+ ### Changed
39
+ - **`SnapDiff` is the canonical namespace.** The implementation lives in
40
+ `lib/snap_diff/`; every legacy constant (`Capybara::Screenshot::Diff::*`,
41
+ `CapybaraScreenshotDiff::*`) still resolves to the *same object* and keeps
42
+ working ([#208](https://github.com/snap-diff/snap_diff-capybara/pull/208),
43
+ [#209](https://github.com/snap-diff/snap_diff-capybara/pull/209),
44
+ [#210](https://github.com/snap-diff/snap_diff-capybara/pull/210)):
45
+ `ImageCompare` → `SnapDiff::Comparison`, `Difference` →
46
+ `SnapDiff::ComparisonResult`, `Drivers::BaseDriver` → `SnapDiff::Driver` (mixin).
47
+ - **Legacy constants warn on first use** — once per constant per process, naming
48
+ the replacement ([#218](https://github.com/snap-diff/snap_diff-capybara/pull/218)).
49
+ Silence with `SnapDiff.silence_deprecations = true` or
50
+ `SNAP_DIFF_SILENCE_DEPRECATIONS=1`. A few constants stay silent by design
51
+ (`Os`, `DSL`, `VERSION`, driver leaf classes — see `lib/snap_diff/legacy_shims.rb`).
52
+
53
+ ### Fixed
54
+ - Annotation color constants resolve under the bare `require "snap_diff"` entry;
55
+ previously a differing comparison raised `NameError` there
56
+ ([#219](https://github.com/snap-diff/snap_diff-capybara/pull/219))
57
+
58
+ ### Known caveats (deliberate, alpha)
59
+ - `defined?(...)` / `const_defined?` on lazily-shimmed legacy names returns
60
+ false/nil — feature detection like `defined?(Capybara::Screenshot::Diff::Drivers::VipsDriver)`
61
+ must move to the `SnapDiff::` name. Rescuing legacy error classes is unaffected
62
+ (they remain eagerly defined).
63
+ - Reopening `module Capybara::Screenshot::Diff::Drivers` (historical custom-driver
64
+ monkey-patch pattern) defines a fresh module that shadows the shim; define custom
65
+ drivers under `SnapDiff::Drivers` instead.
66
+
67
+ ### Internal
68
+ - Core simplification, behavior-preserving (the "5.5-lite" pass): pure
69
+ capture/comparison option partition ([#212](https://github.com/snap-diff/snap_diff-capybara/pull/212)),
70
+ stability failure as data ([#213](https://github.com/snap-diff/snap_diff-capybara/pull/213)),
71
+ explicit `ScreenshotAssertion#archive_baseline!` + `#inspect` on
72
+ assertion/result ([#214](https://github.com/snap-diff/snap_diff-capybara/pull/214)),
73
+ `SnapDiff::Capture::Viewport` seam with the future `anchor:` hook
74
+ ([#215](https://github.com/snap-diff/snap_diff-capybara/pull/215)), reporter vs
75
+ session lifecycle separation ([#216](https://github.com/snap-diff/snap_diff-capybara/pull/216)),
76
+ all behind a guard-test net ([#211](https://github.com/snap-diff/snap_diff-capybara/pull/211))
77
+
78
+ ---
79
+
80
+ ## [v1.15.1] - 2026-08-22
81
+
82
+ ### Fixed
83
+ - **`VipsDriver#resize_image_to` resizes to the requested dimensions** — the vips driver passed a target aspect ratio where libvips expects a scale factor, so retina-halving on macOS/Selenium could enlarge screenshots (2560×1600 → 4096×2560) and save wrongly-sized baselines; now scales width and height independently via `resize(scale, vscale:)` ([#205](https://github.com/snap-diff/snap_diff-capybara/pull/205))
84
+
85
+ ### Internal
86
+ - Driver contract tests pinning the shared ChunkyPNG/Vips driver seam (method surface, load/compare behavior, option handling) — the net that caught the resize bug ([#204](https://github.com/snap-diff/snap_diff-capybara/pull/204))
87
+
88
+ ---
89
+
90
+ ## [v1.15.0] - 2026-08-22
91
+
92
+ ### Added
93
+ - **`SnapDiff::Config`** — one flat object consolidating all 27 settings behind `SnapDiff.config` / `SnapDiff.configure { |config| ... }`; purely additive, the existing accessors stay canonical and both views share one source of truth ([#200](https://github.com/snap-diff/snap_diff-capybara/pull/200))
94
+
95
+ ### Fixed
96
+ - **`pending_if_new` no longer masks real failures** — a raising Minitest `teardown` or a raising RSpec `after` hook registered before the gem could previously be reported as a skipped/pending test with exit 0; the pending marker now defers until the framework's teardown chain has run and yields to any failure. Known residual: an RSpec `config.append_after` registered after this gem still runs later than the gem's hook — require the gem last if you use appended after-hooks ([#203](https://github.com/snap-diff/snap_diff-capybara/pull/203))
97
+ - **`BacktraceFilter` path-boundary matching** — a custom `lib_directory` of `/app/lib` no longer also filters locations under `/app/library` ([#202](https://github.com/snap-diff/snap_diff-capybara/pull/202))
98
+
99
+ ### Internal
100
+ - Failure-masking guard tests for the `pending_if_new` teardown paths via subprocess RSpec runs ([#199](https://github.com/snap-diff/snap_diff-capybara/pull/199))
101
+ - Hygiene pass — skip-area/VCS-baseline and `BacktraceFilter` guard tests, entry-point forwarder dedupe, `Comparison` and `BacktraceFilter` merged into their sole consumers (−2 files, constant paths preserved) ([#201](https://github.com/snap-diff/snap_diff-capybara/pull/201))
102
+
103
+ ---
104
+
105
+ ## [v1.14.0] - 2026-08-22
106
+
107
+ ### Added
108
+ - **`SnapDiff` namespace aliases** — `SnapDiff::Comparison`, `SnapDiff.compare`, and `SnapDiff.start` provide a forward-looking entry point onto the existing `Capybara::Screenshot::Diff` API, no behavior changes ([#166](https://github.com/snap-diff/snap_diff-capybara/issues/166))
109
+
110
+ ### Fixed
111
+ - **Standalone require path** — `require "capybara_screenshot_diff"` (or `require "snap_diff"`) followed by `Diff.compare` no longer raises `NameError` for the missing drivers require ([#194](https://github.com/snap-diff/snap_diff-capybara/pull/194))
112
+
113
+ ### Internal
114
+ - Merged `DifferenceFinder` into `ImageCompare` (ADR-004 step) ([#192](https://github.com/snap-diff/snap_diff-capybara/pull/192))
115
+ - Extracted `AnnotationService` from `Reporters::Default`; full public surface preserved via delegation ([#193](https://github.com/snap-diff/snap_diff-capybara/pull/193))
116
+ - Consolidated `pending_if_new` teardown logic into one shared helper across Minitest/RSpec/Cucumber adapters ([#197](https://github.com/snap-diff/snap_diff-capybara/pull/197))
117
+ - Test-suite driver-coverage banner and CI guard against silently missing drivers ([#198](https://github.com/snap-diff/snap_diff-capybara/pull/198))
118
+
119
+ ---
120
+
121
+ ## [v1.13.0] - 2026-08-22
122
+
123
+ ### Added
124
+ - **`capture_screenshot` DSL method** — take a screenshot without ever comparing or asserting ([#191](https://github.com/snap-diff/snap_diff-capybara/issues/191))
125
+ - **`compare:` option on `screenshot`** — pass `compare: true` (default) to assert, or `compare: false` to capture only ([#191](https://github.com/snap-diff/snap_diff-capybara/issues/191))
126
+ - **`Capybara::Screenshot::Diff.pending_if_new` config** — mark tests as skipped in teardown when a baseline does not exist, complementing `fail_if_new` ([#191](https://github.com/snap-diff/snap_diff-capybara/issues/191))
127
+
128
+ ### Changed
129
+ - **`assert_matches_screenshot` is now the primary assertion method** — captures a screenshot and compares against baseline ([#191](https://github.com/snap-diff/snap_diff-capybara/issues/191))
130
+ - **`screenshot` is now a convenience wrapper** — safe to override in user test classes; the gem no longer calls it internally ([#191](https://github.com/snap-diff/snap_diff-capybara/issues/191))
131
+
132
+ ---
133
+
134
+ ## [v1.12.0] - 2026-04-12
135
+
136
+ ### Added
137
+ - **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))
138
+ - **GitHub Actions integration** — inline HTML preview with base64 embedded images + reusable composite action ([#171](https://github.com/snap-diff/snap_diff-capybara/pull/171))
139
+ - **`disable_animations` helper** — inject CSS to stop all animations/transitions during screenshots ([#174](https://github.com/snap-diff/snap_diff-capybara/pull/174))
140
+ - **`snap_diff:clean` rake task** — remove diff artifacts while keeping baselines ([#177](https://github.com/snap-diff/snap_diff-capybara/pull/177))
141
+ - `Diff.compare` for standalone image comparison without Capybara or browser
142
+ - Perceptual color distance (dE00) for anti-aliasing tolerance in VipsDriver
143
+ - `assert_no_screenshot_changes` DSL assertion
144
+ - `Diff.configure` block helper for simplified configuration
145
+ - Ruby 3.5 and 4.0 support
146
+
147
+ ### Changed
148
+ - `blur_active_element` now defaults to `true` — prevents cursor blinking artifacts
149
+ - `hide_caret` now defaults to `true` — stable screenshots without caret
150
+ - `fail_if_new` now defaults to `true` in CI (when `ENV['CI']` is set)
151
+ - Thread-safe reporter notification with mutex ([#175](https://github.com/snap-diff/snap_diff-capybara/pull/175))
152
+
153
+ ### Removed
154
+ - **SVN support** — Git only
155
+ - **ActiveSupport runtime dependency** — pure Ruby, lighter installations
156
+
157
+ ### Fixed
158
+ - VCS path resolution rewritten for thread safety (Open3 + array-form system)
159
+ - Reporter diff artifacts cleaned up properly on `Snap#delete!` ([#173](https://github.com/snap-diff/snap_diff-capybara/pull/173))
160
+ - RSpec matcher now provides `failure_message` and description
161
+ - Missing baseline error includes recording instructions
162
+ - Ruby 4.0 DSLStub ordering compatibility
163
+ - ChunkyPNG `filter_image_with_median` incorrect behavior
164
+ - Tolerance calculation no longer skips large changes
165
+
166
+ ### Performance
167
+ - ChunkyPNG shift-detection: eliminated array allocations (~30% faster for large images)
168
+ - VIPS: cached computations at construction (~15% faster)
169
+ - Memoized region area size, replaced closures with blocks
170
+
171
+ ### Documentation
172
+ - README restructured from 970 to 149 lines with 7 dedicated `docs/` files ([#171](https://github.com/snap-diff/snap_diff-capybara/pull/171))
173
+ - CI integration guide with artifact upload and PR commenting ([docs/ci-integration.md](docs/ci-integration.md))
174
+ - Upgrade guide ([docs/UPGRADING.md](docs/UPGRADING.md))
175
+ - Color comparison guide — tolerance vs perceptual_threshold vs color_distance_limit ([#176](https://github.com/snap-diff/snap_diff-capybara/pull/176))
176
+
177
+ ### Internal
178
+ - Simplified internals: inlined CaptureStrategy, ComparisonLoader, ScreenshotNamerDSL, VipsUtil
179
+ - Unified Screenshoter constructors, consolidated skip_area accessor
180
+ - Upgraded CI dependencies (actions/checkout v5, upload-artifact v7)
181
+
182
+ ---
183
+
184
+ ## [v1.11.0] - Previous Release
185
+
186
+ [Unreleased]: https://github.com/snap-diff/snap_diff-capybara/compare/v1.12.0...HEAD
187
+ [v1.12.0]: https://github.com/snap-diff/snap_diff-capybara/releases/tag/v1.12.0
188
+ [v1.11.0]: https://github.com/snap-diff/snap_diff-capybara/releases/tag/v1.11.0
189
+
190
+ **Upgrade Guide:** See [docs/UPGRADING.md](docs/UPGRADING.md) for detailed migration instructions.
@@ -0,0 +1,129 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement by
63
+ [opening a GitHub Issue](https://github.com/snap-diff/snap_diff-capybara/issues).
64
+
65
+ All complaints will be reviewed and investigated promptly and fairly.
66
+
67
+ All community leaders are obligated to respect the privacy and security of the
68
+ reporter of any incident.
69
+
70
+ ## Enforcement Guidelines
71
+
72
+ Community leaders will follow these Community Impact Guidelines in determining
73
+ the consequences for any action they deem in violation of this Code of Conduct:
74
+
75
+ ### 1. Correction
76
+
77
+ **Community Impact:** Use of inappropriate language or other behavior deemed
78
+ unprofessional or unwelcome in the community.
79
+
80
+ **Consequence:** A private, written warning from community leaders, providing
81
+ clarity around the nature of the violation and an explanation of why the
82
+ behavior was inappropriate. A public apology may be requested.
83
+
84
+ ### 2. Warning
85
+
86
+ **Community Impact:** A violation through a single incident or series
87
+ of actions.
88
+
89
+ **Consequence:** A warning with consequences for continued behavior. No
90
+ interaction with the people involved, including unsolicited interaction with
91
+ those enforcing the Code of Conduct, for a specified period of time. This
92
+ includes avoiding interactions in community spaces as well as external channels
93
+ like social media. Violating these terms may lead to a temporary or
94
+ permanent ban.
95
+
96
+ ### 3. Temporary Ban
97
+
98
+ **Community Impact:** A serious violation of community standards, including
99
+ sustained inappropriate behavior.
100
+
101
+ **Consequence:** A temporary ban from any sort of interaction or public
102
+ communication with the community for a specified period of time. No public or
103
+ private interaction with the people involved, including unsolicited interaction
104
+ with those enforcing the Code of Conduct, is allowed during this period.
105
+ Violating these terms may lead to a permanent ban.
106
+
107
+ ### 4. Permanent Ban
108
+
109
+ **Community Impact:** Demonstrating a pattern of violation of community
110
+ standards, including sustained inappropriate behavior, harassment of an
111
+ individual, or aggression toward or disparagement of classes of individuals.
112
+
113
+ **Consequence:** A permanent ban from any sort of public interaction within
114
+ the community.
115
+
116
+ ## Attribution
117
+
118
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119
+ version 2.1, available at
120
+ https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
121
+
122
+ Community Impact Guidelines were inspired by
123
+ [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
124
+
125
+ [homepage]: https://www.contributor-covenant.org
126
+
127
+ For answers to common questions about this code of conduct, see the FAQ at
128
+ https://www.contributor-covenant.org/faq. Translations are available at
129
+ https://www.contributor-covenant.org/translations.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Uwe Kubosch
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ task default: :test
7
+
8
+ Rake::TestTask.new(:test) do |t|
9
+ t.libs << "test"
10
+ t.libs << "lib"
11
+ t.test_files = FileList["test/**/*_test.rb"]
12
+ end
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
+
20
+ Rake::TestTask.new("test:integration") do |t|
21
+ t.libs << "test"
22
+ t.libs << "lib"
23
+ t.test_files = FileList["test/integration/**/*_test.rb"]
24
+ end
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
+
48
+ task "clobber" do
49
+ puts "Cleanup tmp/"
50
+ FileUtils.rm_rf(Dir["./tmp/*"])
51
+ end
52
+
53
+ task "test:benchmark" do
54
+ require_relative "scripts/benchmark/find_region_benchmark"
55
+ benchmark = Capybara::Screenshot::Diff::Drivers::FindRegionBenchmark.new
56
+
57
+ puts "For Medium Screen Size: 800x600"
58
+ benchmark.for_medium_size_screens
59
+
60
+ puts ""
61
+ puts "*" * 100
62
+
63
+ puts "For Small Screen Size: 80x60"
64
+ benchmark.for_small_images
65
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path("lib", __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "capybara/screenshot/diff/version"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "capybara-screenshot-diff"
9
+ spec.version = Capybara::Screenshot::Diff::VERSION
10
+ spec.authors = ["Uwe Kubosch"]
11
+ spec.email = ["uwe@kubosch.no"]
12
+ spec.summary = "Track your GUI changes with diff assertions"
13
+ spec.description = "Save screen shots and track changes with graphical diff"
14
+ spec.homepage = "https://github.com/snap-diff/snap_diff-capybara"
15
+ spec.required_ruby_version = ">= 3.2"
16
+ spec.license = "MIT"
17
+ spec.metadata["allowed_push_host"] = "https://rubygems.org/"
18
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
+ f.match(%r{(^(\.|tmp|bin|test|spec|features|gemfiles|scripts|foo)/)|(^(\.|Dockerfile|CONTRIBUTING|README))})
20
+ end
21
+
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_development_dependency "actionpack", ">= 7.1", "< 9"
27
+ spec.add_development_dependency "activesupport", ">= 7.1", "< 9"
28
+ spec.add_runtime_dependency "capybara", ">= 2", "< 4"
29
+ end
@@ -0,0 +1,44 @@
1
+ # Release Preparation — v1.15.1
2
+
3
+ ## Summary
4
+
5
+ HIGH-severity VipsDriver resize fix (retina halving could enlarge screenshots
6
+ and corrupt baselines) plus the driver contract tests that caught it.
7
+
8
+ ## Release Checklist
9
+
10
+ ### Pre-Release
11
+
12
+ - [x] Update version to `1.15.1`
13
+ - [x] Run tests: `bundle exec rake test:unit` (376 runs, 0 failures)
14
+ - [x] Update CHANGELOG.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.15.1`
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
+ ### Added
31
+ - `SnapDiff::Config` — flat, additive consolidation of all 27 settings
32
+ (`SnapDiff.config` / `SnapDiff.configure`); old accessors stay canonical
33
+
34
+ ### Fixed
35
+ - `pending_if_new` no longer converts real teardown/after-hook failures into
36
+ pending tests (Minitest defers to `after_teardown`; RSpec uses `append_after`;
37
+ known residual for consumer `append_after` hooks documented)
38
+ - `BacktraceFilter` custom `lib_directory` matches on a path boundary
39
+
40
+ ### Internal
41
+ - Guard tests for failure masking and skip-area/VCS-baseline regressions;
42
+ two files merged into sole consumers (constant paths preserved)
43
+
44
+ See [CHANGELOG.md](../CHANGELOG.md) for full details.