Hang when Running Unit Test that Import Photos

One of my unit test that imports Photos (iOS) hangs quite long until ci timeout. It keeps on happening even when I try to rebuild while on my local the unit test works fine and fast.

1 Like

Hi @willyjansen,

Can you please follow this guide How to debug your build locally / "It works on my Mac/PC but not on bitrise.io" and let us know how it goes?


  • Please do a clean git clone first, as advised in the guide
  • Please Reset your iOS simulator to restore its default state, which is how the simulator starts on the bitrise.io VMs
  • Keep an eye on any popup which you have to click manually, anywhere. On bitrise.io you obviously can’t click manually (in every build), that’s the most frequent cause of these “hangs” (the system waiting for a manual user input).

If that wouldn’t help please ping us through email or the onsite chat with the build’s URL and we’ll look into it ASAP!

I have tried that steps and the supposed test which caused bitrise ci to hang run normally on my local computer and the whole process finish in time.

Can you please copy paste the build’s Bitrise.io url? Or better, send it in email or through the onsite chat. We’ll look into it asap

Are you sure that it hangs? Did you try to just leave it running?

Asking because I did run a quick test build using the same params on your project in a separate private virtual machine (cloned from the exact same image your build is running in) and it did finish without issues. The fastlane step took about 15 mins (in the build you linked you aborted the fastlane step at around 12-13 mins)

Yes, it will hang on this particular unit test that import Photos as I mentioned before. If I just comment this particular unit test, it will go through within 15 minutes.

Does it happen every time on bitrise.io? Asking because I did run the exact same build on the private temp VM, in the exact same environment your builds are running in and it did not hang.

That branch contains the already commented unit test. Try this one:

You can see the build went on to 45 minutes and then time out right on the supposed unit test.

1 Like

Are you sure that you tried to Reset your iOS Simulator locally on your Mac before running the test?

The hang is caused by a popup which waits for manual input (as I mentioned above ;)):

I see. Is there any way to make sure this kind of unit test pass on bitrise?

Never mind, I have found the solution. Thank you for pointing out the problem.

1 Like

Any time :wink:

In case if someone would stumble upon this discussion, there’s a new option for debugging these kind of issues (hanging iOS build):

use the new step timeout parameter of the CLI in combination with a “Take Screenshot” script (screencapture "$BITRISE_DEPLOY_DIR/screenshot.png").

You can find the details in this blog post: https://blog.bitrise.io/set-step-timeout-to-check-why-your-build-hangs