Applitools

Applitools Ruby SDK.

Installation

Add this line to your application's Gemfile:

gem 'eyes_selenium'

And then execute:

$ bundle

Or install it yourself as:

$ gem install eyes_selenium

Standalone Usage

Applitools::Eyes.config[:apikey] = 'XXX'

eyes = Applitools::Eyes.new
eyes.test(app_name: 'my app', test_name: 'my test') do |eyes, driver|
  driver.get 'http://www.mywebsite.com'
  eyes.check_window('home page')
  driver.find_element(:css, "li#pricing").click
  eyes.check_window('pricing')
end

Integrated within your Capybara tests:

initializer:

Capybara.run_server = false
# This is your api key, make sure you use it in all your tests.
Applitools::Eyes.config[:apikey] = 'XXX'
let(:eyes) do
  webdriver = page.driver.browser
  eyes = Applitools::Eyes.new browser: webdriver
end

spec:

require 'capybara/rspec'
require 'eyes_selenium_ruby'


describe 'Applitools', :type=>:feature, :js=>true do

  describe 'Test Applitools website' do
    it 'should navigate from the main page to the features page' do

      # Start visual testing with browser viewport set to 1024x768.
      eyes.open(app_name: 'Applitools', test_name: 'Test Web Page', viewport_size: {width: 1024, height: 768})

      visit 'http://www.applitools.com'

      # Visual validation point #1
      eyes.check_window('Main Page')

      page.first('.read_more').click

      # Visual validation point #2
      eyes.check_window('Features Page')

      eyes.close
    end
  end
end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request