What app provides system alerts in VisionOS? iOS and iPadOS has springboard app, but VisionOS doesn’t

  Kiến thức lập trình

I want to automate tests for my iOS app and start writing UITests.
Sometimes system alerts appear, and my tests have to simulate button tapping.
In iOS and iPadOS these alerts are available via the system Springboard application:

let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
let cancelButton = springboard.alerts.buttons["Cancel"].firstMatch
if cancelButton.exists {
    cancelButton.tap() // <-- cancel button taps, and test continue working
}

But when I launch my test in the Vision Pro simulator, the springboard is not available:

let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
print(springboard.exists) // <-- "false" will be printed, springboard does not exist

It means that I can’t automate button tapping in system alerts.


So, my question is:
How can I access system alerts in VisionOS and tap buttons by UITests?

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT