Skip to content

Commit ac6d4e0

Browse files
pftgclaude
andcommitted
docs: add Troubleshooting section with 5 common problems
Covers: missing baselines, CI vs local differences, animations, dynamic content, and silent assertion skipping. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 50eb197 commit ac6d4e0

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,30 @@ CapybaraScreenshotDiff.reporters << MyReporter.new
827827

828828
Reporters are notified before assertions are cleared on each test teardown. `finalize` is called via `at_exit`.
829829

830+
## Troubleshooting
831+
832+
**"No existing screenshot found"**
833+
First run creates baselines. Record them: `RECORD_SCREENSHOTS=1 bundle exec rake test`.
834+
In CI, `fail_if_new` is `true` by default — commit your baselines first.
835+
836+
**Screenshots differ between CI and local**
837+
Font rendering varies across OS versions. Use `tolerance: 0.001` or `perceptual_threshold: 2.0`
838+
to ignore sub-pixel differences. Set `window_size` to ensure consistent browser dimensions.
839+
840+
**Animations cause flaky diffs**
841+
Set `stability_time_limit: 1` to wait for the page to stabilize before capturing.
842+
The gem takes multiple screenshots and compares them until two consecutive ones match.
843+
844+
**Dynamic content (timestamps, ads) always differs**
845+
Use `skip_area` to ignore specific regions:
846+
```ruby
847+
screenshot "dashboard", skip_area: [".timestamp", "#ad-banner"]
848+
```
849+
850+
**Screenshot assertion didn't seem to run**
851+
Check that `Capybara::Screenshot.enabled` is not `false`. With `delayed: true` (default),
852+
comparisons run in `before_teardown`, not inline — errors appear after the test body.
853+
830854
## Development
831855

832856
After checking out the repo, run `bin/setup` to install dependencies.

0 commit comments

Comments
 (0)