### Prerequisites

1. A [free Applitools account](/content/users/register/index.html) and Applitools API KEY  
   Tip: Unsure how to find your API key?  
   Read [Retrieving your API key](/content/docs/eyes/getting-started/retrieve-api-key/index.html)
   to find your API key.

2. [Ruby](https://www.ruby-lang.org/en/documentation/installation/)

3. [Git](https://git-scm.com/)

Note: Installing `git` is optional  
   Installing git is used to clone the demo project from the Github repository. Instead of installing `git`, you can simply download the Zip file from the repository. Further, if you are Mac, you already have `git`.

### Running the Example Project

1. Clone or download the repository and navigate to that folder
   ```text
   git clone https://github.com/applitools/tutorial-ruby-screenshots.git
   cd tutorial-ruby-screenshots
   ```
   _Note: you can alternatively download the project as a Zip file and extract it_

2. Install the dependencies
   ```text
   gem install bundler && bundle install
   ```

3. Run the example test
   ```text
   APPLITOOLS_API_KEY="[Your API Key]" bundle exec ruby simple_test_script.rb
   ```

### Adding Applitools Eyes to an Existing Project

Install Applitools Eyes dependencies:
```sh
gem install eyes_images
```

### Sample test  
```ruby
require 'eyes_images'

runner = Applitools::ClassicRunner.new
eyes = Applitools::Images::Eyes.new(runner: runner)
batch = Applitools::BatchInfo.new('Demo Batch - Images - Ruby')

eyes.batch = batch

Applitools::EyesLogger.log_handler = Logger.new(STDOUT).tap do |l|
  l.level = Logger::INFO
end

begin
  file_path = './applitools.png'
  image_bytes = File.read(file_path)
  image = Applitools::Screenshot.from_datastream(image_bytes)

eyes.open(app_name: 'Demo App - Images Ruby', test_name: 'Smoke Test - Images Ruby')

eyes.check('By file path', Applitools::Images::Target.path(file_path))
  eyes.check('By image bytes', Applitools::Images::Target.blob(image_bytes))
  eyes.check('By Applitools Screenshot', Applitools::Images::Target.screenshot(image))

eyes.close
rescue => e
  puts e.message
  eyes.abort
ensure
  puts runner.get_all_test_results
end
```

Having Trouble?

Don't suffer in silence!  
Let us help you.  
Please [reach out to us](https://help.applitools.com/hc/en-us/requests/new) to get your project working.

## Taking the next steps with Applitools Eyes

Congratulations on completing this quickstart!  
There's still so much to learn about visual testing with Applitools, but you're off to a great start.

- [↔️ Setting match levels for visual checkpoints](/content/docs/eyes/concepts/best-practices/match-levels/index.html)
- [Organizing Tests Into Batches](/content/docs/eyes/concepts/best-practices/batching/index.html)
- [Request a demo](/content/contact/product-demo-request/index.html)  
- [Prerequisites](/content/docs/eyes/sdks/images-ruby/quickstart#prerequisites/index.html)
- [Running the Example Project](/content/docs/eyes/sdks/images-ruby/quickstart#running-the-example-project/index.html)
- [Adding Applitools Eyes to an Existing Project](/content/docs/eyes/sdks/images-ruby/quickstart#adding-applitools-eyes-to-an-existing-project/index.html)
- [Sample test](/content/docs/eyes/sdks/images-ruby/quickstart#sample-test/index.html)
- [Taking the next steps with Applitools Eyes](/content/docs/eyes/sdks/images-ruby/quickstart#taking-the-next-steps-with-applitools-eyes/index.html)
