What's a good alternative to setting XCUIDevice.shared.orientation for changing the orientation during XCTests in Xcode 13?
Many of our app's existing snapshot tests set the device orientation using:
XCUIDevice.shared.orientation = orientation.deviceOrientation
However in Xcode 13, these tests fail due to the following exception being thrown when this method is called:
Failed to set device orientation: Not authorized for performing UI testing actions. Exception _XCTestCaseInterruptionException * 0x60000082b060 0x000060000082b060
Googling this error led me to find this Flutter issue where they state:
I guess Xcode 13 will limit the use of XCUIDevice to XCUITests.
Our snapshot tests are not XCUITests, though, so what options do we have to force a particular device rotation so that we can snapshot the way the view would look in landscape and portrait?