How to ignore system dialogs for IOS platforms when running tests in test cloud

Hi,

During the test execution for IOS platform a system alert dialog popup before the test step one is finished (see attached picture) . Since it is ”outside” of the application itself and out of our control, how can you ignore the system dialog regarding, permissions, assertions and alerts dialog that IOS populates?

Can you set some value in the project solution in the class ”AppInitializer” before the actual test starts, or some method to ignore all systems dialog windows during test execution?

I have tried this:

        AppResult[] results = app.Query(element => element.Raw("button {text CONTAINS 'inte'}"));
        if (results.Any())
            app.Tap(allowButton => allowButton.Raw("button {text CONTAINS 'inte'}"));

        else
                         ……

The query does not seem to be able to find anything that contains ‘inte’. But, it should work.

Thanks in advance,
Best regards,
Mattias Edman.

Best Answer

Answers

  • ColinDabritzColinDabritz USUniversity ✭✭

    When using the older framework, via XCode 7, these sorts of dialogs were being dismissed automatically. Using the new test frameworks via XCode 8 we are seeing the same issue.

    I can't find the dialog via a query or searching the 'tree' command, it appears to be inaccessible as far as I can tell.

    I do not have a solution for this problem yet, is there new functionality I missed or that is being worked on to address this?

  • MattiasEdmanMattiasEdman USMember ✭✭

    For the moment, we are disable all system dialogs to get around this.

  • Glenn.WilsonGlenn.Wilson USXamarin Team Xamurai

    If an iOS system dialog was dismissed automatically with UITest and Xcode 7 it should also be automatically dismissed with UITest 2.0.0 and Xcode 8 (but note the second bullet below). If that is not the case give us the particulars here or in a support case.

    We recognize system dialogs to dismiss by partial text matching. There are two categories of dialogs we miss.

  • ColinDabritzColinDabritz USUniversity ✭✭

    Ok, we're definitely hitting a mid-test dialog issue with a camera permissions dialog. I'll install final UITest 2.0 and latest agent and verify, then write it up. It's pretty standard 'APP wants to use the camera' ok / dismiss stuff.

    Thanks for the prompt reply, and thanks for the stable UITest so promptly after all these changes!

  • ColinDabritzColinDabritz USUniversity ✭✭

    tl; dr: Still an issue on latest with these phrases of permissions:
    "[our app]" Would Like to Access the Camera
    "[our app]" Would Like to Access Your Photos

    On latest stable UITest 2.0.0 and Agent 0.20.3, this still appears to be an issue in our case with two of our tests.

    We have a third party barcode scanning plugin that needs access to the camera. We had to add explicit camera permission to the info.plist to avoid crashing at this point in XCode 8 / iOS 10. This occurs in the middle of using our app, when a user presses a 'scan' button, so I don't think this is a startup timing issue as we are in the middle of working automation control and the automation has already performed several steps at this point.

    The camera case looks like this:

    1. The test 'user' presses the 'Scan' button, activating the third party camera based barcode scanner.
    2. The dialog pops up immediately.

    The dialog reads: "[our app]" Would Like to Access the Camera

    The two options are: Don't Allow | OK

    1. The test eventually times out.

    Also note an App.Repl() at this point can't see or interact with the dialog, which may be expected.

    We also see this in a 'add photo from gallery' case.

    1. The test 'user' pushes a button to 'add photo'
    2. The dialog pop up immediately.

    the dialog reads: "[our app]" Would Like to Access Your Photos

    The two options are: Don't Allow | OK

    1. The test eventually times out looking for the next screen, which hasn't appeared yet.

    If I manually add permissions in these cases, the tests then run without issue.

    Let me know if you need screenshots or supporting details. I am sometimes on the Xamarin Slack in #TestCloud as well.

    Thank you so much for your quick response to such a large platform change! We appreciate the updates greatly.

  • Glenn.WilsonGlenn.Wilson USXamarin Team Xamurai

    @MattiasEdman The dialog you show in a screenshot is not one we automatically dismiss with Xcode 7 or Xcode 8. I'll DM you to get more information about the language and text in the dialog so we can add it.

    @ColinDabritz I believe that the dialogs you are describing "should" be automatically detected and dismissed already. I'll DM you to get more info.

    And yes, it is normal that you can not "see" the alert dialog in Repl.

  • MattiasEdmanMattiasEdman USMember ✭✭

    @Glenn.Wilson , Im using Visual Studio 2015, with UITest 2.0.0Beta, I will update to the stable version 2.0.0.

    Im using Swedish language in Test Cloud.

  • MattiasEdmanMattiasEdman USMember ✭✭

    @Glenn.Wilson

  • abrahamarias.4682abrahamarias.4682 USMember
    edited November 2016

    how can we auto-accept the dialogs for camera, location etc? , having problems with this on iOS right now

  • MattiasEdmanMattiasEdman USMember ✭✭

    Im running a test app for IOS "10.1.1", "10.0.3" and "10.0.2". But, in 10.1.1 I got this popup (see file). This seems to be a new behavior when running test apps for this specific iOS version. How to handle this? Message says "Developers for this app need to update this app so compability is improved" Any workaround for this?

    Why 10.1.1 iOS version and not "10.0.3" and "10.0.2"?

    Best regards,

  • JoshuaMoodyJoshuaMoody USXamarin Team Xamurai

    @ColinDabritz I am the engineer responsible handling privacy alerts. I want to try to reproduce your problem locally. Can you send me steps to reproduce?

  • ColinDabritzColinDabritz USUniversity ✭✭

    Hi Joshua,

    I'll get in touch with you Via DM for details.

  • 15mgm1515mgm15 USMember ✭✭✭✭

    @ColinDabritz Did you found a solution for this?

  • ColinDabritzColinDabritz USUniversity ✭✭

    Hi. My specific issue with this problem was resolved a while ago, in the latest Xamarin.UITest. If you ensure your test support packages are up to date you should not be seeing this issue any more. If you have the latest packages and have verified that this is still consistently an issue for you, I think it's time for a support ticket, and possibly more details here.

    My workaround was simply to use 'categories' to tag any test that caused the problematic dialogs, and ignored those tests in my submission to test cloud.

    https://developer.xamarin.com/guides/testcloud/uitest/working-with/nunit-categories/

    Hope that helps.

  • 15mgm1515mgm15 USMember ✭✭✭✭

    Thanks for the information Colin.

  • jsmirnoffjsmirnoff ARMember ✭✭

    We did a custom implementation of google sign-in for android app. The issue that we are having is that we don't see the open dialog message. So we cannot access to the app. Also we tried to press the coordinate of the bottom but we have the same problem.

    I'll appreciate your help!

  • SteveDixSteveDix USMember ✭✭

    We are having a similar issue to this. When running our app we get a system alert popup asking for access to the camera. This is being dismissed automatically for all languages correctly apart from German.
    When the device is set to German language and region the alert appears and is not being accepted so the test now fails.
    Is this a known problem and is there a workaround?
    Thanks.

Sign In or Register to comment.