Skip to content

Latest commit

 

History

History
45 lines (37 loc) · 2.52 KB

README.md

File metadata and controls

45 lines (37 loc) · 2.52 KB

RobotEyes

Visual Regression Library for Robot Framework

Uses Imagemagick to compare images and create a diff image. Also contains a report generator to create a custom visual test report.

  • Import the Library into your Robot test. Pass Mode("test" or "baseline") as argument.
  • Call open eyes method after opening the browser in your selenium test.
  • Use the capture full screen, capture element keywords to capture images.
  • Call the compare images keyword at the end of the test to compare all the images captured in the respective test.
  • Once done running the tests, execute the report generator script and pass the path to output directory .Eg reportgen results
  • A custom report will be generated at the root of your project.
  • It will display the baseline images if run on "baseline" mode. Baseline, Actual and diff in "test" mode.

Requirement

pip install robotframework-eyes
pip install pillow
Imagemagick (for mac: brew install imagemagick, linux: apt-get install imagemagick)

Example

*** Settings ***
Library Selenium2Library
Library RobotEyes test (or baseline, if running for the first time) 0.01(Global test tolerance, optional)

*** Test Cases ***
Sample visual regression test case
      open browser https://www.google.com/ chrome
      maximize browser window
      open eyes
      wait until element is visible id=lst-ib
      capture full screen 0.05(tolerance to override global value, optional)
      capture element id=hplogo
      compare images
      close browser

To generate the report: reportgen /path/to/output directory

Keyword Documentation

open eyes - Arguments: library name. Eg AppiumLibrary (optional) - (Gets current selenium/appium instance)
capture full screen - Arguments: tolerance (optional) - (Captures an entire page)
capture element - Arguments: locator - (Captures a region or an individual element in a webpage)
capture mobile element - Arguments: locator - (Captures a region or an individual element in a mobile screen)
scroll to element - Arguments: locator - (Scrolls to an element in a webpage)
compare images - Arguments: None - (Compares baseline and actual images of a testcase)