Appium Testing with Digital.ai

This page is not available in the language you requested. You have been redirected to the English version of the page.
Link to this page copied to clipboard

Add accessiblity scans to your Appium tests with Digital.ai!

Not for use with personal data

Deque has partnered with Digital.ai to bring accessibility testing to your existing automation test workflows. Add accessibility scans to your Appium tests with axe DevTools Mobile, run your tests on Digital.ai devices, then review the results in our online axe DevTools Mobile Dashboard.

Prerequisites:

How to Take Accessibility Scans

Digital.ai has pre-installed the axe Appium drivers on their Appium servers. These drivers enable you to run accessibility scans from your Appium tests. Deque's AxeUiAutomator2 and AxeXCUITest drivers are forked from the UiAutomator2 and XCUITest drivers. We fork but do not change the core functionality of these drivers. Your tests will run as expected, and you'll have the added capability to take accessibility scans!

The key steps to configure your Appium tests for accessibility testing are:

  1. Set the Automation Name to AxeUiAutomator2 for Android or AxeXCUITest for iOS. (Note the Axe prefix.)
  2. Provide your Deque API key for authentication.
  3. Execute the script mobile: axeScan each place in your tests you'd like to take an accessibility scan.
  4. After running your tests on Digital.ai devices, review your results on the axe DevTools Mobile dashboard.

Refer to our setup guide for Appium to learn how to customize your configuration and leverage results of accessibility scans to best serve your team, and see a full list of Appium sample tests. The setup guide and examples are general and do not contain everything you need for the Digital.ai integration.

Examples

The examples below show how to configure your Appium tests for accessibility testing with the Digital.ai platform. These examples are written in Java; however, Appium supports multiple programming languages.

Android

@BeforeMethod
public void setUp() throws MalformedURLException {
      desiredCapabilities.setCapability("accessKey", ACCESS_KEY); // Digital.ai's Access Key
      desiredCapabilities.setCapability("deviceQuery", "@os='android'");
      desiredCapabilities.setCapability("appium:automationName", "AxeUiAutomator2");
      desiredCapabilities.setCapability("app", "cloud:com.experitest.ExperiBank/.LoginActivity");
      desiredCapabilities.setCapability("appPackage", "com.experitest.ExperiBank");
      desiredCapabilities.setCapability("appActivity", ".LoginActivity");
      desiredCapabilities.setCapability("appiumVersion", "2.16.2");
      driver = new AndroidDriver(new URL("https://<your_cloud_url>/wd/hub"), desiredCapabilities);
      Map<String, Object> settings = new HashMap<>();
      List<String> tags = new ArrayList<>();
      settings.put("apiKey", API_KEY); // axe DevTools API Key
      settings.put("scanName", "Axe driver"); // a customized scan name to better identify scans within the dashboard.
      settings.put("tags", tags); // an array of strings to apply to scans as tags.
      driver.executeScript("mobile: axeScan", settings);    
  }

iOS

@BeforeMethod
public void setUp() throws MalformedURLException {
      desiredCapabilities.setCapability("accessKey", ACCESS_KEY); // Digital.ai's Access Key
      desiredCapabilities.setCapability("deviceQuery", "@os='ios'");
      desiredCapabilities.setCapability("appium:automationName", "AxeXCUITest");
      desiredCapabilities.setCapability("app", "cloud:com.experitest.ExperiBank");
      desiredCapabilities.setCapability("bundleId", "com.experitest.ExperiBank");
      desiredCapabilities.setCapability("appiumVersion", "2.16.2");
      driver = new IOSDriver<>(new URL("https://<your_cloud_url>/wd/hub"), desiredCapabilities);
       Map<String, Object> settings = new HashMap<>();
      List<String> tags = new ArrayList<>();
      settings.put("apiKey", API_KEY); // axe DevTools API Key
      settings.put("scanName", "Axe driver"); // a customized scan name to better identify scans within the dashboard.
      settings.put("tags", tags); // an array of strings to apply to scans as tags.
      driver.executeScript("mobile: axeScan", settings);  
  }