Closed johnryan closed 10 years ago
On iOS 7 I am able to dismiss a UIAlertView by waiting and tapping views with the Accessibility Label that is the same as the Title of the specific button.
[tester waitForTappableViewWithAccessibilityLabel:@"Ok"];
[tester tapViewWithAccessibilityLabel:@"Ok"];
I am not yet able to wait for a specific UIAlertView if there are multiple alerts with the same button options such as "Ok"
This works for UIAlertViews that I create, but it doesn't work for system level alerts. For example, when I request to access the device address book the device pops up an alert that I can't seem to access.
Unfortunately there's no 'official' way to bypass or click this alert view away since 'evil' developers could use this method to access your contact or location data in a real applications without your permission. But I found this nice thread (https://groups.google.com/forum/#!topic/kif-framework/xayP4VVBPyg) which explains a valid solution for unit testing purposes. I only used it to avoid the location popup but I think it should also work for contacts.
Amazing, thanks so much for the tip.
@johnryan could you please share your solution here, I encounter the same issue.
@cybertk I just used the solution posted above (https://groups.google.com/forum/#!topic/kif-framework/xayP4VVBPyg). Unfortunately it doesn't seem to work on device, but it works in simulator.
@johnryan Thank you!, it worked well in simulator.
I stumbled across this and the plist workaround posted above didn't work for me. Instead I used the changes introduced in https://github.com/kif-framework/KIF/pull/510
- (void)acknowledgeSystemAlert;
Interesting, thanks for the heads up @Benuuu
My application requires contact access, so I would like to dismiss the alert view that shows when you request contact permission. I have tried finding the view in the window and tapping the screen at the correct point but neither seem to dismiss the alert. I'm not sure if apple provides a way of dismissing this type of system alert.