I also ran in to this problem with a device running iOS 17.3 and Xcode 26.2.
After running the XCUITests multiple times one after another, at some point the app would become really slow running on the device with XCUITest stuck waiting for the app to idle. Restarting the device would then allow the app to launch normally when run from XCUITests.
I updated the device to iOS 18.7.8 and the problem no longer happens. Seems to be a bug in iOS 17.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: