0

I use mac mojave 10.14.3 and react-native version - 0.59.1, fastlane latest version. I tried to run the fastlane screenshot via ios xcuitest But I couldn't dismiss the system alert. I have attached my code and alert screen

Could you please help me

addUIInterruptionMonitor(withDescription: "System Dialog") {
        (alert) -> Bool in
        let okButton = alert.buttons["OK"]
        if okButton.exists {
          okButton.tap()
        }

        let allowButton = alert.buttons["Allow"]
        if allowButton.exists {
          allowButton.tap()
        }

        return true
      }

      app.tap()
      snapshot("04EndRecord")

this is my alert and app. this alert shows outside of the app, then how can i handle that?

Microphone access alert

Siong Thye Goh
  • 3,518
  • 10
  • 23
  • 31
  • Which version of Xcode is being used? – Dan May 24 '19 at 07:41
  • You can use launch arguments of fastlane in the code to disable the system alerts to popup while snapshot is run [Check this link](https://docs.fastlane.tools/actions/snapshot/#launch-arguments) – Pavan Kotesh May 24 '19 at 07:41
  • @Dan - XCode version - 10.1 (10B61) – Abdul Rahman May 26 '19 at 08:25
  • Thanks @PavanKotesh This system alert automatically triggered after a user interaction. any example for this launch arguments? – Abdul Rahman May 27 '19 at 12:16
  • There must be some code which triggers the system alert. Can't be automatic. For example push notifications alert is triggered by registering for APNS. – Pavan Kotesh May 28 '19 at 05:59
  • This is an issue with XCode 10.1. Upgrading to 10.2 will not prompt you for the microphone continuously - https://stackoverflow.com/questions/53285441/ios-simulator-would-like-to-access-microphone-every-time – Dan May 28 '19 at 07:55

2 Answers2

0

Are the system alerts automatically triggered or after a user interaction ? You should add your InterruptionMonitor before the dialogs are triggered.

cesarmarch
  • 617
  • 4
  • 13
0

I faced this issue a few months ago. It appeared when I wanted to use sounds in the app. I disabled sounds during running UI tests.

Can you apply the same process to your app ?

cesarmarch
  • 617
  • 4
  • 13