Mobile Visual Test Automation with Applitools Eyes and Appium

In this article, I explained how to do automated mobile visual testing with Applitools and Appium. In the web world, there are many solutions for visual regression testing such as PhantomCSS, Webdrivercss, Huxley, Wraith, and much more. With Applitools Eyes you can do a visual comparison of both web, mobile web, and mobile native apps. You can use the Eyes class’s functions in your selenium codes.

I explained how to do Appium setup and how to write mobile automation code in this article. That’s why I do not want to go into those details in this article. I want to focus on how to integrate Applitools Eyes with Appium and do a simple visual mobile test automation.

First, open Genymotion Emulator and create a new device. Installation of Genymotion is described on this page. You can select personal use to use genymotion and you need to install Oracle VirtualBox.

When you open the GenyMotion, you will see a screen like the below based on the latest version. I did these steps on mac but the steps are similar on Windows as well.

Note: If you have a .apk with ARM-based, then you should use Android Studio and create a virtual device with API 30 as shown below.  In this way, you will not get “failed to extract native libraries, res=-113” error. You can check this here:

For this example, I will go with Genymotion and simple x86 based bitbar.apk.

Then, you can select a phone model as shown below. 

Continue with the Install button.

Wait for installation.

Then, click start and lets wait the emulator starts.

And, here we go! Galaxy 10S emulator started. :-)

Now, open Appium and check settings.

We will use sample bitbar.apk. First, you need to put this apk under C:\ApplitoolsApk\BitbarSampleApp.apk folder and then set this path in Appium settings.

Then, we need to install Appium and start it. The installation is described in this article.

Then, we need to move the apk to genymotion as shown in the below screenshot. 



Bitbar will be installed as shown below.


For the demo, Galaxy S10 is so new to the demo app that’s why I did the demo with Galaxy Nexus 4 device.

Drag and drop the bitbar.apk to the device and then updated the below setting, check Unknown Sources.

Now, we can write our test code.

Open IntelliJ and click File -> New Project and select Maven and click Next.

Then, write:

GroupId: AppliToolsEyesDemo

ArtifactId: AppliToolsEyesDemo

And click Next.

Write “AppliToolsDemo” as the project name and click “Finish”.

Then, open pom.xml and copy-paste the below codes.

Project GitHub Page:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns=""


        <!-- -->

        <!-- -->

        <!-- -->

        <!-- -->

Click test -> java and right click and create a new Java Class and give “AppliToolsDemo” as a class name then click the OK button.

Right click “AppliToolsEyesDemo” folder and create a new File and give “TestNG.xml” as a name.

After that, open “TestNG.xml” file and write the below code it.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "">

<suite name="AppliTools Demo Tests">
<test name="RunTest" preserve-order="true">
        <class name="AppliToolsDemo" />

Now, we can write our test code but before that, I want to summarize our test scenario:

  • Open BitbarSampleApp.apk
  • Visually check that the start screen is visually as expected?
  • Click the second option “Use Testdroid Cloud”
  • Visually check that the Second Option is clicked?
  • Write “SW Test Academy” to the text bar
  • Click Answer button
  • Wait until the second page appears
  • Visually check that the answer is correct
  • Close the driver.

As you can see in the scenario, we will make 3 visual comparisons. When you run your test, at first, AppliTools Eyes takes screenshots of the checkpoints and puts them under our test as baseline images. When you run your tests second, third, fourth times, and so on, AppliTools Eyes’s “eyes.checkWindow()” method will compare the actual screen with the baseline screen with given comparison match level as STRICT, EXACT, LAYOUT, CONTENT. In this article, we will make a STRICT comparison.

For match levels please read below page:

Now, Let’s log in to Applitools cloud test management panel from If you do not have an account, first you need to create a new account.

When you logged-in at the right corner, you will reach your profile details and you will get your API key from here.


At left pane, you can see your test runs highlighted with green when they passed and red when they failed. Also, you can all checkpoints when they passed they comprises of green + sing and when they failed, you see red + sign



When you open an image, you can reach the image control panel and in this panel, you can many operations as shown below image.


I think this is enough for Applitools Eyes control panel. Now, let’s start to write our test code. I wrote detailed inline comments in the code.

import com.applitools.eyes.MatchLevel;
import com.applitools.eyes.selenium.Eyes;
import io.appium.java_client.MobileElement;
import io.appium.java_client.remote.MobileCapabilityType;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

public class AppliToolsDemo {
    final   String        APP_NAME  = "BitbarSampleApp";
    final   String        TEST_NAME = "BitbarDemo";
    final   String        DEVICE    = "Galaxy Nexus 4";
    private AndroidDriver driver;
    private WebDriverWait wait;
    private Eyes          eyes;

    //Do the Setup before tests
    public void setUp() throws MalformedURLException {
        //Setup of Appium
        DesiredCapabilities caps = new DesiredCapabilities();
        caps.setCapability(MobileCapabilityType.DEVICE_NAME, "Galaxy Nexus 4");
        caps.setCapability(MobileCapabilityType.UDID, ""); //DeviceId from "adb devices" command
        caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
        caps.setCapability(MobileCapabilityType.AUTOMATION_NAME, "UiAutomator1"); //UIAutomator2 is only supported since Android 5.0
        caps.setCapability(MobileCapabilityType.PLATFORM_VERSION, "4.4");
        caps.setCapability("skipUnlock", "true");
        caps.setCapability("app", "/Users/onur/OneDrive/swtestacademy/stuff/bitbarapk/BitbarSampleApp.apk");
        caps.setCapability("noReset", "false");
        driver = new AndroidDriver<MobileElement>(new URL(""), caps);
        //Set Wait Time
        wait = new WebDriverWait(driver, 30);

        //Setup of Applitools Eyes
        eyes = new Eyes();
        //Set API Key of Eyes
        eyes.setApiKey("YOUR API KEY");
        //Set Match Level
        //Set host operating System as our device

    public void bitBarDemoTest() throws MalformedURLException, InterruptedException, URISyntaxException {
        //Open Eyes and start visual testing, APP_NAME, TEST_NAME);

        //Visual check point #1
        eyes.checkWindow("Start Screen");

        //Click second radio button

        //                + "/android.widget.LinearLayout/android.widget.LinearLayout[1]/android.widget.RadioGroup/android.widget"
        //                + ".RadioButton[2]"

        //Visual check point #2
        eyes.checkWindow("Answer selected");

        //Write "SW Test Academy" to text box
        driver.findElement("com.bitbar.testdroid:id/editText1")).sendKeys("SW Test Academy");

        //Click answer button

        //Synchronization after click. Wait until "You are right!" text appear on second screen

        // Visual validation point #3
        eyes.checkWindow("Answer is correct");

        // End visual testing. Validate visual correctness.

    public void teardown() {
        //close the app
        //Abort eyes if it is not closed

Before running our code please make sure that your Appium server and Genymotion emulator running. If these preconditions satisfied, then you can run your test code. After that, the Bitbar application will open and a new bitbar test created in the Applitools control panel as shown below.


At the first run, Applitools will save all images at checkpoints as baseline images.


We can also add some ignored comparison regions with rectangular selection. It is shown below.


For the second run, if your test will fail, Applitools Eyes will highlight problematic mismatches and your test will turn a red color.


When your test passed, your test is highlighted as red as all the checkpoints are displayed without mismatch error.


Onur Baskirt

6 thoughts on “Mobile Visual Test Automation with Applitools Eyes and Appium”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.