XCode 9 (currently in beta) has a method called activate that can be used to bring an application to the foreground: https://developer.apple.com/documentation/xctest/xcuiapplication/2873317-activate
Using the following code, I put the application into the background using the home button and then bring the application back to the foreground:
XCUIDevice.shared().press(XCUIDeviceButton.home)
let app = XCUIApplication(bundleIdentifier:"com.aaa.abc.xyz")
app.activate()
When the application is brought to the foreground, the user is taken back to the login screen. It behaves as if it does not have access to the token anymore which the tokens are currently stored in NSUserdefaults. Does activate not check here for tokens or clear it?
Using app.launch()
again does work but curious why activate()
does not?