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
才能用