capybara-screenshot-diff 1.15.0 → 2.0.0.alpha1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +59 -0
- data/docs/RELEASE_PREP.md +6 -6
- data/docs/thread_safety.md +15 -0
- data/lib/capybara/screenshot/diff/annotation_service.rb +5 -77
- data/lib/capybara/screenshot/diff/area_calculator.rb +5 -54
- data/lib/capybara/screenshot/diff/browser_helpers.rb +5 -119
- data/lib/capybara/screenshot/diff/config_legacy.rb +113 -0
- data/lib/capybara/screenshot/diff/cucumber.rb +1 -1
- data/lib/capybara/screenshot/diff/difference.rb +6 -102
- data/lib/capybara/screenshot/diff/drivers/base_driver.rb +7 -39
- data/lib/capybara/screenshot/diff/drivers/chunky_png_driver.rb +5 -299
- data/lib/capybara/screenshot/diff/drivers/vips_driver.rb +5 -169
- data/lib/capybara/screenshot/diff/drivers.rb +7 -14
- data/lib/capybara/screenshot/diff/image_compare.rb +10 -228
- data/lib/capybara/screenshot/diff/image_preprocessor.rb +5 -70
- data/lib/capybara/screenshot/diff/os.rb +8 -13
- data/lib/capybara/screenshot/diff/reporters/default.rb +5 -3
- data/lib/capybara/screenshot/diff/screenshot_matcher.rb +5 -129
- data/lib/capybara/screenshot/diff/screenshoter.rb +5 -127
- data/lib/capybara/screenshot/diff/stable_screenshoter.rb +5 -104
- data/lib/capybara/screenshot/diff/utils.rb +5 -40
- data/lib/capybara/screenshot/diff/vcs.rb +5 -37
- data/lib/capybara/screenshot/diff/version.rb +7 -1
- data/lib/capybara_screenshot_diff/attempts_reporter.rb +5 -47
- data/lib/capybara_screenshot_diff/cucumber.rb +5 -17
- data/lib/capybara_screenshot_diff/dsl.rb +7 -129
- data/lib/capybara_screenshot_diff/error_with_filtered_backtrace.rb +6 -30
- data/lib/capybara_screenshot_diff/minitest.rb +6 -56
- data/lib/capybara_screenshot_diff/reporters/html.rb +5 -135
- data/lib/capybara_screenshot_diff/rspec.rb +5 -63
- data/lib/capybara_screenshot_diff/screenshot_assertion.rb +39 -157
- data/lib/capybara_screenshot_diff/screenshot_namer.rb +5 -79
- data/lib/capybara_screenshot_diff/snap.rb +5 -64
- data/lib/capybara_screenshot_diff/snap_manager.rb +5 -82
- data/lib/capybara_screenshot_diff/static.rb +3 -5
- data/lib/capybara_screenshot_diff.rb +29 -100
- data/lib/snap_diff/annotation_service.rb +84 -0
- data/lib/snap_diff/area_calculator.rb +56 -0
- data/lib/snap_diff/attempts_reporter.rb +51 -0
- data/lib/snap_diff/browser_helpers.rb +121 -0
- data/lib/snap_diff/capture/viewport.rb +40 -0
- data/lib/snap_diff/comparison.rb +238 -0
- data/lib/snap_diff/comparison_result.rb +104 -0
- data/lib/snap_diff/config.rb +6 -2
- data/lib/snap_diff/deprecation.rb +84 -0
- data/lib/snap_diff/driver.rb +37 -0
- data/lib/snap_diff/drivers/chunky_png_driver.rb +298 -0
- data/lib/snap_diff/drivers/vips_driver.rb +171 -0
- data/lib/snap_diff/drivers.rb +14 -0
- data/lib/snap_diff/dsl.rb +143 -0
- data/lib/snap_diff/error_with_filtered_backtrace.rb +32 -0
- data/lib/snap_diff/image_preprocessor.rb +68 -0
- data/lib/snap_diff/integrations/cucumber.rb +22 -0
- data/lib/snap_diff/integrations/minitest.rb +70 -0
- data/lib/snap_diff/integrations/rspec.rb +68 -0
- data/lib/snap_diff/legacy_shims.rb +99 -0
- data/lib/snap_diff/os.rb +17 -0
- data/lib/snap_diff/reporters/html.rb +143 -0
- data/lib/snap_diff/reporting.rb +53 -0
- data/lib/snap_diff/screenshot_assertion.rb +143 -0
- data/lib/snap_diff/screenshot_matcher.rb +113 -0
- data/lib/snap_diff/screenshot_namer.rb +81 -0
- data/lib/snap_diff/screenshoter.rb +129 -0
- data/lib/snap_diff/snap.rb +66 -0
- data/lib/snap_diff/snap_manager.rb +125 -0
- data/lib/snap_diff/stable_screenshoter.rb +103 -0
- data/lib/snap_diff/static.rb +11 -0
- data/lib/snap_diff/utils.rb +38 -0
- data/lib/snap_diff/vcs.rb +35 -0
- data/lib/snap_diff/version.rb +5 -0
- data/lib/snap_diff.rb +22 -6
- metadata +36 -2
- /data/lib/{capybara_screenshot_diff → snap_diff}/reporters/templates/report.html.erb +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "open3"
|
|
4
|
+
require_relative "os"
|
|
5
|
+
|
|
6
|
+
module SnapDiff
|
|
7
|
+
module Vcs
|
|
8
|
+
def self.checkout_vcs(root, screenshot_path, checkout_path)
|
|
9
|
+
root_path = root.to_s
|
|
10
|
+
git_root, _, status = Open3.capture3("git", "-C", root_path, "rev-parse", "--show-toplevel")
|
|
11
|
+
return false unless status.success?
|
|
12
|
+
|
|
13
|
+
git_root = git_root.chomp
|
|
14
|
+
vcs_file_path = Pathname.new(screenshot_path).expand_path.relative_path_from(Pathname.new(git_root)).to_s
|
|
15
|
+
|
|
16
|
+
if Capybara::Screenshot.use_lfs
|
|
17
|
+
tmp_path = "#{checkout_path}.tmp"
|
|
18
|
+
success = system("git", "-C", root_path, "show", "HEAD:#{vcs_file_path}", out: tmp_path, err: File::NULL)
|
|
19
|
+
if success
|
|
20
|
+
system("git", "-C", root_path, "lfs", "smudge", in: tmp_path, out: checkout_path.to_s, err: File::NULL)
|
|
21
|
+
end
|
|
22
|
+
File.delete(tmp_path) if File.exist?(tmp_path)
|
|
23
|
+
else
|
|
24
|
+
success = system("git", "-C", root_path, "show", "HEAD:#{vcs_file_path}", out: checkout_path.to_s, err: File::NULL)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
unless success
|
|
28
|
+
checkout_path.delete if checkout_path.exist?
|
|
29
|
+
return false
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
true
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
data/lib/snap_diff.rb
CHANGED
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# None of these requires ever leads back to this file: config_legacy is a
|
|
4
|
+
# leaf (see its own header comment), the image_compare forwarder pulls in
|
|
5
|
+
# snap_diff/comparison plus the legacy const_missing shims, and
|
|
6
|
+
# "capybara/dsl" is the base gem. That keeps this file's require graph
|
|
7
|
+
# acyclic -- it never requires "capybara_screenshot_diff" back, unlike the
|
|
8
|
+
# old autoload-based wiring this replaced. The forwarder path (not
|
|
9
|
+
# "snap_diff/comparison" directly) is deliberate: it installs
|
|
10
|
+
# snap_diff/legacy_shims, so the old Capybara::Screenshot::Diff constants
|
|
11
|
+
# stay resolvable (now with deprecation warnings) even in processes that
|
|
12
|
+
# only ever require "snap_diff".
|
|
13
|
+
# "capybara/dsl" is needed directly (not just transitively) so
|
|
14
|
+
# `Capybara.default_max_wait_time` in Diff.default_options resolves even
|
|
15
|
+
# when "snap_diff" is required standalone (SnapDiffTest's
|
|
16
|
+
# "standalone-loadable in a fresh process" regression test).
|
|
17
|
+
require "capybara/dsl"
|
|
18
|
+
require "capybara/screenshot/diff/config_legacy"
|
|
19
|
+
require "capybara/screenshot/diff/image_compare"
|
|
4
20
|
require "snap_diff/config"
|
|
5
21
|
|
|
6
22
|
# Forward-looking namespace for the gem, per ADR-004.
|
|
7
23
|
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
24
|
+
# Since v2 step 5 the comparison implementation lives here
|
|
25
|
+
# ({SnapDiff::Comparison}, {SnapDiff::ComparisonResult}); since step 6 the
|
|
26
|
+
# old +Capybara::Screenshot::Diff+ constants are same-object const_missing
|
|
27
|
+
# shims (snap_diff/legacy_shims) that emit a deprecation warning once per
|
|
28
|
+
# constant per process. See ADR-004 for the full migration plan.
|
|
11
29
|
module SnapDiff
|
|
12
|
-
Comparison = Capybara::Screenshot::Diff::ImageCompare
|
|
13
|
-
|
|
14
30
|
def self.compare(...)
|
|
15
31
|
Capybara::Screenshot::Diff.compare(...)
|
|
16
32
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: capybara-screenshot-diff
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0.alpha1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Uwe Kubosch
|
|
@@ -101,6 +101,7 @@ files:
|
|
|
101
101
|
- lib/capybara/screenshot/diff/annotation_service.rb
|
|
102
102
|
- lib/capybara/screenshot/diff/area_calculator.rb
|
|
103
103
|
- lib/capybara/screenshot/diff/browser_helpers.rb
|
|
104
|
+
- lib/capybara/screenshot/diff/config_legacy.rb
|
|
104
105
|
- lib/capybara/screenshot/diff/cucumber.rb
|
|
105
106
|
- lib/capybara/screenshot/diff/difference.rb
|
|
106
107
|
- lib/capybara/screenshot/diff/drivers.rb
|
|
@@ -125,7 +126,6 @@ files:
|
|
|
125
126
|
- lib/capybara_screenshot_diff/error_with_filtered_backtrace.rb
|
|
126
127
|
- lib/capybara_screenshot_diff/minitest.rb
|
|
127
128
|
- lib/capybara_screenshot_diff/reporters/html.rb
|
|
128
|
-
- lib/capybara_screenshot_diff/reporters/templates/report.html.erb
|
|
129
129
|
- lib/capybara_screenshot_diff/rspec.rb
|
|
130
130
|
- lib/capybara_screenshot_diff/screenshot_assertion.rb
|
|
131
131
|
- lib/capybara_screenshot_diff/screenshot_namer.rb
|
|
@@ -133,7 +133,41 @@ files:
|
|
|
133
133
|
- lib/capybara_screenshot_diff/snap_manager.rb
|
|
134
134
|
- lib/capybara_screenshot_diff/static.rb
|
|
135
135
|
- lib/snap_diff.rb
|
|
136
|
+
- lib/snap_diff/annotation_service.rb
|
|
137
|
+
- lib/snap_diff/area_calculator.rb
|
|
138
|
+
- lib/snap_diff/attempts_reporter.rb
|
|
139
|
+
- lib/snap_diff/browser_helpers.rb
|
|
140
|
+
- lib/snap_diff/capture/viewport.rb
|
|
141
|
+
- lib/snap_diff/comparison.rb
|
|
142
|
+
- lib/snap_diff/comparison_result.rb
|
|
136
143
|
- lib/snap_diff/config.rb
|
|
144
|
+
- lib/snap_diff/deprecation.rb
|
|
145
|
+
- lib/snap_diff/driver.rb
|
|
146
|
+
- lib/snap_diff/drivers.rb
|
|
147
|
+
- lib/snap_diff/drivers/chunky_png_driver.rb
|
|
148
|
+
- lib/snap_diff/drivers/vips_driver.rb
|
|
149
|
+
- lib/snap_diff/dsl.rb
|
|
150
|
+
- lib/snap_diff/error_with_filtered_backtrace.rb
|
|
151
|
+
- lib/snap_diff/image_preprocessor.rb
|
|
152
|
+
- lib/snap_diff/integrations/cucumber.rb
|
|
153
|
+
- lib/snap_diff/integrations/minitest.rb
|
|
154
|
+
- lib/snap_diff/integrations/rspec.rb
|
|
155
|
+
- lib/snap_diff/legacy_shims.rb
|
|
156
|
+
- lib/snap_diff/os.rb
|
|
157
|
+
- lib/snap_diff/reporters/html.rb
|
|
158
|
+
- lib/snap_diff/reporters/templates/report.html.erb
|
|
159
|
+
- lib/snap_diff/reporting.rb
|
|
160
|
+
- lib/snap_diff/screenshot_assertion.rb
|
|
161
|
+
- lib/snap_diff/screenshot_matcher.rb
|
|
162
|
+
- lib/snap_diff/screenshot_namer.rb
|
|
163
|
+
- lib/snap_diff/screenshoter.rb
|
|
164
|
+
- lib/snap_diff/snap.rb
|
|
165
|
+
- lib/snap_diff/snap_manager.rb
|
|
166
|
+
- lib/snap_diff/stable_screenshoter.rb
|
|
167
|
+
- lib/snap_diff/static.rb
|
|
168
|
+
- lib/snap_diff/utils.rb
|
|
169
|
+
- lib/snap_diff/vcs.rb
|
|
170
|
+
- lib/snap_diff/version.rb
|
|
137
171
|
homepage: https://github.com/snap-diff/snap_diff-capybara
|
|
138
172
|
licenses:
|
|
139
173
|
- MIT
|
|
File without changes
|