Watch XCUITest for complications?

Are there commands for testing watch complications in XCUITest?

So far I see that we can press the home button and rotate the Digital Crown in test

As of Xcode Version 14.0 beta (14A5228q) the XCUITest record function doesn't work. Can't find anything in debugDescription to helpout either with reaching complications

https://developer.apple.com/documentation/xctest/xcuidevice/button

Hello!

UI recording only works for apps that you have developed, so it does not work to record system apps.

On watchOS, the SpringBoard equivalent is called Carousel. Carousel's bundle identifier is "com.apple.Carousel"

You should be able to navigate to the watch face screen of your watchOS device (real or simulated) using a home button press https://developer.apple.com/documentation/xctest/xcuidevice/1619052-press

Then, create an instance of XCUIApplication that references Carousel https://developer.apple.com/documentation/xctest/xcuiapplication/2879415-init

let watchOS = XCUIApplication(bundleIdentifier: "com.apple.Carousel")

You can print out the accessibility tree of Carousel using the app's debug description:

print(watchOS.debugDescription)

This should list all of the interactable elements on screen, including your complication if it is being used!

You can write a normal UI test from that point.

Watch XCUITest for complications?
 
 
Q