worthy-applitools
v3.5.21
Published
Applitools visual tests
Downloads
7
Readme
Applitools - cross browsers visual tests
Description:
This is an npm package for creating visual/UI tests with applitools, selenium and mocha, but only after installing the worthy-selenium-webdriver or having infrastructure for webdriver.
First what is applitools?
Applitools was founded by software developers on a mission to shorten the release cycles of their product Despite having good unit test coverage and automated end-to-end functional tests, to have a full automated regression of the UI, covering multiple operating systems, web browsers, screen resolutions, and localizations.
Applitools provides service to automate all the visual tests including running on several devices and browsers.
Basically it renders the application dom and captures a screenshot while comparing it to the original baseline.
Notify when a difference between the 2 screenshots appear.
Why as NPM package?
The goal is to implement this tool in any service that requiers visual test, create an isolated tests for each service.
Caveat
Aplitools capture a screenshot of the application after it renders the dom application on several devices, which means the tests takes time.
Installation
npm install worthy-applitools
In order to create applitools tests you have to have worthy-selenium-webdriver package already installed.
for the structure of the tests
npm install mocha
Usage
SetUp.test.ts -
Optional - this is a commented class that can help you set the setup test class easily.
Set up basic configuration for running an applitools test, this class uses methods from the applitools base class.
Like setting the visual grid runner for running the tests on different browsers and devices, set the eyes object and etc.
For examples and docs go to -> https://applitools.com/docs/api/eyes-sdk/classes-gen/class_visualgridrunner/method-visualgridrunner-visualgridrunner-selenium-java.html
ApplitoolsBase.ts -
a. Eyes -
This method set the eyes object for using the methods of the eyes.
getAndSetEyes();
After you set the eyes object you use eyes open to open the connection to applitools inside your
test
Call this method at the beggining of your test before calling any of the check methods.
await eyesOpen();
b. getRunner - Use this method to create a runner that manages tests of the Ultrafast Grid to render screenshots. Pass this object to each Eyes constructor.
let runner = getRunner();
eyes = new Eyes(runner);
c. getConfiguration - Use this method to configure you confoguration for the test, set the application name, api key(applitools user id) and add several devices and borswers that the test will run on.
d. closeEyes - This method close the eyes object - print errors when there are UI differences.
EyesActions -
a. eyesCheck - create a check in your tests Calling this method renders the dom and capture the screenshot.
Note: this must be called after eyesOpen();
eyesCheck(whatIsTheCheck: string);