【问题标题】:Automated Unit Test on Healthkit permissionHealthkit 权限的自动单元测试
【发布时间】:2019-01-15 03:37:44
【问题描述】:

我正在为 healthkit 编写一个 react-native 桥,其中包括 Healthkit 的初始化。我还需要为模块编写单元测试。

我想使用 Travis 对项目进行自动测试。因此,我需要一种可以按下Allow 按钮的自动方式。否则权限UI会阻塞单元测试过程。

所以,我需要知道如何自动按下允许按钮。

【问题讨论】:

    标签: ios objective-c react-native travis-ci


    【解决方案1】:
    【解决方案2】:

    我可以通过以下方式访问这些按钮:

    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.tablesapp.navigationBars.buttons

    的结果>

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-02-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-19
      • 2011-01-12
      • 1970-01-01
      相关资源
      最近更新 更多