Xcode 7 UI Testing: Rotation

Is it possible to change the devices orientation during a test with the Xcode 7 UI Testing tools?

Yes, I've been playing around with this and have had success with using the following:


XCUIDevice.sharedDevice().orientation = .LandscapeLeft
XCUIDevice.sharedDevice().orientation = .Portrait


There are other options, but these commands have worked while using the UI Testing Tool.


Alternatively if you have an exact orientation you want to capture, you can use the Recording and submit the Landscape switch command to the simulator. Typically it's "Command + Arrow Left" or "Command + Arrow Right"


On the simulator you can check by going to the menu bar "Hardware" -> "Rotate Left" etc.

Xcode 7 UI Testing: Rotation
 
 
Q