Is there a way to send the application to background? Similarly to how you can call XCUIApplication.terminate(), I have some UI Elements to test on applic
In Xcode 9.0, Apple introduced XCUIApplication.activate(). activate() will launch the application if necessary, but will not terminate it if it is already running. Thus:
func testExample() {
// Background the app
XCUIDevice().press(.home)
// Reactivate the app
XCUIApplication().launch()
}