https://github.com/taskrabbit/screenpress
Visual regression prevention for Capybara
https://github.com/taskrabbit/screenpress
Last synced: 6 months ago
JSON representation
Visual regression prevention for Capybara
- Host: GitHub
- URL: https://github.com/taskrabbit/screenpress
- Owner: taskrabbit
- License: mit
- Created: 2013-12-06T00:08:55.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-12-09T20:48:02.000Z (over 12 years ago)
- Last Synced: 2025-09-01T15:40:07.727Z (7 months ago)
- Language: Ruby
- Size: 137 KB
- Stars: 5
- Watchers: 38
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Screenpress
It happens. Your button is there but it's white on white on white and no one can see it. Especially your rspec tests.
Screenpress integrates with your Capybara tests to implement a visual regression prevention workflow.
## Setup
```ruby
# acceptance_helper.rb
require 'screenpress'
RSpec.configure do |config|
config.include ::Screenpress::DSL
end
```
```ruby
# your_spec.rb
visit '/tasks/new'
screenpress('tasks/form')
```
This will take a picture of the page and put it at `/screenpress/tasks/form.png` to review.
## Workflow
So it just takes a screenshot and puts in in a folder. So what?
The thing is that it's now in git. If it's different, it's now on your diff and everyone can see what has changed.
You've just added a visual design review to your development process and that's cool. Now we can go back in time and see when that header changed or not accept the pull request in the first place if the button is missing.
### Options
There are a few config options...
```ruby
# acceptance_helper.rb
require 'screenpress'
# Maybe you want to turn it off in some cases (like on your continuous integration server)
Screenpress.config.enabled = false if ENV['JENKINS']
# You can change where files are saved relative to project root (default if /screenpress)
Screenpress.config.path = "/spec/screenpress"
# Or provide the full path
Screenpress.config.full_path = Rails.root.join("spec", "pictures")
RSpec.configure do |config|
config.include ::Screenpress::DSL
end
```
### TODO
* Allow a proc to be set for enablement
* Maybe be more deliberate like Huxley and set modes (ENV variables?) for recording
* Enable mode that fails test if image changes
* Enable tools to easily compare without Github (locally)
* Is there a good way to automatically take screenshots or when example is tagged?
### Inspiration
* [Huxley](https://github.com/facebook/huxley)
* [Wraith](https://github.com/BBC-News/wraith)
* [Green Onion](https://github.com/intridea/green_onion)
* [Capybara Screenshot](https://github.com/mattheworiordan/capybara-screenshot)