Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

interact with system level alert dialog in calabash ios

I am using calabash cucumber to test my iphone app. In my app i am using system level alert dialog for enabling current location. I need to identify whether there is any alert dialogs displayed on the screen. But i am not able to identify the system level alert dialog. I tried below script. but not working.

query("view:'UIAlertView'",:message)
element_exists("alertView child label marked:'#{message}'")

please help me. I need to click on "OK" button in the dialog.

like image 828
andro-girl Avatar asked Oct 16 '13 11:10

andro-girl


1 Answers

I think that by 'system level alert' you mean an alert generated by the OS.

Examples of this kind of alert are 'Some App wants to use your location' and 'Some App wants to send you notifications'.

To interact with these alerts, you must use the uia_* functions and you must allow calabash to launch your app with Instruments.

# check if the alert exists
if uia_query(:alert).count > 0
   # dismiss by touching 'OK'
   uia_tap_mark 'OK'
end
like image 62
jmoody Avatar answered Oct 16 '22 17:10

jmoody