我正在为Healthkit编写一个react-native桥,其中包括healthkit的初始化。我还需要为模块编写单元测试。
我想使用Travis对该项目进行自动测试。因此,我需要一种可以自动按下Allow按钮的方式。否则,权限UI将阻塞单元测试流程。
所以,我需要知道如何自动按下allow按钮。

发布于 2019-01-15 13:14:59
发布于 2021-01-19 02:59:47
我可以使用以下命令来访问这些按钮:
lazy var turnOnAllCategories = app.tables.cells.firstMatch
lazy var allowCategoriesConnectionButton = app.navigationBars.buttons.element(boundBy: 1)在我的测试中,我检查弹出表单是否显示为:
if turnOnAllCategories.waitForExistence(timeout: waitForExistenceTimeFrame) {
turnOnAllCategories.tap()
allowCategoriesConnectionButton.tap()
}请记住,根据您的UI,您可能需要更多地过滤app.tables和app.navigationBars.buttons的结果
https://stackoverflow.com/questions/54192377
复制相似问题