WWDC 2023: Perform accessibility audits for your app

Find hereafter a detailed summary of a video that belongs to a taxonomy of some WWDC footages.

The original video is available on the Apple official website (session 10035).

"Discover how you can test your app for accessibility with every build. Learn how to perform automated audits for accessibility using XCTest and find out how to interpret the results. We'll also share enhancements to the accessibility API that can help you improve UI test coverage."

Hereafter, the underlined elements lead directly to the playback of the WWDC video at the appropriate moment.

Overview #

The Accessibility Inspector is the Xcode developer tool that performs audits and analyzes the issues to provide a complete list of accessiblity problems to be solved in the sample app that will be used throughout this session.

Perform an audit #

Pressing the Run Audit button displays a screen including a filter for showing specific types of items in the main table that will point out the issues.

Using the new performAccessibilityAudit method on the XCUIApplication is the appropriate way to automate audits in the UI tests (demo).

In order to continuously keep on testing despite the potential issues, it's crucial to adapt the continueAfterFailure instance property to the suitable value before launching the tests.

Issues #

The Source Editor displays all the issues in correspondence with the line to which it relates.

Report Navigator #

Instead of investigating by one's own, it may be wise to involve the Report Navigator for getting more relevant information that provide accurate details.

Handling the audit issues #

🎬

This issue describes the way VoiceOver executes its vocalization (the label first and next the value) and highlights the importance of the accessibility identifier in the UI test process.

🎬

Pointing out the uselessness of a description for a decorative image, this second issue shows how to put aside an element of the accessibility area.



Filtered issues #

In order to set aside some false-positive issues, the performAccessibilityAudit method comes in handy with its two incoming parameters: the first one filters the types to be audited and the second one defines the way to be executed through a closure.

Caveats #

Automation elements #

Following the same rationale as the accessibilityElements, the automationElements property defines an array of the elements in the container to be part of the automation.

This new instance property turns out to be efficient when it becomes important to expose elements for automation but not for accessibility and vice versa.