Removing iOS permission alert for local notifications when running app in simulator

后端 未结 2 1288
感动是毒
感动是毒 2021-02-05 11:55

I\'m trying to write an acceptance test in KIF on an app that asks for local notification permissions pretty early on. Unfortunately due to iOS simulator security reasons it isn

2条回答
  •  暖寄归人
    2021-02-05 12:39

    Unfortunately, I don't think in an automation test there is a good way to do this. I know that even resetting the simulator isn't sometimes enough to reset permissions. I would design your tests to not test a system call, but your own application code.

    One way to test different functionality based on whether the user allows notifications is to extract the call to check for permissions and then stub this method out in the testing. This method would be the best practice since the goal is not to test if iOS works but if your application code is correct.

提交回复
热议问题