How can I trigger the following behavior in Swift UI Tests via XCTest:
Get the app to foreground and inactive (applicationWillResignActive
) and back to "foreground and active" (applicationDidBecomeActive
)
Possible gestures, while app is in foreground and active, could be:
- open app switcher and go back to app
- open control center and hide control center
- open notification center and hide notification center
I searched for something like that following fictive(!) code XCUIDevice.shared.doublePress(XCUIDevice.Button.home)
or XCUIDevice.shared.swipeDownFromOutside(); XCUIDevice.shared.swipeUpFromOutside()
.
Or a more better way a method call to simulate an open app switcher, control center or notification center immediately.
Or in the best way to simulate the status applicationWillResignActive
, applicationDidBecomeActive
immediately.
Important to understand: the event applicationDidEnterBackground
must not called - the app has to stay in foreground (but inactive)!