In Xcode UI Testing is it possible to get the orientation of the view

Viewed 2265

For my app I am trying to run a basic UI test on whether the view stays fixed in its orientation when the actual device is rotated. I know how to simulate the physical rotation (using UIDeviceOrientation), but is there a way to get the orientation of the actual view?

3 Answers

sharedDevice has been renamed. Now you can get and set the value like this.

XCUIDevice.shared.orientation = .portrait
Related