ios - Dismissing location and notifcation settings Xcode Ui testing -


i writing ui tests app. have 2 alerts, location , notifications. struggling find solution in order dismiss these alerts.

currently using

systemalertmonitortoken = adduiinterruptionmonitorwithdescription(systemalerthandlerdescription) { (alert) -> bool in     if alert.buttons.matchingidentifier("ok").count > 0 {          alert.buttons["ok"].tap()          return true      } else {          return false      } } 

and

let notifications = self.app.alerts.element.collectionviews.buttons["ok"] if notifications.exists {     notifications.tap() } 

however both functions not allowing me dismiss alerts.

edit

now have added

  app.buttons["ok"].tap()     app.tap() 

to code, means tests failing due xct looking button "ok" straight away when isnt notification pops straight away. want alert ok dismissed when pops not on first thing launch.

the interruption monitor trigger next time try interact app, need have code after interruption monitor registered whatever want after dismissing alert, e.g tapping button in ui.

when code gets part next interact ui, handler completion handler executed , system alert dealt with.


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -