复制运行状况工具包数据的自动测试的示例

运行状况应用自动测试复制错误示例

此存储库演示在 GitHub Action Runner 环境中运行的 iOS 模拟器实例上的运行状况应用不会在“浏览”部分中显示任何内容,因此无法测试在 UI 测试中添加外部 HealthKit 数据(如 EEG 数据)。

预期行为

  1. 下载并安装 Xcode 14.1
  2. 重置模拟器以获得完全干净的实例
  3. Run the UI Tests in this Repo by opening .TestApp.xcodeproj
  4. The unit tests open the Health App and add Health Data using UI tests. You can observe the behavior in the iOS Simulator and see the Results in the Health App:

Observed Behaviour on GitHub Action Runners

  • The GitHub Action Runners run the same UI tests using the GitHub Action found in : ..github/workflowsbuild_and_test.yml
  • The tests fail as the HealthKit’s “Browse” tab does not include any content, e.g.,: https://github.com/CardinalKit/HealthKitTest/actions/runs/3466876834.
  • The GitHub Action demonstrates this behavior as the UI tests create a screenshot on save and saves it in a package..xcresult
  • You can download the results bundle as an artifact created by the UI test and observe its behavior in Xcode by opening the .TestAppUITests.xcresult
  • The following screenshot taken from the https://github.com/CardinalKit/HealthKitTest/actions/runs/3466876834 GitHub Action’s file from the GitHub Action run demonstrates this behavior:.xcresult

GitHub

点击跳转