Appium Testing on Perfecto
Run accessibility testing on mobile applications with Appium, now supported on Perfecto!
Deque has partnered with Perfecto 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 Perfecto devices, then review the results in our online axe DevTools Mobile Dashboard.
Prerequisites:
- Access to Perfecto automation testing
- API Key for axe DevTools Mobile
- Your tests running against Appium version 2.11.3 or above
- Your tests using the AxeUIAutomator or AxeXCUITest Appium drivers
How to Take Accessibility Scans
Perfecto 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:
- Set the Automation Name to
AxeUiAutomator2
for Android orAxeXCUITest
for iOS. (Note the Axe prefix.) - Provide your Deque API key for authentication.
- Execute the script
mobile: axeScan
each place in your tests you'd like to take an accessibility scan. - After running your tests on Perfecto 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
Refer to the code below to configure your Appium tests for accessibility testing with the Perfecto platform and run accessibility scans.
Enable our drivers, configuring the automationName
capability based on the platform:
Android Configuration
The automationName
should be set to AxeUiAutomator2
. The appPackage
value is the package name of the Android app under test.
{
"automationName": "AxeUiAutomator2", // Note the 'Axe' prefix.
"appPackage": "<your-app-package>"
}
iOS Configuration
The automationName
should be set to AxeXCUITest
. The bundleId
value is the bundle identifier of the iOS app under test.
{
"automationName": "AxeXCUITest", // Note the 'Axe' prefix.
"bundleId": "<your-app-bundle-id>"
}
Scan for Accessibility
Appium supports multiple programming languages. The JavaScript snippet below shows capabilities required for axe DevTools Mobile being added to test scripts - namely, your axe DevTools Mobile API key. You can create a custom name for your scans for better traceability. Trigger an accessibility scan using the mobile: axeScan
command.
const axeSettings = {
apiKey: '<your-api-key-here>', // axe DevTools Mobile API key
scanName: '<your-scan-name-here>' // Optional: Customize the scan name
tags: ['tag-one', 'tag-two'] // Optional: Add tags, to more easily find and group scans
};
const result = await driver.execute('mobile: axeScan', axeSettings);