Skip to main content

Robot Framework overview

This SDK allows you to work with Applitools Eyes using Robot Framework.

For information about installing and configuring this SDK, see Testing web apps using Robot Framework on the Applitools Tutorial site.

Setting up the project

To set up the project, you need to create a configuration file for the EyesLibrary. The configuration file is in YAML format, for details of the configuration file, see EyesLibrary configuration file:

To install the required packages:

pip install eyes-robotframework

To initialize the EyesLibrary:

python -m EyesLibrary init-config

Setting API key and server URL

To get started with this SDK, you need to set the following:

Entering the Applitools API key

To authenticate via the Applitools server and run tests, you need to set the environment variable APPLITOOLS_API_KEY to the API key provided by Applitools Eyes. For details on how to retrieve your API key, see the Applitools documentation.

To enter the API Key on Linux or a Mac:

export APPLITOOLS_API_KEY=<API_key>

To enter the API Key on Windows:

set APPLITOOLS_API_KEY=<API_key>

Eyes server URL

If the Eyes server is not deployed at https://eyes.applitools.com, you need to set the server URL in the environment variable APPLITOOLS_SERVER_URL.

The server URL of your Applitools Eyes dashboard is in the format https://<MY_COMPANY>.applitools.com

To enter the server URL on Linux or a Mac:

export APPLITOOLS_SERVER_URL=<YOUR_SERVER_URL>

To enter the server URL on Windows:

set APPLITOOLS_SERVER_URL=<YOUR_SERVER_URL>

Creating Tests

A test in Applitools Eyes always starts with eyes.open call and ends with eyes.closeAsync. The steps between eyes.open and eyes.closeAsync are calls to eyes.check.

A test is structured as follows:

eyes.open
[step 1]
[step 2]
...
eyes.closeAsync

Settings section

To use Eyes, the Robot test Settings section should include the following:

*** Settings ***
Library SeleniumLibrary
Library EyesLibrary runner=selenium_ufg config=resources/applitools_config.yaml
Test Setup Setup
Test Teardown Teardown

The runner option can be set to one of the following values:

  • web
  • web_ufg
  • native_mobile_grid

The value assigned to the config option is the name of a configuration file that provides configuration values applicable to all the checkpoints of the test. For details of the structure and content of this file, see EyesLibrary configuration file.

Every Eyes test starts with a setup and ends with a teardown. In between the setup and teardown, there can be one or more checkpoints that test a window or part of a window.

Setup

The Setup has the following form:

Eyes Open options

A sample of possible value options is as follows:

app_name=My application name 
viewport=[width height]
branch_name=Custombranch
hide_scrollbars=true

For details of other options that can be passed to the Open command, see EyesLibrary configuration file.

Teardown

The Teardown has the following form:

Eyes Close

The checkpoints take a number of forms depending on what part of the window you want to test (the entire window, a region of the window, or a frame). You can also specify various special regions and other options. There are the following basic types of checkpoints:

  • Eyes Check Window – Check an entire window. See Checking a window.
  • Eyes Check Region By Selector – Check a region within a window. See Checking a region.
  • Eyes Check Frame By Selector – Check an HTML frame within a window. See Checking a frame.
  • Eyes Check Target – Check a target. This can then be followed by the Window, Region, or Frame keywords. This form allows the target to be specified as a preassigned variable.

Viewing the Results of the Test

When you run an Eyes test, there are two ways to see the results, in the Robot console or in the log. The results will be presented as follows:

$ robot  -t CheckWindow  tests/atests/acceptance/web2.robot
==============================================================================
Web2
==============================================================================
Check Window | PASS |
------------------------------------------------------------------------------
result summary {
all results=TestResultContainer{
test_results = New test [TestResults(steps=1, matches=0, mismatches=0, missing=0, url='https://eyes.applitools.com/app/batches/0123456789?accountId=absdefg12345~~', accessibility_status=None)]
exception = None}
passed=1
unresolved=0
failed=0
exceptions=0
mismatches=0
missing=0
matches=0
}
Web2 | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Output: /Users/myUser/Projects/WORK/APPLITOOLS/eyes.sdk.python/eyes_robot/output.xml
Log: /Users/myUser/Projects/WORK/APPLITOOLS/eyes.sdk.python/eyes_robot/log.html
Report: /Users/myUser/Projects/WORK/APPLITOOLS/eyes.sdk.python/eyes_robot/report.html

If all of the tests have passed, then a PASS indicator is visible. Otherwise, click on the string after "url=" (in line 9 above) to open the Test Manager.