README.md in capybara-screenshot-diff-0.1.0 vs README.md in capybara-screenshot-diff-0.2.1

- old
+ new

@@ -1,13 +1,15 @@ +[![Build Status](https://travis-ci.org/donv/capybara-screenshot-diff.svg?branch=master)](https://travis-ci.org/donv/capybara-screenshot-diff) + # Capybara::Screenshot::Diff Ever wondered what your project looked like two years ago? To answer that, you start taking screen shots during your tests. Capybara provides the `save_screenshot` method for this. Very good. -Ever introduced a graphical chnage unintended? Never want it to happen again? -Then this gem is gfor you! Use this gem to detect changes in your pages by +Ever introduced a graphical change unintended? Never want it to happen again? +Then this gem is for you! Use this gem to detect changes in your pages by taking screen shots and comparing them to the previous revision. ## Installation Add this line to your application's Gemfile: @@ -82,10 +84,48 @@ 00-welcome_index 01-feature_index 02-action_performed ``` +**All files in the screenshot group directory will be deleted when +`screenshot_group` is called.** + + +#### Screenshot sections + +You can introduce another level above the screenshot group called a +`screenshot_section`. The section name is inserted just before the group name +in the save path. If called in the setup of the test, all screenshots in +that test will get the same prefix: + +```ruby +setup do + screenshot_section 'my_feature' +end +test 'my subfeature' do + screenshot_group 'subfeature' + visit '/feature' + click_button 'Interresting button' + screenshot 'subfeature_index' + click_button 'Perform action' + screenshot 'action_performed' +end +``` + +This will produce a sequence of images like this + +``` +doc + screenshots + my_feature + subfeature + 00-subfeature_index + 01-action_performed +``` + + + ### Multiple Capybara drivers Often it is useful to test your app using different browsers. To avoid the screenshots for different Capybara drivers to overwrite each other, set @@ -187,15 +227,28 @@ ```ruby Capybara::Screenshot.save_path = "#{Rails.root}/doc/gui" ``` +### Screen shot stability +To ensure that animations are finished before saving a screen shot, you can add +a stability time limit. If the stability time limit is set, a second screen +shot will be taken and compared to the first. This is repeated until two +subsequent screen shots are identical. + +```ruby +Capybara::Screenshot.stability_time_limit = 0.5 +``` + + ## Development 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. -To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `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). +To install this gem onto your local machine, run `bundle exec rake install`. + +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). ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/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.