0

I need to test various alerts that comes when network disconnects at various points of test flows. So I need to disconnect iPad/simulator from network. Is there any way where we can toggle network settings during tests execution time from within the tests ?

I have searched and found it is not possible : Is it possible to disable the network in iOS Simulator? But, the response here is old , wondering do we have some approach now ?

Community
  • 1
  • 1
Kabs
  • 149
  • 1
  • 6

1 Answers1

1

Using function performTaskWithPathArgumentsTimeout on UIAHost you can run any program on your computer (if you know the absolute path).

If you can write a program or script (e.g. using osascript) which will turn your internet connection off, then it's possible.

I am actually using this function to open a web page in the simulator which redirects to a link handled by my application, thus testing the behavior when the application is opened from the browser.

Sulthan
  • 123,697
  • 21
  • 207
  • 260