小编MeG*_*aPk的帖子

Xcode UI Testing允许系统警报系列

我有问题,如果我尝试允许系列系统警报,只工作一次,下一个警报不"允许"我谷歌搜索更多时间,并知道该帖子:(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)

xcode objective-c ui-testing ios xcode-ui-testing

4
推荐指数
1
解决办法
3252
查看次数

标签 统计

ios ×1

objective-c ×1

ui-testing ×1

xcode ×1

xcode-ui-testing ×1