You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Introduce VIPs adapter for faster image processing
Ref: #15
* Allow to switch between chunky_png and vips version: global and per
screenshot
* Moved chunkypng to separate impl
* Adds native vips implementation to find difference
* Adds new strategies to find difference tollerance option and median filter size option
* Setup Travis to install libvips with minimal required version
* Per screenshot option: `screenshot 'index', driver: :vips`
466
+
467
+
With enabled VIPS there are new alternatives to process differences, which easier to find and support.
468
+
For example, `shift_distance_limit` is very heavy operation, and instead better to use `median_filter_window_size`.
469
+
470
+
#### Tolerance level (vips only)
471
+
472
+
You can set a “tolerance” anywhere from 0% to 100%. This is the amount of change that's allowable.
473
+
If the screenshot has changed by more than that amount, it'll flag it as a failure.
474
+
475
+
This is alternative to "Allowed difference size", only the difference that area calculates including valid pixels.
476
+
But "tolerance" compares only different pixels.
477
+
478
+
You can use the `tolerance` option to the `screenshot` method to set level:
479
+
480
+
```ruby
481
+
test'unstable area'do
482
+
visit '/'
483
+
screenshot 'index', tolerance:0.3
484
+
end
485
+
```
486
+
487
+
You can also set this globally:
488
+
489
+
```ruby
490
+
Capybara::Screenshot::Diff.tolerance =0.3
491
+
```
492
+
493
+
#### Median filter size (vips only)
494
+
495
+
This is an alternative to "Allowed shift distance", but much faster.
496
+
You can find more about this strategy on [Median Filter](https://en.wikipedia.org/wiki/Median_filter).
497
+
Think about this like smoothing of the image, before comparison.
498
+
499
+
You can use the `median_filter_window_size` option to the `screenshot` method to set level:
500
+
501
+
```ruby
502
+
test'unstable area'do
503
+
visit '/'
504
+
screenshot 'index', median_filter_window_size:2
505
+
end
506
+
```
455
507
456
508
## Development
457
509
458
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
510
+
After checking out the repo, run `bin/setup` to install dependencies.
511
+
Then, run `rake test` to run the tests.
512
+
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
459
513
460
514
To install this gem onto your local machine, run `bundle exec rake install`.
461
515
462
516
To release a new version, update the version number in `lib/capybara/screenshot/diff/version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
463
517
464
518
## Contributing
465
519
466
-
Bug reports and pull requests are welcome on GitHub at https://github.com/donv/capybara-screenshot-diff. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
520
+
Bug reports and pull requests are welcome on GitHub at https://github.com/donv/capybara-screenshot-diff.
521
+
This project is intended to be a safe, welcoming space for collaboration,
522
+
and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
0 commit comments