Remove application after test and also the BT connections

I want to install application in my real IOS device and connect to bluetooth device, than to uninstall the app + remove the bluetooth device, what is the best approach to do it?

I think this is the best strategy:

  1. Install App normally with Appium
  2. Background app for -1 seconds (infinity)
  3. Traverse Springboard to Settings App
  4. Drill down to Bluetooth settings and connect device
  5. Do other test requirements
  6. If you left Settings, get back to it and remove Bluetooth device
  7. Finish test with capabilities ‘fullReset: true, noReset: false’
  8. Next test

That seems to cover everything.

@wreed I thought to do it also in that way but I thought maybe appium has solution to that situation where one of the capabilities (ex. fullReset) will do it but I guess there is no solution in that way.
If I going in that way, since IOS all the time search for Bluetooth devices, and in my environment there is many devices, what is the best approach to select the device that I want from the menu over there? the menu is changing each moment (and I just have the name of the device)?
Thank you

Bluetooth is tricky. If it were me and I only needed one device I would try to isolate so that the menu is a bit more static, but if these devices are all around your test machine there isn’t much you can do about it.

@wreed and what we can do about that the list is all the time is updated? we can’t choose from it?
Thank you

It seems to me that you are facing a Race Condition. You can try to code around it with try/catch blocks, but it would be better if you can stabilize the environment.

@wreed the only thing is that I have few devices around me and the search is not stopping in Iphone, there s no option to stop the search?
Thank you

I don’t know of any way to stop bluetooth searches. Maybe if you aren’t using bluetooth on the other devices, just turn it off until you need them.

That is the flow currently I’m doing, but looks like there is no way