lookbook_visual_tester 0.5.8 → 0.5.10
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 +13 -0
- data/README.md +15 -0
- data/lib/lookbook_visual_tester/preview_checker.rb +13 -1
- data/lib/lookbook_visual_tester/runner.rb +10 -4
- data/lib/lookbook_visual_tester/scenario_run.rb +1 -1
- data/lib/lookbook_visual_tester/version.rb +1 -1
- data/lib/tasks/lookbook_visual_tester.rake +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1b695b1efdbe2c4ef212efed5fa7a63619ae6942e366cbfb79731cc337164bd4
|
|
4
|
+
data.tar.gz: 7ff2aa55244ff5b4279569bbc8d19e97c9921519b3d8003f7c258068e76059dd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5b8720c41c4f09a5008e913b7c260a6fc0dcd9f6d1373cfd27a4e349efa953a6b014ee4a9268e2d6fa7cb893aa477ace6fd3966173fb56a05fcf318f577c125f
|
|
7
|
+
data.tar.gz: 770d6b048097c5de295c9c2b65a5c823d2230e97ff11d60643dc44a623e4deeb68db065680c883b871b8a3d23a0a6704c5151498e55462e034670eac56c69e7e
|
data/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
## [0.5.10] - 2026-01-12
|
|
3
|
+
|
|
4
|
+
### Added
|
|
5
|
+
- **Force Update**: Added support for forcibly updating all baselines via `rake lookbook:test[force]` or `UPDATE=true rake lookbook:test`.
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- **File Naming**: Improved screenshot file naming to use full directory paths (e.g., `folder/component/preview.png`) instead of flattened underscores. This prevents filename clashes between components with similar names in different namespaces (e.g., `Foo::Bar` vs `FooBar`) and preserves directory structure in the output.
|
|
9
|
+
|
|
10
|
+
## [0.5.9] - 2026-01-12
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- **Deep Check**: Ensure `ActionView::Template::Error` is correctly reported as a failure in `rake lookbook:deep_check`. This fixes an issue where rendered error pages were being ignored.
|
|
14
|
+
|
|
2
15
|
## [0.5.8] - 2026-01-08
|
|
3
16
|
|
|
4
17
|
### ✨ New Features & Improvements
|
data/README.md
CHANGED
|
@@ -131,6 +131,21 @@ You can run your visual tests against multiple configurations (variants), such a
|
|
|
131
131
|
3. **Mismatches**: If a change is detected, a **Diff** image is generated.
|
|
132
132
|
4. **Approval**: To approve a change (update the baseline), simply copy the file from `current_run` to `baseline`. The HTML report provides a convenient "Copy Approval Command" button for this.
|
|
133
133
|
|
|
134
|
+
|
|
135
|
+
### Updating Baselines
|
|
136
|
+
|
|
137
|
+
To update the baseline images for all previews, run:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
UPDATE=true rake lookbook:test
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Or using the rake argument:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
rake lookbook:test[force]
|
|
147
|
+
```
|
|
148
|
+
|
|
134
149
|
### Reporting
|
|
135
150
|
|
|
136
151
|
After running `rake lookbook:test`, a detailed HTML report is generated at:
|
|
@@ -163,8 +163,20 @@ module LookbookVisualTester
|
|
|
163
163
|
end
|
|
164
164
|
end
|
|
165
165
|
|
|
166
|
-
result.render_in(view_context)
|
|
166
|
+
output = result.render_in(view_context)
|
|
167
|
+
if output.is_a?(String) && output.include?('ActionView::Template::Error')
|
|
168
|
+
return CheckResult.new(preview_name: preview.name,
|
|
169
|
+
example_name:,
|
|
170
|
+
status: :failed, error: 'ActionView::Template::Error found in rendered output',
|
|
171
|
+
backtrace: [])
|
|
172
|
+
end
|
|
167
173
|
elsif result.is_a?(String)
|
|
174
|
+
if result.include?('ActionView::Template::Error')
|
|
175
|
+
return CheckResult.new(preview_name: preview.name,
|
|
176
|
+
example_name:,
|
|
177
|
+
status: :failed, error: 'ActionView::Template::Error found in rendered output',
|
|
178
|
+
backtrace: [])
|
|
179
|
+
end
|
|
168
180
|
# Rendered string, good.
|
|
169
181
|
elsif result.nil?
|
|
170
182
|
# If result is nil, it implies an implicit template rendering.
|
|
@@ -11,9 +11,10 @@ module LookbookVisualTester
|
|
|
11
11
|
Result = Struct.new(:scenario_name, :status, :mismatch, :diff_path, :error, :baseline_path,
|
|
12
12
|
:current_path, keyword_init: true)
|
|
13
13
|
|
|
14
|
-
def initialize(config = LookbookVisualTester.config, pattern: nil)
|
|
14
|
+
def initialize(config = LookbookVisualTester.config, pattern: nil, force_update: false)
|
|
15
15
|
@config = config
|
|
16
16
|
@pattern = pattern
|
|
17
|
+
@force_update = force_update
|
|
17
18
|
@driver_pool = Queue.new
|
|
18
19
|
init_driver_pool
|
|
19
20
|
@results = []
|
|
@@ -168,12 +169,17 @@ module LookbookVisualTester
|
|
|
168
169
|
error = nil
|
|
169
170
|
|
|
170
171
|
if result[:error]
|
|
171
|
-
if result[:error] == 'Baseline not found'
|
|
172
|
+
if result[:error] == 'Baseline not found' || @force_update
|
|
172
173
|
# First run, maybe auto-approve or just report
|
|
173
|
-
|
|
174
|
+
if @force_update
|
|
175
|
+
puts ' [UPDATE] Baseline forced update.'
|
|
176
|
+
status = :passed # Or :updated? Let's use passed for now so it doesn't fail the build
|
|
177
|
+
else
|
|
178
|
+
puts ' [NEW] Baseline not found. Saved current as potential baseline.'
|
|
179
|
+
status = :new
|
|
180
|
+
end
|
|
174
181
|
FileUtils.mkdir_p(File.dirname(baseline_path))
|
|
175
182
|
FileUtils.cp(current_path, baseline_path)
|
|
176
|
-
status = :new
|
|
177
183
|
else
|
|
178
184
|
puts " [ERROR] #{result[:error]}"
|
|
179
185
|
status = :error
|
|
@@ -100,7 +100,7 @@ namespace :lookbook do
|
|
|
100
100
|
|
|
101
101
|
desc 'Run visual regression tests for all previews'
|
|
102
102
|
task :test, [:format] => :environment do |_, args|
|
|
103
|
-
runner = LookbookVisualTester::Runner.new
|
|
103
|
+
runner = LookbookVisualTester::Runner.new(force_update: args[:format] == 'force' || ENV['UPDATE'] == 'true')
|
|
104
104
|
|
|
105
105
|
# Check for ENV var or arg
|
|
106
106
|
json_mode = args[:format] == 'json' || ENV['JSON_OUTPUT'] == 'true'
|