The same tests sometimes fail and sometimes succeed, without any changes either in the code or the Workflow configuration.
When tests are flaky like this it's usually because of one of two things:
-
Your tests are reliant on an external network resource that should be mocked.
-
The simulator hasn't had a chance to warm up or recover from the previous test. In this case adding a delay before the test can help. Pre-starting the simulator can also help reliability greatly: you can add a Script Step before the tests run, such as this example:
npm install -g ios-sim ios-sim start --devicetypeid "com.apple.CoreSimulator.SimDeviceType.iPhone-8, 14.4" sleep 60