Skip to content

genba/simulacrum

 
 

Repository files navigation

Simulacrum

Build Status Code Climate Code Climate Dependency Status Gem Version

Simulacrum is an opinionated UI component regression testing tool built to be tightly integrated with RSpec, Capybara, Selenium Webdriver & Browserstack.

Simulacrum is still very much in development. There will probably be breaking changes, and the API will almost certainly change.


🚧 But...why?

Explain the use-case better.

🚧 Opinions

Simulacrum is a little bit opinionated about a few things;

  • selenium webdriver (browserstack)
  • testing components

It would be good to explain these opinions, the reason for them and why they are good.

Setup

Simulacrum requires Ruby 1.9.3 or later. To install, add this line to your Gemfile and run bundle install:

gem 'simulacrum'

The next step is to create a simulacrum_helper.rb helper file, and then require Simulacrum there:

require 'simulacrum'

Then you can configure Simulacrum within Rspec:

RSpec.configure do |config|
  include Simulacrum

  Simulacrum.configure do |config|
    config.defaults.acceptable_delta = 1 # up to 1% percentage change allowed
    config.defaults.capture_selector = '.components__examples' # CSS selector to crop reference image to
  end
end

Usage

Simulacrum provides a small DSL for configuring and managing UI tests from within Rspec. Basically it boils down to these three methods;

  • component
  • configure_browser
  • look_the_same

Inspiration / Similar tools