mobile-a11y-test-author
Authors native mobile accessibility tests covering iOS (Accessibility Inspector, XCUITest `performAccessibilityAudit()` introduced in iOS 17, VoiceOver label/trait/hint verification) and Android (Espresso `AccessibilityChecks.enable()`, Accessibility Scanner, TalkBack traversal, `contentDescription` labelling) with WCAG-aligned checks for element labels, 44pt/48dp touch targets, contrast ratios, and focus order. Use when an iOS or Android app needs automated and manual accessibility test coverage beyond what `xcuitest-suite` or `espresso-suite` provide.
Install with skills.sh (any agent)
npx skills add testland/qa --skill mobile-a11y-test-authormobile-a11y-test-author
Overview
Native mobile accessibility testing spans two complementary layers:
This skill covers both layers on iOS and Android. Full per-platform detail lives in references/ios-audit.md and references/android-checks.md.
Nearest neighbors and differentiation:
When to use
iOS - core audit
performAccessibilityAudit() (iOS 17+) audits the current view and fails the test automatically if any issue is found - no explicit assertion needed (wwdc23 (opens in new window)).
import XCTest
final class HomeAccessibilityTests: XCTestCase {
override func setUpWithError() throws {
continueAfterFailure = true // report ALL issues per screen, not just the first
XCUIApplication().launch()
}
func testHomeScreenAudit() throws {
try XCUIApplication().performAccessibilityAudit()
}
}Scoped audits, false-positive suppression, audit-per-screen, VoiceOver label/trait/hint checks, 44pt touch targets, and Accessibility Inspector are in references/ios-audit.md.
Android - core checks
AccessibilityChecks.enable() fires the Accessibility Test Framework on every Espresso perform() call; setRunChecksFromRootView(true) checks the whole hierarchy, not just the interacted view (atf (opens in new window)). Requires the espresso-accessibility dependency.
import androidx.test.espresso.accessibility.AccessibilityChecks
@RunWith(AndroidJUnit4::class)
class CheckoutAccessibilityTest {
init {
AccessibilityChecks.enable().setRunChecksFromRootView(true)
}
@Test
fun applyPromoCode() {
onView(withId(R.id.promo_field)).perform(typeText("WELCOME10"), closeSoftKeyboard())
onView(withId(R.id.apply_button)).perform(click())
// checks fire automatically on every perform()
}
}The dependency, suppression, 48dp touch targets, contrast thresholds, contentDescription labelling, and the TalkBack manual workflow are in references/android-checks.md.
CI integration
iOS (GitHub Actions)
jobs:
a11y-audit:
runs-on: macos-15
steps:
- uses: actions/checkout@v5
- run: |
xcodebuild test \
-project MyApp.xcodeproj \
-scheme MyApp \
-destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' \
-only-testing MyAppUITests/HomeAccessibilityTests \
-resultBundlePath A11yResults.xcresult
- uses: actions/upload-artifact@v4
if: always()
with:
name: a11y-xcresult
path: A11yResults.xcresultAndroid (GitHub Actions)
jobs:
a11y-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
script: ./gradlew connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.example.CheckoutAccessibilityTest
- uses: actions/upload-artifact@v4
if: always()
with:
name: a11y-test-results
path: app/build/outputs/androidTest-resultsAnti-patterns
| Anti-pattern | Why it fails | Fix |
|---|---|---|
continueAfterFailure = false in audit tests | Stops after the first issue; misses the rest on the same screen | Set continueAfterFailure = true for audit tests (wwdc23 (opens in new window)) |
| No suppression closure; globally ignoring an audit type | Hides all failures of that type, not just the known one | Suppress by both auditType and element.label (references/ios-audit.md) |
Setting accessibilityLabel to the element type | "Submit button" - VoiceOver already announces "button" from traits | Set label to purpose only: "Submit order" (uia (opens in new window)) |
contentDescription on every Text composable | Redundant; TalkBack reads text content automatically | Omit for plain text; set only for icon-only or image elements (cd (opens in new window)) |
Running AccessibilityChecks without setRunChecksFromRootView(true) | Checks only the interacted view; off-screen violations pass | Enable root-view mode (Android core, above) (atf (opens in new window)) |
| Manual TalkBack only, no automated checks | Inconsistent; regressions slip in on refactors | Pair TalkBack manual review with AccessibilityChecks in CI |
Limitations
References
Android accessibility test detail
View source (opens in new window)Android accessibility test detail
Extends the core AccessibilityChecks.enable() example in ../SKILL.md (opens in new window). Checks run automatically on any ViewActions action and cover the acted-on view plus all descendant views (atf (opens in new window)).
Add the dependency
// app/build.gradle
dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-accessibility:3.6.1'
}Enable checks from the root view
import androidx.test.espresso.accessibility.AccessibilityChecks
@RunWith(AndroidJUnit4::class)
class CheckoutAccessibilityTest {
init {
AccessibilityChecks.enable().setRunChecksFromRootView(true)
}
@Test
fun applyPromoCode() {
onView(withId(R.id.promo_field)).perform(typeText("WELCOME10"), closeSoftKeyboard())
onView(withId(R.id.apply_button)).perform(click())
// checks fire automatically on every perform()
}
}setRunChecksFromRootView(true) evaluates the whole hierarchy, not just the interacted view (atf (opens in new window)).
Suppress known issues
AccessibilityChecks.enable().apply {
setSuppressingResultMatcher(
allOf(
matchesCheck(TextContrastCheck::class.java),
matchesViews(withId(R.id.decorative_watermark))
)
)
}The matcher must satisfy both the check type and the specific view (atf (opens in new window)).
Touch target size (48dp minimum)
Each interactive UI element should have a focusable area of at least 48dp x 48dp (atgt (opens in new window)). AccessibilityChecks validates this on every perform() call.
Contrast thresholds
AccessibilityChecks (via the Accessibility Test Framework) checks these on every perform() call (contrast (opens in new window)):
contentDescription labelling
Convey purpose, not visual detail (cd (opens in new window)):
// Icon-only button: set contentDescription
Icon(
imageVector = Icons.Filled.Share,
contentDescription = stringResource(R.string.label_share)
)
// Decorative image: suppress from accessibility
Icon(
imageVector = Icons.Filled.Decoration,
contentDescription = null // TalkBack skips this element
)Verify with Espresso:
onView(withId(R.id.share_button))
.check(matches(withContentDescription(R.string.label_share)))TalkBack manual workflow
Enable via Settings > Accessibility > TalkBack > On, then (at (opens in new window)):
Manual checklist:
References
iOS accessibility test detail
View source (opens in new window)iOS accessibility test detail
Extends the core performAccessibilityAudit() example in ../SKILL.md (opens in new window). The audit is available from iOS 17 and fails the test automatically when it finds an issue, so no explicit assertion is needed (wwdc23 (opens in new window)).
Scope the audit to specific categories
try app.performAccessibilityAudit(for: [.dynamicType, .contrast])Pass an XCUIAccessibilityAuditType option set. Documented audit types include .dynamicType and .contrast; passing no argument runs all available checks (wwdc23 (opens in new window)).
Suppress known false positives
try app.performAccessibilityAudit(for: [.contrast]) { issue in
// Ignore the decorative watermark label (no contrast fix planned)
if let element = issue.element,
element.label == "WatermarkLabel",
issue.auditType == .contrast {
return true // suppress this issue
}
return false
}The closure receives an XCUIAccessibilityAuditIssue; return true to suppress. Narrow suppressions by both auditType and element.label so real regressions still fail (wwdc23 (opens in new window)).
Cover each screen
Each call inspects only the currently visible elements. Navigate to every distinct screen and re-run the audit:
func testCheckoutFlowAudit() throws {
let app = XCUIApplication()
app.launch()
try app.performAccessibilityAudit() // Screen 1
app.buttons["place-order-button"].tap()
try app.performAccessibilityAudit() // Screen 2
}VoiceOver label, trait, and hint checks
accessibilityLabel is the localized string VoiceOver reads to identify an element, accessibilityHint describes the action result, and accessibilityTraits communicates purpose - common values are .button, .link, .header, .image, .staticText, .adjustable (uia (opens in new window)). Production code sets them; XCUITest verifies via XCUIElement.label:
// Production (UIKit)
let submitButton = UIButton()
submitButton.accessibilityLabel = "Submit order"
submitButton.accessibilityHint = "Places your order and charges the saved card"
submitButton.accessibilityTraits = [.button]// Test
func testSubmitButtonLabel() {
let btn = XCUIApplication().buttons["Submit order"]
XCTAssertTrue(btn.exists, "VoiceOver cannot find the Submit button")
XCTAssertEqual(btn.label, "Submit order")
}Touch target size (44pt minimum)
The minimum control size on iOS and iPadOS is 44x44 pt (hig (opens in new window)). Assert via XCUIElement.frame:
func testSubmitButtonTouchTarget() {
let frame = XCUIApplication().buttons["Submit order"].frame
XCTAssertGreaterThanOrEqual(frame.width, 44, "Touch target width below 44pt")
XCTAssertGreaterThanOrEqual(frame.height, 44, "Touch target height below 44pt")
}Accessibility Inspector (manual complement)
Open it from Xcode menu > Open Developer Tool > Accessibility Inspector. It runs the same checks as performAccessibilityAudit() interactively on real devices and simulators - use it to diagnose an audit failure before writing a suppression (wwdc23 (opens in new window)).
References
Related skills
appium-testing
Wires Appium for cross-platform mobile UI automation - uses the WebDriver protocol, picks a driver per platform (XCUITest for iOS, UiAutomator2 / Espresso for Android, Mac2 for macOS, Windows for desktop), authors tests in JS / Python / Java / Ruby / .NET, configures `desiredCapabilities`, runs against simulators / emulators / device farms. Use when a single test suite must cover both iOS and Android, or when the team's stack is multi-platform (iOS + Android + Mac + Windows).
detox-testing
Authors React Native E2E tests with Detox (Wix) - gray-box architecture (runs in-process with the app), `element(by.id|by.text|by.label)` matchers, `waitFor()` for explicit sync beyond Detox's automatic async tracking, Jest runner. Use when the app is React Native and speed matters. For Flutter use flutter-testing; for black-box cross-platform use appium-testing; for YAML-declarative flows use maestro-flows; for non-RN native use xcuitest-suite or espresso-suite.
espresso-suite
Authors Espresso UI tests for Android - uses `onView(withId(...)).perform(...).check(matches(...))`, leans on Espresso's automatic synchronization (no `Thread.sleep`), wires `IdlingResource` for app-specific async, runs via `./gradlew connectedAndroidTest` and parses the JUnit XML output. Use when an Android app needs UI tests in Google's first-party framework.
flutter-testing
Authors Flutter tests across the three-layer pyramid - unit (`flutter test`), widget (`testWidgets` + `WidgetTester`), integration (`integration_test` on simulator/emulator/device). Picks the right layer per change, mocks via `mockito` + `build_runner`, LCOV coverage, CI with the Flutter Action. Use when the app is Flutter and the team wants its first-party stack. For React Native use detox-testing; for black-box cross-platform use appium-testing; for YAML-declarative flows use maestro-flows.
maestro-flows
Authors Maestro YAML flow files (`.maestro/*.yaml`) for mobile + web UI automation: declarative `tapOn`, `inputText`, `assertVisible`, `swipe`, supported targets (iOS, Android, Flutter, React Native, web), nested flow imports, JavaScript hooks for complex conditions. Use when the team has already chosen Maestro, is coming from an existing `.maestro/` directory, or explicitly wants YAML-declarative tests readable by non-engineers without a compile step. For framework selection or authoring tests in XCUITest / Espresso / Detox / Appium / Flutter, use a mobile driver-selection or per-flow mobile test-authoring step instead.
mobile-device-matrix-toolkit
Dispatches mobile UI test runs across a 3-tier device matrix (smoke per-PR, regression per-merge, full farm at release) to control CI cost: generates per-target Appium capability configs from a central YAML, parallelises via GitHub Actions matrix strategy, and aggregates JUnit XML into a cross-device pass/fail table. Use when deciding which iOS / Android devices and OS versions to run tests on and at which stage (smoke / regression / full farm), not how to configure a specific test framework (for that, use xcuitest-suite, espresso-suite, etc.).
mobile-web-emulation-runner
Builds a workflow to run web E2E tests under mobile viewports + DPRs (device pixel ratios): Playwright's `devices` catalog (iPhone 15, Pixel 7), suite run per-device as matrix shards, per-device screenshots, mobile assertions (`.tap()`, viewport-conditional layout). Use when a responsive web app needs mobile-breakpoint regression without a real-device farm. Mobile WEB only - for native apps use appium-testing, detox-testing, or flutter-testing; for cross-shard aggregation use mobile-device-matrix-toolkit; for gesture sequences use touch-gesture-tester.
mobile-web-perf-budget
Pure-reference skill for mobile-web performance budgets - Core Web Vitals at the 75th percentile mobile (LCP ≤2.5s, INP ≤200ms, CLS ≤0.1; FID retired March 2024 in favor of INP), Lighthouse mobile profile config, per-route resource budgets (JS bundle, image weight, font load). Use as the team's reference for "what should the mobile perf gate enforce" - paired with `lighthouse-perf` (the runner) and `lighthouse-budget-author` (the per-route author).
touch-gesture-tester
Verifies touch-gesture handlers (tap, double-tap, long-press, swipe, pinch, rotate, pan) work as expected under both mobile-emulation (Playwright) and native (XCUITest / Espresso / Detox) - distinguishes "mouse click handler also fires on tap" from "real touch event fired with correct properties." Use when the app has bespoke gesture handlers (custom carousels, sliders, drag-drop, pull-to-refresh) and the team needs targeted gesture verification beyond generic UI assertions.
xcuitest-suite
Authors XCUIest UI tests for iOS / iPadOS / tvOS - uses the three-class XCUIApplication / XCUIElement / XCUIElementQuery pattern, sets accessibility identifiers on production code, runs via `xcodebuild test` with destination, parses the `xcresult` bundle. Use when an iOS app needs UI tests in Apple's first-party framework (no external runtime; native to Xcode).