I have a class teardown which is trying to remove the app, but it doesn\'t recognize app.terminate().
class DeviceSettingsUtilities : UITestUtilities {
func remo
This seems like a bug in latest Xcode 10.
XCUIApplication.terminate()
doesn't seem to work in tearDown()
when declared as class
.
This can be solved in two ways:
The first option is to use:
override func tearDown() {
XCUIApplication().terminate()
super.tearDown()
}
instead of:
override class func tearDown() {…}
Or, terminate the app differently (press home button, open different app...). However, I would use the first way.
Also consider reporting this to Apple, so they can fix it.
Edit: This has nothing to do with app state (XCUIApplication().state.rawValue
), since it is same in test and in tearDown()
(4 = running foreground
). Also - official documentation says that .terminate()
will terminate app, which has a debug session with Xcode, but the debug session is active in tearDown()
as well. So it is really probably a bug in Xcode.