CreditCardValidator.IOS.UITest sample app hanging out of the box (on iOS simulator)

WilliamJockuschWilliamJockusch USMember ✭✭

When I download the sample project (zip file below) tell it to run all tests, the iOS app starts up, but it never enters any text. I've tried playing with the simulator keyboard settings, but it doesn't help.

Here is the method that is hanging, as annotated to describe my experience:

    [Test]
    public void CreditCardNumber_TooShort_DisplayErrorMessage()
    {
        Console.WriteLine("Hello");
        app.WaitForElement(c=>c.Class("UINavigationBar").Marked("Simple Credit Card Validator")); // does not hang the test
        Console.WriteLine("World"); // If I comment out all of the following app calls, I can see both "Hello" and "World" in the test output.
        app.EnterText(c=>c.Class("UITextField"), new string('9', 15)); // Hangs the test unless commented out
        app.Tap(c=>c.Marked("Validate Credit Card").Class("UIButton"));  // Hangs the test unless commented out
        Console.WriteLine("I wish I could get this far without commenting out both of the above lines");
        app.WaitForElement(c => c.Marked("Credit card number is too short.").Class("UILabel"));
    }

I am doing all of this from my MacBook Pro, running Xamarin Studio 5.10.1, build 3

Best Answer

Answers

  • WilliamJockuschWilliamJockusch USMember ✭✭

    This was indeed the correct answer. But anyone who is using it needs to be careful not to update NUnit!

  • @GlennWilson Hi, I've face the same situation today. When I run UI test with EnterText function it hangs for a couple of minutes and then exits with this message :

    POST Failed. No HttpWebResponse.
    Error while performing EnterText(Marked("UserField"), "UserName")
    Exception: System.Net.WebException: The request timed out
      at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00065] in /private/tmp/source-mono-mac-4.2.0-branch-c6sr1/bockbuild-mono-4.2.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.2.2/mcs/class/System/System.Net/HttpWebRequest.cs:946 
      at System.Net.HttpWebRequest.GetResponse () [0x0000e] in /private/tmp/source-mono-mac-4.2.0-branch-c6sr1/bockbuild-mono-4.2.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.2.2/mcs/class/System/System.Net/HttpWebRequest.cs:958 
      at Xamarin.UITest.Shared.Http.HttpClient.GetResponseViaRequest (System.Net.HttpWebRequest request) <0x63e7c10 + 0x00019> in <filename unknown>:0 
      at Xamarin.UITest.Shared.Http.HttpClient.Post (System.String endpoint, System.String arguments, ExceptionPolicy exceptionPolicy, Nullable`1 timeOut) <0x63e53c0 + 0x00397> in <filename unknown>:0 
    
    
  • Oh, I've found how to fix this.

    See this link.

    Solution:

    Launch iOS Simulator and uncheck the following option.
    iOS Simulator-> Hardware-> Keyboard -> Connect Hardware Keyboard
    
  • lanzelot1989lanzelot1989 ATMember ✭✭
    edited April 2016

    @Glenn.Wilson
    I am also having this problem (on a real iPhone), but only if the tests are started via Jenkins.
    Error while performing Tap(Marked("selector")) Exception: System.Net.WebException: POST Failed at Xamarin.UITest.Shared.Http.HttpClient.HandleHttpError (System.String method, System.Exception exception, ExceptionPolicy exceptionPolicy) <0x6be4788 + 0x00177> in <filename unknown>:0 at Xamarin.UITest.Shared.Http.HttpClient.SendData (System.String endpoint, System.String method, System.Net.Http.HttpContent content, ExceptionPolicy exceptionPolicy, Nullable1 timeOut) <0x5fc1d40 + 0x00667> in <filename unknown>:0 at Xamarin.UITest.Shared.Http.HttpClient.Post (System.String endpoint, System.String arguments, ExceptionPolicy exceptionPolicy, Nullable1 timeOut) <0x5fc0a70 + 0x00097> in <filename unknown>:0 at Xamarin.UITest.Shared.Http.HttpClient.Post (System.String endpoint, System.Object arguments, ExceptionPolicy exceptionPolicy, Nullable1 timeOut) <0x5fb35e0 + 0x0005f> in <filename unknown>:0 at Xamarin.UITest.iOS.HttpCalabashConnection.UIA (System.String command) <0x6b4ebb8 + 0x00093> in <filename unknown>:0 at Xamarin.UITest.iOS.iOSGestures.TapCoordinates (Single x, Single y) <0x6b4eab0 + 0x000e4> in <filename unknown>:0 at Xamarin.UITest.iOS.iOSApp+<Tap>c__AnonStorey9.<>m__0 () <0x6b4b9d8 + 0x002af> in <filename unknown>:0 at Xamarin.UITest.Utils.ErrorReporting.With (System.Action func, System.Object[] args, System.String memberName) <0x5fb20d0 + 0x00030> in <filename unknown>:0

    Does anybody have additional advice?

    I am using TestCloudAgent 0.19.0, Xamarin.UITest 1.3.7, OS X 10.11.4 and iOS 9.3.

  • lanzelot1989lanzelot1989 ATMember ✭✭
    edited April 2016
Sign In or Register to comment.