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.
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:
Update iOS app settings in an App Automate session
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.
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.
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.
These are the permission settings added by developers using the iOS Settings bundle during the development of an iOS app. To learn more about iOS Settings Bundle, check out the official Apple Documentation.
Add the capability to your test script and add the required settings within this capability as key-value pairs to update the permission settings at the beginning of your test script.
Provided keys and values are validated from the app settings bundle in the app, and throw errors if any key or value is incorrect.
The following example image and code show how to set a few permission settings.
The following example code uses the browserstack.updateAppSettings capability in a test script to set Environment setting to QA_1 and Child Setting 1 to abc.
AppiumOptions capabilities = new AppiumOptions();
Dictionary<object, object> appSettings = new Dictionary<object, object>();
appSettings.Add("Environment","QA_1");
Dictionary<object, object> childSettings = new Dictionary<object, object>();
childSettings.Add("Child Setting 1","abc");
appSettings.Add("Child Settings",childSettings);
capabilities.AddAdditionalCapability("browserstack.updateAppSettings",appSettings);
Add the updateAppSettings action in the custom BrowserStack JavaScript executor to update permission settings in the middle of your test session.
Provided keys and values are validated from the app settings bundle in the app, and appropriate errors are thrown if any key or value is not found to be correct.
The following example image and code show how to set a few permission settings.
The following example code uses the updateAppSettings action in the custom BrowserStack JavaScript executor to set Environment setting to QA_1 and Child Setting 1 to abc.
The title of the keys displayed on your iOS app settings page must be unique.
We currently do not support updating values of the PSSliderSpecifier and PSGroupSpecifier keys, which are added using the iOS Settings bundle in your iOS app.
Related topics
Check this page for a list of various JavaScript Executors that BrowserStack offers.