Cannot pick image during XCUITest


:tada: Update (15 dec. 2020): This issue does not happen anymore :tada:
I cannot tell if it was fixed by Apple in Xcode 12.3, or if Bitrise team made some improvements recently.


We have been using Bitrise to run our XCUITests for our iOS apps. We use the “Xcode Test for iOS” step.

As part of our XCUITests, we have a scenario that includes picking an image from the standard iOS image picker (UIImagePickerController, or PHPickerViewController on iOS 14).

When the test runs locally (on my MBP), we have no issue displaying the image picker and picking an image.

However, when running on Bitrise, there seems to be something that prevents the image picker to load properly.

This is one of the screenshot taken during the UITest.

As you can see, the picker could not load, instead we have the following error:

Picker Unavailable
There was an error while preparing the picker. Please try again later.

I have created a very simple project to reproduce the issue: GitHub - simonliotier/XCUITests_UIImagePickerController_Bitrise: Demonstrate issue with `UIImagePickerController` when running XCUITests on Bitrise
The corresponding Bitrise app is Bitrise - Mobile Continuous Integration and Delivery - iOS & Android Build Automation
I have enabled Bitrise Support User on this app so the Bitrise Team should be able to access it.

Using the “Remote access with screenshare” feature of Bitrise, I was able manually run Xcode on the Bitrise machine, and launch the sample app. I was able reproduce the issue.
I also noticed the following logs in the Xcode console:

[Picker] Picker failed with error: Error Domain=PXErrorDomain Code=-1 “PHPickerViewController did timeout.” UserInfo={NSDebugDescription=PHPickerViewController did timeout.}
[Picker] Picker failed with error: Error Domain=PXErrorDomain Code=-1 “PHPickerViewController did receive interruption.” UserInfo={NSDebugDescription=PHPickerViewController did receive interruption.}
[lifecycle] [u FE6AD016-9AA6-41A3-BE84-B39134B192AD:m (null)] [com.apple.mobileslideshow.photospicker(1.0)] Connection to plugin interrupted while in use.
[lifecycle] [u FE6AD016-9AA6-41A3-BE84-B39134B192AD:m (null)] [com.apple.mobileslideshow.photospicker(1.0)] Connection to plugin invalidated while in use.
[Picker] Picker failed with error: Error Domain=NSExtensionErrorDomain Code=-2 “Extension cancelled by host.” UserInfo={NSLocalizedDescription=Extension cancelled by host.}
[Picker] Picker failed with error: Error Domain=NSCocoaErrorDomain Code=4099 “The connection to service on pid 0 named com.apple.mobileslideshow.photospicker.viewservice was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid.” UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.mobileslideshow.photospicker.viewservice was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid.}

So, it seems the picker cannot load because it timeouts :confused:

That’s a shame because, previously, when we were running our tests with Xcode 11/iOS 13, there was no issue. The picker may have taken some times to appear but we just had to wait. With iOS 14, it seems the picker chooses to simply fail if it can load fast enough.

Is there anything that you can do on your side to avoid this? Or should we consider that Bitrise machines are not fast enough to run this kind of test?

Thank you.

2 Likes

We are also experiencing the same behavior on our app with an Xcode 12 and iOS 14 stack.

It would be great for this issue to be addressed.

We also got the same issue :frowning:

Simon, Tim, and Paul -

I’m sorry that you haven’t received a response from Bitrise regarding this. I’ll be happy to dig in further.

If one of your could post a recent build with the problem and enable support access on your app, I’d appreciate it. (Simon, your support access has expired).

Matthew
Senior Customer Engineer

Sure. I’ve re-enabled support access and launched a new build (using Xcode 12.1). Still fails.
You should be able to access it. https://app.bitrise.io/build/3748a1d35d894b5b

Thanks.

I’m not sure what Apple did with the iOS 14 simulators, but they take dramatically more system resources than the iOS 13 ones did. I’ve verified this locally on my own machine, as well as inside of our VM’s.

You are correct, this is definitely being caused by a lack of available resources. Although all CI environments are somewhat performance constrained, I do have some good news. We’re going to be making some upgrades in the coming months that I think will alleviate this problem.

Unfortunately I don’t have any optimizations to suggest at this exact moment. If you create an organization I can set you up with a trial on our elite machines to see if that helps the issue. I’m not confident it will (the iOS 14 simulators are a beast), but it’s worth a shot.

Matthew
Senior Customer Engineer

Alright, we’ll check again after the upgrades. Thanks :slight_smile:

Simon

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.