GardenMobile & interfaces

Preconfiguring simulator permissions for Flutter tests

An earlier AppleSimulatorUtils script that creates a dedicated simulator and sets test permissions.

A deterministic integration test may need a known simulator permission state. That is different from bypassing permission handling in the shipped application. The original setup used AppleSimulatorUtils:

brew tap wix/brew
brew install applesimutils

The historical test script

# test_driver.sh content
echo "Shutting down all existing emulators..."
xcrun simctl shutdown all
echo "Recreating the emulator..."
xcrun simctl delete iOS13TestDevice || echo Failed to delete iOS 13 device
xcrun simctl create iOS13TestDevice "iPhone 8" com.apple.CoreSimulator.SimRuntime.iOS-13-6
echo "Booting..."
xcrun simctl boot iOS13TestDevice
echo "Checking boot status..."
xcrun simctl bootstatus iOS13TestDevice
echo "Running driver tests..."
flutter drive --target=test_driver/app.dart --debug & 
echo "Modifying permissions..."
applesimutils --byName "iOS13TestDevice" --bundle "YOUR_APPS_BUNDLE_ID_HERE" --setPermissions "notifications=YES" || sleep 90

The script shuts down all simulators, deletes/recreates a named device, and starts flutter drive in the background before setting permissions. Those are real simulator mutations, and the background sequence can race with application startup. The iOS 13.6 runtime and placeholder bundle ID belong to the old example.

The original execution steps were:

chmod +x test_driver.sh
./test_driver.sh

The earlier permission reference

calendar=YES|NO|unset
camera=YES|NO|unset
contacts=YES|NO|unset
faceid=YES|NO|unset
health=YES|NO|unset (iOS 12.0 and above)
homekit=YES|NO|unset
location=always|inuse|never|unset
medialibrary=YES|NO|unset
microphone=YES|NO|unset
motion=YES|NO|unset
notifications=YES|NO|unset
photos=YES|NO|unset
reminders=YES|NO|unset
siri=YES|NO|unset
speech=YES|NO|unset

This list is historical, not a promise that every option is supported on a current runtime. Tests still need coverage for actual permission requests and denial behavior. No simulator, test driver, or permission command was run for this revision.

← Back to the garden