1. UI测试

1.1. 系统通知

都用addUIInterruptionMonitorWithDescription来实现


    XCUIApplication *app = [[XCUIApplication alloc] init];

    // 定位
    [self addUIInterruptionMonitorWithDescription:@"Location Dialog" handler:^BOOL(XCUIElement * _Nonnull interruptingElement) {
        XCUIElement *button = interruptingElement.buttons[@"Allow"];
        if ([button exists]) {
            [button tap];
            return YES;
        }
        return NO;
    }];

    // 通知
    [self addUIInterruptionMonitorWithDescription:@"User Notifications" handler:^BOOL(XCUIElement * _Nonnull interruptingElement) {
        XCUIElement *button = interruptingElement.buttons[@"OK"];
        if ([button exists]) {
            [button tap];
            return YES;
        }
        return NO;
    }];

1.2. Q1:自动录制的中文报错

输出的中文都是unicode编码的,\U需要改成\u才能用

1.3. Q2: UI Testing Failure - Failure getting list of active applications: AX error -25205

https://forums.developer.apple.com/thread/20611 重启Xcode好了

1.4. Reference

results matching ""

    No results matching ""