I've downloaded the latest xCode 9 GM and I face an issue with :
- (id <NSObject>)addUIInterruptionMonitorWithDescription:(NSString *)handlerDescription handler:(BOOL (^)(XCUIElement *interruptingElement))handler; - method . I use it in a test case , where I have to dissmiss a System Notification . If I place the breakpoin inside the block - it appears that the block is never called , and the Notification is never dissmissed , so my test do not pass . Here is some code I use :
[self addUIInterruptionMonitorWithDescription:@"MyApp Would Like to Send You Notifications" handler:^BOOL(XCUIElement * _Nonnull interruptingElement) {
XCUIElement *element = interruptingElement;
XCUIElement *allow = element.buttons[@"Allow"];
if ([allow exists]) {
[allow tap];
return YES;
}
return NO;
}];
// tap somewhere in the app , workaround for a known issue
[self.app tap];
The code above work just fine in the previous xCode 8.3.3 , so if there are any ideas how to solve that , it will be great . Thanks in advance .
EDIT :
It appear that it is connected with the simulator that I am using , if I use the iPhone 8 Simulator , the method works just fine , in all other cases : iPhone 5, iPhone 5s, iPhone 6, iPhone 6 Plus, iPhone 7, iPhone 7 Plus - it behave just like I wrote above , Simulator versions are 10.3.1 , exept the 8th iPhone line - version 11 .