有没有办法在模拟器中使用 xcuitest 框架来自动化面部 ID 或触摸 ID。我可以手动执行注册面部/触摸 ID 并执行匹配或不匹配的场景。但我想知道它是否可以自动化?
Given 这个帖子 https://medium.com/kinandcartacreated/so-you-want-to-automate-ios-biometrics-81bd015f5d38作者:Kane Cheshire,可以通过发送 Darwin 通知来自动化触摸 ID 和面容 ID 进行单元测试,如下所示:
+ (void)enrolled {
int token;
notify_register_check("com.apple.BiometricKit.enrollmentChanged", &token);
notify_set_state(token, 1);
notify_post("com.apple.BiometricKit.enrollmentChanged");
}
但仅在 Objective-C 中,因此您可能需要使用桥接标头。
导入文件Biometrics.m https://github.com/KaneCheshire/BiometricAutomationDemo/blob/master/BiometricsAutomationDemoUITests/Biometrics.m and Biometrics.h https://github.com/KaneCheshire/BiometricAutomationDemo/blob/master/BiometricsAutomationDemoUITests/Biometrics.h从他的demo https://github.com/KaneCheshire/BiometricAutomationDemo在 Github 上,你将能够调用Biometrics.enrolled()
从你的XCTestCase
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)