Skip to main content

Checkpoint Definition

You can define checkpoints in the following ways, depending on the target area in the window you want to check and whether you need any special options:

Terminology

This section describes some parameters that are common for several keywords:

ParameterRepresents
[L T W H]A string that contains four numbers in the form [left top width height], that defines the top left corner, width, and height of a rectangular region in the window.
selector A string that is in a legal Robot Selenium or Robot Appium library format, for example:
css:div#foo h1 
xpath: //div[@id="foo"]//h1
${element}An element expressed as a variable in the form ${element}, where the element is usually assigned using Get WebElement, for example:
${element}=    Get WebElement    css:div#foo h1 
${element}= Get WebElement xpath: //div[@id="foo"]//h1
whereone of [L T W H], selector, or ${element}
booleanA string that contains a boolean value of either true or false.
stringA string value. The string may consist of multiple words if they are separated by a single space.
tgtA keyword that defines the type of target Window, Region, or Frame.

Checking a Window

You can test an entire window using either of the following commands:

Eyes Check Window    tag 
Eyes Check Target Window check settings....

The tag is the name of the step. It can consist of multiple words separated by a single space. The Target keyword allows you to add advanced options that are described in Special Regions.

By default, this checks the currently visible portion of the window (the viewport). If you set the configuration option force_full_page_screenshot to true in the configuration file or in the Open command, or use the Fully check setting with the Target keyword, then all the content on the page is captured using multiple captures, scrolling, and stitching of the multiple images.

Checking a Region

Use this command to test a rectangular region in a window, for example, a single <div>. The element may be defined using a CSS selector, or by using the Target form and providing a Coordinate, Selector, or Element.

Eyes Check    Region        By Selector     selector tag
Eyes Check Target Region By Coordinate check settings...
Eyes Check Target Region By Selector check settings...
Eyes Check Target Region By Element check settings...

The Target keyword allows you to add advanced options that are described in Special Regions.

Checking a Frame

Use this command to test an iframe embedded in a window. Specify the frame to be checked by providing its index (a number), its name (a string), or a CSS selector.

Eyes Check    Frame          By Selector    selector
Eyes Check Target Frame By Index number check settings...
Eyes Check Target Frame By Name string check settings...
Eyes Check Target Frame By Selector selector check settings...
Eyes Check Target Frame By Element ${element} check settings...

The Target keyword allows you to add advanced options that are described in Special Regions.

Basic Keywords

The check settings can include any of the following keywords once only:

With Name

Eyes Check    Target   tgt   By   where   With Name   string

Use this to define the name of the checkpoint instead of the tag that is normally found in the simpler version of these commands.

Fully

Eyes Check    Target   tgt   By   where   Fully   boolean

If true, the entire targeted window, region, or frame is checked, not just the viewport. This overrides the global configuration setting force_full_page_screenshot for this checkpoint.

Ignore Displacements

Eyes Check    Target   tgt   By   where   Ignore Displacements   boolean

Use this to set whether the Test Manager should initially display mismatches for image features that have only been displaced, as opposed to real mismatches. See Hide displacement diffs tool for more details.

Scroll Root Element

Eyes Check    Target   tgt   By   where   Scroll Root Element locator

By default, Eyes selects the most appropriate element to scroll to execute the Fully keyword. You can use the scroll_root_element keyword to specify the element to scroll explicitly.

Timeout

Eyes Check    Target   tgt   By   where   Timeout int

Use this to define the timeout to use when acquiring and comparing screenshots for this target.

Send Dom

Eyes Check    Target   tgt   By   Send Dom   bool

Use this to enable or disable sending DOM for this checkpoint. This keyword overrides the global setting of sending/not sending the DOM for this checkpoint. The global setting is set using send_dom option.

Before Render Screenshot Hook

Eyes Check   tgt   By   where   Before Render Screenshot Hook   string

Use this to supply a JavaScript snippet that should be executed on the Ultrafast Grid before the DOM is rendered.

Special regions

When a checkpoint uses the Eyes Check followed by the Target keyword, you can optionally add any of the options listed below.

Accessibility Region

Eyes Check    Target   By   where   Accessibility Region By Coordinates   [L T W H] type
Eyes Check Target By where Accessibility Region By Element ${element} type
Eyes Check Target By where Accessibility Region By Selector selector type

Use this to define an accessibility region and its type. The type can be IgnoreContrast, RegularText, LargeText, BoldText, or GraphicalObject.

match levels regions

Eyes Check    Target ... By   where   Before Render Screenshot Hook  string

Use this to supply a JavaScript snippet that should be executed on the Ultrafast Grid before the DOM is rendered.

Eyes Check    Target tgt   By   wherematchlevel   Region By Coordinate s[L T W H] 
Eyes Check Target tgt By wherematchlevel Region By Coordinate
Eyes Check Target tgt By wherematchlevel Region By ${element}

Use this to define the type of matching done on the targeted region. The match type can be IgnoreColors, Layout, or Strict. See How to use Eyes match levels for a description of the different match levels.

Floating Region

Eyes Check   Target   tgt   By   where   Floating Region By Coordinates   [L T W H]    up   down  left  right
Eyes Check Target tgt By where Floating Region By Element ${element} up down left right
Eyes Check Target tgt By where Floating Region By Selector selector up down left right
Eyes Check Target tgt By where Floating Region With Max Offset By Coordinates [L T W H] offset
Eyes Check Target tgt By where Floating Region With Max Offset By Element ${element} offset
Eyes Check Target tgt By where Floating Region With Max Offset By Selector selector offset

Add one or more floating regions to this target. When you define a floating region, you define an inner region and an enclosing outer region. All the pixels of the outer region are considered as matched if the pixels of the checkpoint inner region match at least one area in the baseline outer region.

Ignore Region

Eyes Check    Target tgt   By   where   Ignore Region By Coordinates   [L T W H]
Eyes Check Target tgt By where Ignore Region By Element ${element}
Eyes Check Target tgt By where Ignore Region By Selector selector

Add one or more ignore regions to this target (i.e., areas whose content matches anything).

Locate

Eyes Locate    ${LOCATOR_NAME}    First
Eyes Locate locator1 name:locator2 All
Eyes Locate main-locator image:${IMAGE_PATH} All

Locates visual elements using the Applitools Eyes visual locator functionality.

Example .robot file

The following is an example of a .robot file with common test cases:

*** Settings ***
Library SeleniumLibrary
Library EyesLibrary web

Test Setup Setup
Test Teardown Teardown

*** Variables ***
&{LOGO} id=hplogo xpath=//*[@id="hplogo"]
${BROWSER} Chrome
${URL} https://applitools.github.io/demo/TestPages/FramesTestPage/

*** Keywords ***
Setup
Open Browser ${URL} ${BROWSER}

Teardown
Close All Browsers
Eyes Abort Async

*** Test Cases ***
Check Window
Eyes Open
Eyes Check Window Ignore Region By Coordinates [12 22 2 2]
Eyes Close Async

Check Window Fully
Eyes Open
Eyes Check Window Fully
Eyes Close Async

Check Region By Element
Eyes Open
${element}= Get WebElement id:overflowing-div
Eyes Check Region By Element ${element}
Eyes Close Async

Check Region By Selector
Eyes Open
Eyes Check Region By Selector id:overflowing-div
Eyes Close Async

Check Region By Selector With Ignore
Eyes Open
Eyes Check Region By Selector id:overflowing-div
... Ignore Region By Coordinates [12 22 22 22]
Eyes Close Async

Check Window Two Times
Eyes Open
Eyes Check Window first
Eyes Check Window second
Eyes Close Async

Check With Get All Tests Results
Eyes Open
Eyes Check Window
Eyes Close Async
${result}= Eyes Get All Test Results