Device can be rotate by changing orientation in XCUIDevice.shared().orientation:

XCUIDevice.shared().orientation = .landscapeLeft
XCUIDevice.shared().orientation = .portrait