Manoj
Manoj

Reputation: 1540

Unable to set Device Orientation in XCUITest on Swift 4

I have been running the tests successfully till Xcode 8. After updating to Xcode to 9 & 9.0.1 and upgrading to swift 4 number of problems has been araising one after the other.

Now code compiles and launches the app(Finally) but when setting the simulator orientation app crashes with following error.

caught nsinternalinconsistencyexception activity cannot be used after its scope has completed

This is how I set my orientation

 XCUIDevice.shared.orientation = .portrait

Upvotes: 4

Views: 1176

Answers (1)

Manoj
Manoj

Reputation: 1540

Untill xcode 8, subclassing XCUITest class and rotating the device from setup() function was allowed. But from xcode 9 it should be done only in the testFunctions()

Upvotes: 5

Related Questions