Project

symilaa

0.0
No commit activity in last 3 years
No release in over 3 years
Using the wonders of RMagick, this wonderful gem will produce a boolean result based on the computed similarity of the two images passed.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

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'