Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Is it similar? Maybe.
Ruby

This branch is 1 commit ahead of bskyb-commerce-helpcentre:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
Gemfile
Guardfile
README.md
Rakefile
symilaa.gemspec

README.md

Hello.

Sometimes it is nice to compare two images with one another. We find this particularly handy for testing browser screenshots.

With Symilaa, this is particularly easy.

1. How to do it.

one = Symilaa::Image.new 'image.png'
two = Symilaa::Image.new 'slightly_different_image.png'
three = Symilaa::Image.new 'very_different_image.png'

one == one
#=> true
one == two
#=> false
one.similar_to? two
#=> true
one.similar_to? three
#=> false

That's it. Have a nice life.


ComparisonSupport also provides a module for use with Cucumber testing.

Use ComparisonSupport#check_screen_against_reference_shot to take a screenshot of the current page under test and compare it with an existing reference screenshot.

NOTE

You must include the following in your features/support/env.rb:

Before do |scenario|
  @gherkin_statement = scenario.gherkin_statement.name if scenario.respond_to?('gherkin_statement')
  @gherkin_statement = scenario.scenario_outline.gherkin_statement.name if scenario.respond_to?('scenario_outline')
end

FileUtils.rm_rf 'artifacts/screenshots_generated_this_run'
Something went wrong with that request. Please try again.