We have hundreds of devices that perform UI and component tests. The tests are written using the XCTest framework and run on our applications, as well as on system (Safari / Settings) and third-party applications.
As part of the testing framework, we need to bring the devices to a specific state before each test. These include deleting caches, changing setup items, installing applications, and so on. We are currently using a combination of Apple Configurator, MDM, configuration profiles, and UI tests to get the status you want for each test.
So far so good, but the setup process is very costly, unstable and difficult to maintain in various iOS versions.
Then we thought – why not use backups? We can save a backup for each desired initial state, restore the desired backup and start the test immediately.
There is a tiny problem with this idea: Restoring from the backup places the device in the "Setup" state, which requires manual intervention by the user. Even if we use Apple Configurator to gain the device's trust, set up Wi-Fi, and skip all sorts of preference items, the user has to click on the Start button on the "Hello" page and then click on "Get Started" on the screen To SpringBoard and you can start XCTest / application startup or debugging.
Now it's obvious: Can we somehow automate the whole process described above? That is, restore an iOS device from a backup, skip setup, and run XCTests.