Forum Discussion

cgreenspan's avatar
cgreenspan
Occasional Contributor
10 years ago

iOS 9 Change In Notifications Alert After Uninstall/Reinstall

We've had an ongoing problem with iOS system alerts blocking our scripts from running, such as allowing notifications, location services, camera access, etc. Our workaround prior to iOS 9 was to install the app and accept all the prompts manually once, then they wouldn't come up again when the app was uninstalled/reinstalled from our scripts because the settings were remembered on the device.

 

Now with iOS 9, the notification setting is not saved. This means that every time our scripts run, the notification alert comes up and blocks the rest of our tests from running (I attached a screenshot of this alert). I also found this post with more detail about what's happening: https://forums.developer.apple.com/message/50273#50273

 

Has anyone else run into this and come up with any solutions? We've tried tapping a specific point on the screen, which doesn't work because TestComplete doesn't see the app when these alerts are up. We can't use ImageRepositories for the same reason. We haven't found any properties or settings to set these values or disable the prompts on the device or in TestComplete. One possible solution is to not uninstall the app every time our scripts run, but we really want a clean build every time so we don't keep any bad data around. If we leave it the way it is now, we have to manually tap "OK" to this prompt when it gets to that point in the script, which prevents us from running our tests on a schedule, e.g. every night.

 

Any ideas would be appreciated :)

 

Thanks,

Corey

  • Found a workaround!

     

    After installing the app and launching it, we get the Notification alert. This blocks the rest of the script from running. I noticed yesterday (by accident) that if the app is removed, installed, and launched again through our script with the alert still up, the script works! It just runs in the background behind the alert that is currently displayed.

     

    I'm not sure why this happens, but I think we can at least run our tests now without the manual step of allowing notifications.

     

    -Corey

  • cgreenspan's avatar
    cgreenspan
    Occasional Contributor

    Found a workaround!

     

    After installing the app and launching it, we get the Notification alert. This blocks the rest of the script from running. I noticed yesterday (by accident) that if the app is removed, installed, and launched again through our script with the alert still up, the script works! It just runs in the background behind the alert that is currently displayed.

     

    I'm not sure why this happens, but I think we can at least run our tests now without the manual step of allowing notifications.

     

    -Corey

    • AlexKaras's avatar
      AlexKaras
      Champion Level 3

      Hi Corey,

       

      Thank you for the update.

      Considering, that your workaround was noticed by Smartbear guys, I hope that they will pay their attention to this problem.

       

      P.S. Yes, your understanding as for my previous post was correct. I just hoped that maybe it is possible to set some attribute in the (debug version of the) tested iOS application so that all alerts are accepted automatically.

  • cgreenspan's avatar
    cgreenspan
    Occasional Contributor

    Hi Alex, thanks for the reply!

     

    To clarify, ImageRepository works for us, just not when this alert comes up. We can't select an image on the screen because TestComplete requires the tested app to be running, but it can't see the app in this case.

     

    The link you provided is a solution for Appium, not TestComplete. I've actually tried this and you can get around the issue in Appium, but I'm not aware of a way to get around it in TestComplete.

     

    Please correct me if I misunderstood or am wrong about something. I appreciate the help!

     

    Thanks!

    Corey