我有问题,如果我尝试允许系列系统警报,只工作一次,下一个警报不"允许"我谷歌搜索更多时间,并知道该帖子:(Xcode 7 UI测试:如何解雇一系列系统警报代码)没什么..不行.这是我当前的代码,首先警告"允许"成功,未检测到下一个警报..
XCUIApplication *app = [[XCUIApplication alloc] init];
app.launchEnvironment = @{
@"isUITest" : @YES,
@"withFakeData" : fakeData
};
[app launch];
for (int i = 1; i <= self.possibleSystemAlerts; i++) {
NSLog(@"%d", i);
XCTestExpectation *expectation = [self expectationWithDescription:@"High Expectations"];
id monitor = [self addUIInterruptionMonitorWithDescription:@"Push notifications" handler:^BOOL(XCUIElement *_Nonnull interruptingElement) {
XCUIElement *element = interruptingElement;
XCUIElement *allow = element.buttons[@"Allow"];
XCUIElement *ok = element.buttons[@"OK"];
if ([ok exists]) {
[ok tap];
[expectation fulfill];
return YES;
}
if ([allow exists]) {
[allow forceTap]; …Run Code Online (Sandbox Code Playgroud)