I've been wanting to run a simple UI test against an iOS project (actually just the 'Welcome to Xamarin Forms' project which is templated), but have had some issues getting the test to run. I am currently using xcode version 8.0 and xamarin studio version 6.1 (build 5441). A colleague of mine has created the same project, but with a different version of xcode and xamarin studio (7.3.1 and 5.10.3 (build 51) respectively). His UI test seems to run fine, where as mine errors with:
System.InvalidOperationException : Sequence contains no matching element.
Just to emphasise again, these are identical solutions, in so far as they are both templated, and no further code has been added. Here is some basic information about the project we created: I used Xamarin Studio Professional 6.1, and created a multi-platform Xamarin.Forms App targetting iOS using a shared library with an automated UI test project.
I did notice that some package versions were slightly different between my solution and my colleagues, these are as listed below (mine are in bold). However, I did roll back my package versions to match my colleagues and still got the same error as above, which leads me to believe it may be an xcode versioning issue.
Xamarin.Forms 22.214.171.12435 - 126.96.36.199
Xamarin.TestCloud.Agent 0.16.2 - 0.19.0
Nunit 2.6.3 - 2.6.3
Xamarin.UITest 1.1.1 - 1.3.7
It was only after a couple of days that I actually got my colleague to build and run the UI test from scratch on his machine, resulting in a pass. During that time I did try to fix the error above. The few things I tried are listed below:
I managed to fix the
System.InvalidOperationException : Sequence contains no matching element error by updating the Xamarin.UITest package to 2.0.0-beta03, but this only led to another error:
System.Exception : Unable to contact test backend running in app. A common cause is that the app is not properly linked with Calabash. Please verify that it includes the Calabash component.
Without going through every potential fix I tried, quite a few are listed within this forum post: xamarin21.rssing.com/browser.php?indx=23562832&item=10801. I did also try resetting content and settings in the simulator, as well as deleting the bin/obj folders, re-building and so on.
I could build and run TestApp.iOS with a simulator, and curl Calabash from Terminal using the following command:
curl http://localhost:37265/version. This would return me JSON, which makes me believe my app was properly linked with Calabash, however, if I tried doing the same curl when running my Testapp.UITests in the same way, I would get a connection refused error. I am aware this could have been a red herring though (I have no prior experience with Calabash).
So, to cut a long story short, has anyone else encountered this problem? Is this a known versioning issue? I have done a lot of searching but haven't found anything to suggest so. In the mean time I'm rolling back my xcode version to see if that's definitely a fix.
Happy to elaborate on any of the above.