vendredi 5 février 2021

Checking for app installation in XCUITest

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.

Aucun commentaire:

Enregistrer un commentaire