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

cron - how to properly run Python script with crontab on every system startup -

elasticsearch - Is the order of operations guaranteed in a bulk update? -

Slow performance first queries on SQL Azure -