Applitools visual validations

SRF enables you to include Applitools visual validations in tests running against or from SRF. When your SRF test run is complete, the visual validation step statuses and screenshots are also included in the SRF run results.

SRF supports the integration of Applitools with LeanFT or Selenium for JavaScript only.

Perform Applitools visual testing from SRF

Before you start running tests with Applitools visual testing steps, you must have:

  • An active Applitools account.

  • Correct Applitools API key provided for your Applitools account, defined in the SRF settings. For details, see Connect to Applitools.

Then, do any of the following:

Record Applitools steps

Add Applitools steps directly to your test while recording.

For details, see Record scripts.

Run tests with Applitools steps remotely

Upload tests with Applitools steps

To run Applitools validations as part of your LeanFT or Selenium test run, add explicit Applitools API calls to your scripts before uploading or running them remotely.

For details, see:

Access run results

After running your tests, either in SRF or remotely, view Applitools step results from the SRF run results.

For details, see Drill down to Applitools data.

Back to top

Add Applitools code to your LeanFT script

SRF supports Applitools with LeanFT scripts in JavaScript only.

Add code to your LeanFT test script to instruct SRF to report Applitools validations, while running remotely from LeanFT.

The following steps use JavaScript in the code samples.

Do the following:

  1. Install the eyes.leanft module using the following command:

    npm install eyes.leanft --save

  2. Add the following line to the start of your test:

    var EyesLeanFT = require('eyes.leanft');
  3. Then, add your Applitools steps. Use the following syntax:

     // Initialize the eyes SDK and set your private API key.
     var eyes = new Eyes();
     // Define the OS and open the Applitools session.
     eyes.setHostOS("<Operating system. For example: Windows 10>");, "<APP NAME>", "<TEST NAME>", { width: 800, height: 600 });
     browser.navigate("<URL to open. For example:>");
     eyes.checkWindow("<Applitools validation name. For example: Click>");
     // End visual testing. Validate visual correctness.
     return eyes.close(false).catch() // Make sure the next 'then' success callback always get called.
      .then(function () {
  4. Add additional code as required for all Applitools tests. For more details, see Applitools Resources.

For more details, see:

Back to top

Add Applitools code to your Selenium script

SRF supports Applitools with Selenium scripts in JavaScript only.

Do the following:

  1. Install the eyes.selenium module using the following command:

    npm install eyes.selenium --save

  2. Update your Selenium test.

    Add code to your Selenium test script to instruct SRF to report Applitools validations.

    Use the following code snippet to get started:

    .then(function(session) {
     eyes.addSessionEventHandler(RemoteSessionEventHandler.createSessionEventHandler(srfServer, session.getId())); 

Proxy settings

If you are working with a proxy, configure the proxy server using the Applitools Eyes SDK. Use the following method before starting an Eyes test:


Selenium and Applitools sample code

Update this code sample as follows before running your test:

  1. Update the following Applitools and SRF-specific values:

    applitoolsApiKey Enables snapshot recording for each visual validation performed in the test.
    srfServerUrl The URL of your SRF server.
    srfClientID / srfClientSecret

    Your SRF client secret values.

    For details, see Manage remote access.

    proxyUrl Required to run remote tests from behind a firewall.
  2. Comment out irrelevant code, depending on whether you're using a proxy, or running a remote or uploaded test.
  3. Update the environment capability values as needed.
  4. Update the test steps as needed.

For more details, see:

Back to top

See also: