Skip to main content
Transform your testing process with: Real Device Features, Company-wide Licences, & App Percy
No Result Found

Test iOS app settings

This feature is available only under Device Cloud Pro, Device Cloud Pro + Visual Cloud, and Enterprise Pro plans. For more details check out our pricing page.

iOS app settings are app preferences that are accessible through the iOS Settings app. Your app preferences are accessible when you click your app name from the list of apps that appear on the Settings app.

App Automate supports updating the settings of an iOS app through an automated test script. An iOS app may require certain settings to be enabled to perform certain actions. For example, to capture images, an app requires access to the Camera app.

  • Currently, this feature is supported only on iOS 13 and above devices.
  • Updating an iOS app setting may lead to a marginal increase in the start time of a session in App Automate.

In this guide, you’ll learn:

Supported iOS app settings

App Automate supports the following types of iOS app settings:

  • App-specific permission settings: These are app settings added by the OS based on the permissions that a user grants the app. For example, settings related to the Camera, Location, etc., apps.
  • App settings added through iOS Settings bundle: These are the settings added by the app developer using the iOS Settings Bundle.

The following image shows the supported iOS app settings:

Supported iOS app settings

Update iOS app settings in an App Automate session

App-specific permission settings are added by the OS based on the permissions that a user grants the app.

These permission settings are set only when your app encounters the related permission pop-up on the screen.

In this section, you’ll learn:

Supported permission settings

Currently, App Automate supports the following permission settings:

  • Location
  • Camera
  • Contacts
  • Photos
  • Notifications
  • Language

Update app-specific permission settings

Add the updateAppSettings action in the custom BrowserStack JavaScript executor and wrap any app-specific permission settings within the Permission Settings object.

The following example image and code shows how to set the Location permission to Always and enable the Precise Location setting such that location access is granted to your app.

iOS app settings example


// set Location Access to Always
JavascriptExecutor jse = (JavascriptExecutor)driver;
jse.executeScript("browserstack_executor: {\"action\": \"updateAppSettings\", \"arguments\": {
    \"Permission Settings\": {
        \"Location\": {
            \"ALLOW LOCATION ACCESS\": \"Always\"
            }
        }
    }
}");

// enable the Precise Location feature
jse.executeScript("browserstack_executor: {\"action\": \"updateAppSettings\", \"arguments\": {
    \"Permission Settings\": {
        \"Location\": {
            \"Precise Location\": \"ON\"
            }
        }
    }
}");

Example custom executors for supported app-specific permission settings

The following list provides a few examples of custom BrowserStack executor scripts that you can use to update the supported app-specific permission settings:

  • Location: To set the ALLOW LOCATION ACCESS permission to While Using the App for the app to access the device’s location.
    driver.executeScript("browserstack_executor: {\"action\": \"updateAppSettings\", \"arguments\": {\"Permission Settings\": {\"Location\": { \"ALLOW LOCATION ACCESS\": \"While Using the App\"}}}}");
    
  • Contacts: To enable the Contacts setting for the app to access the device’s contact list.
    driver.executeScript("browserstack_executor: {\"action\": \"updateAppSettings\", \"arguments\": {\"Permission Settings\": {\"Contacts\": \"ON\"}}}");
    
  • Camera: To enable the Camera setting for the app to access the device’s camera.
    driver.executeScript("browserstack_executor: {\"action\": \"updateAppSettings\", \"arguments\": {\"Permission Settings\": {\"Camera\": \"ON\"}}}");
    
  • Photos: To set the Photos permission to All Photos for the app to access the images stored in the Photos app.
    driver.executeScript("browserstack_executor: {\"action\": \"updateAppSettings\", \"arguments\": {\"Permission Settings\": {\"Photos\": \"All Photos\"}}}");
    
  • Notifications: To enable push notifications for your iOS app.
    driver.executeScript("browserstack_executor: {\"action\":\"updateAppSettings\", \"arguments\": { \"Permission Settings\": { \"Notifications\": { \"Allow Notifications\": \"ON\" } } } }")
    
  • Language: To change app language mid-session.
    driver.executeScript("browserstack_executor: {\"action\": \"updateAppSettings\", \"arguments\": {\"Permission Settings\":{\"Language\":{\"OTHER LANGUAGES\": \"preferred_language\"}}}}");
    

Points to remember

  • Ensure that you use the JavaScript executor in a sequence to update dependent permission settings. For example, updating the Precise Location setting before the Location setting results in a test flakiness.
  • If you have configured some pop-ups in your iOS app, ensure to handle those pop-ups such that they do not interfere with our automation to update your app-specific permission settings.

Check this page for a list of various JavaScript Executors that BrowserStack offers.

Need some help?

If you need any help with this feature, get in touch with us.

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle