Detecting running XCUITest on iOS

Hello, we have an issue with our automated tests on BrowserStack.

In our app we use Microsoft’s AppCenter for distribution and once app is installed from there, an alert asking user to log in to AppCenter appears. If confirmed, it opens a web view to log in. After successful login, user can get an in-app information that there is a new build/version available for download.

So far we managed to skip the alert by implementing tapping on the alert to cancel the log in, but since a few days ago something changed and a web view appears instead of the alert.

So my question is, is it possible to somehow detect in code that automated tests are being run so that we can disable this login process completely instead of handling it? We’re using Xcode 11.3.1.

This seems like something BrowserStack should be able to help you with. Are they not responsive to your queries? We don’t use them currently but in the past I’ve found them pretty responsive:

https://www.browserstack.com/support