XCUITest fails because of accessibility not loading

Hi all,

I ran into an XCUITest issue where my tests fail randomly with the message that my app "has not loaded accessibility"

I run the tests in my scheme in random order and with every run, some other random test fails and a test that previously failed would later pass. So I know it's not my test as-such that is causing the problem.

There seems to be a 60s wait for accessibility to load, and I have not found any information how I could extend the timeout or convince accessibility to load faster.

I found some older posts, but no real solution was found there either.

This completely blocks my test execution since I cannot get a single run in where the tests all pass (and I only have 10 tests in that scheme). I ran the scheme against an iOs sim and against a real iOS device and I get the same random accessibility errors on either execution platform. I've tried iOS17.2 & 17.4 and get the same behavior.

Strange enough, the test actually keeps running (and technically passes all the checks and asserts in the actual test) after the accessibility error, but then XCTest marks it as failed because of the early accessibility error.

Any ideas what I could try or what the reason could be?

Thanks!

--

I'm using XCode Version 15.3 (15E204a) and test iOS17.2 and iOS17.4

Test Case '-[MyScheme.MyTestClass testMyFunction]' started.
    t =     0.00s Start Test at 2024-04-19 01:32:09.225
    t =     0.02s Set Up
    t =     0.02s     Open com.myCompany.myApp
    t =     0.03s         Launch com.myCompany.myApp
    t =     0.25s             Wait for accessibility to load
    t =    60.30s                 Capturing diagnostic spindump
/Users/some/path/goes/here/MyTestCase.swift:120: error: -[MyScheme.MyTestClass testMyFunction] : Application 'com.myCompany.myApp' has not loaded accessibility
    t =    60.34s             Waiting 60.0s for "test" Button to exist
    t =    61.38s                 Checking `Expect predicate `exists == 1` for object "test" Button`
    t =    61.39s                     Checking existence of `"test" Button`

... more stuff happening in the test here ...

Hello, could you please file a Feedback Assistant report with logs from both your Mac and iOS devices? And please feel free to post the ID of the report here to help us track it. Thank you!

XCUITest fails because of accessibility not loading
 
 
Q