[Xcode 13 Blocker] Our tests are encountering "Error: Failed to set device orientation: Not authorized for performing UI testing actions."

Our snapshot tests are encountering "Error: Failed to set device orientation: Not authorized for performing UI testing actions" when we call XCUIDevice.sharedDevice.orientation = UIDeviceOrientationPortrait or similar.

From a post on Flutter's GitHub issues, I gather that this error is new in iOS 15 SDK / Xcode 13. Now it seems unless you're actually running XCUITests, you cannot change the properties of XCUIDevice.sharedDevice.orientation.

OK, but if that's the case, how do we change it then?

I tried to look for WWDC videos on this subject, but the link for the WWDC session "Create Great Tests With Xcode 13" does not have a video or anything. https://developer.apple.com/news/?id=5mm81ukv Why is this video missing?

Details of the exception:

Exception _XCTestCaseInterruptionException * 0x60000082b060 0x000060000082b060

Post not yet marked as solved Up vote post of O_G Down vote post of O_G
1.3k views

Replies

Even I am facing same issue.