XCUITest accessibility snapshot reports stale frames during live scene resize

We exercise four layout modes in our SwiftUI app and need to drive them in UI tests. While a scene is resized live via xcrun devicectl device appResize, XCUITest's accessibility snapshot appears to carry a stale scale. With 951×669 requested, app.windows.firstMatch.frame comes back as {317, 223}, which is inconsistent with the app's own reading of its window (951×629 from our debug readout). Individual element frames are similarly tiny (a text label reports 2.9×0.9 pt). As a result .tap() appears to target the right element but the sheet never opens. We verified this with debugDescription dumps across two separate attempts, on clean boots. Is this a known limitation of XCUITest during live scene resizing, and is there a supported way to force the accessibility snapshot to refresh after a resize?

Answered by DTS Engineer in 906649022

Hi @omerfarukballi,

If accessibility frames appear misaligned or too small during layout modifications, ensure that your interactive elements define appropriate content shapes so that assistive technologies and automated tests can accurately hit-test the views.

If stale accessibility snapshots persist during live device resizing operations via devicectl, developers can file bugs and feature requests using Feedback Assistant to report discrepancies between app-reported window sizes and XCUITest bounding boxes.

Please file a bug report via Feedback Assistant. After reproducing the issue, make sure you gather an Xcode sysdiagnose and attach it to your report. Once filed, please respond here with the Feedback ID.

Cheers,

Paris X Pinkney |  WWDR | DTS Engineer

Hi @omerfarukballi,

If accessibility frames appear misaligned or too small during layout modifications, ensure that your interactive elements define appropriate content shapes so that assistive technologies and automated tests can accurately hit-test the views.

If stale accessibility snapshots persist during live device resizing operations via devicectl, developers can file bugs and feature requests using Feedback Assistant to report discrepancies between app-reported window sizes and XCUITest bounding boxes.

Please file a bug report via Feedback Assistant. After reproducing the issue, make sure you gather an Xcode sysdiagnose and attach it to your report. Once filed, please respond here with the Feedback ID.

Cheers,

Paris X Pinkney |  WWDR | DTS Engineer

XCUITest accessibility snapshot reports stale frames during live scene resize
 
 
Q