I am trying to find a robust way to check if an app was downloaded via MDM and is available on the device. I would think the below would work:
let authenticatorApp = XCUIApplication(bundleIdentifier: "com.microsoft.azureauthenticator")
XCTAssert(authenticatorApp.waitForExistence(timeout: 60))
However this seems to always time out, even if the app is installed.
The only way I can think of requires checking the existence of an URL scheme, but I don't think that would work with all apps since some don't have one.
Is there any better way?
UPDATE: I tried do-catch of launch(), but it seems it doesn't throw an exception and always fails the test, so this won't work. Also I tried watching the state in a for-loop (with a sleep) but that didn't work either.
UPDATE2: I am not even able to get this working with the canOpenURL() route. I get "This app is not allowed to query" even when I add an entry in the "LSApplicationQueriesSchemes", and I heard this broke on some version of iOS (13?)
question from:https://stackoverflow.com/questions/66065409/checking-for-app-installation-in-xcuitest