lookbook_visual_tester 0.5.9 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bdb2fab34bcfe26a82674cf59064c905627f03b72ebeb7e431da4ce6e6318127
4
- data.tar.gz: f4e11dfc8329f9212b9ee9960c63c88b6ade65bd53d05a0ef1fc641c989c5fdb
3
+ metadata.gz: 1b695b1efdbe2c4ef212efed5fa7a63619ae6942e366cbfb79731cc337164bd4
4
+ data.tar.gz: 7ff2aa55244ff5b4279569bbc8d19e97c9921519b3d8003f7c258068e76059dd
5
5
  SHA512:
6
- metadata.gz: 0dd73d7e79fc7c350db0e4c61d68e0189eedb7e47f8dbcec4c3d48fb025ce14d0ef146c7c70390840e4d89ee4b5511727fe90846ce72e81e2ccb3e0da71406de
7
- data.tar.gz: '0867a4319191296bf1fb95d83424d0d42bc7a5703504bd54c1a33c8019ed56469ad77bdaa976f86689dd3b7e4b3b3024b40606725158e235ecfb59c767acc341'
6
+ metadata.gz: 5b8720c41c4f09a5008e913b7c260a6fc0dcd9f6d1373cfd27a4e349efa953a6b014ee4a9268e2d6fa7cb893aa477ace6fd3966173fb56a05fcf318f577c125f
7
+ data.tar.gz: 770d6b048097c5de295c9c2b65a5c823d2230e97ff11d60643dc44a623e4deeb68db065680c883b871b8a3d23a0a6704c5151498e55462e034670eac56c69e7e
data/CHANGELOG.md CHANGED
@@ -1,4 +1,12 @@
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
+
2
10
  ## [0.5.9] - 2026-01-12
3
11
 
4
12
  ### Fixed
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:
@@ -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
- puts ' [NEW] Baseline not found. Saved current as potential baseline.'
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
@@ -14,7 +14,7 @@ module LookbookVisualTester
14
14
  end
15
15
 
16
16
  def preview_name
17
- preview.name.underscore.gsub('/', '_')
17
+ preview.name.underscore
18
18
  end
19
19
 
20
20
  def scenario_name
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LookbookVisualTester
4
- VERSION = '0.5.9'
4
+ VERSION = '0.5.10'
5
5
  end
@@ -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'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lookbook_visual_tester
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.9
4
+ version: 0.5.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Murilo Vasconcelos