Test iOS App Settings

BrowserStack App Automate enables you to update iOS app settings added using iOS Settings bundle. App Automate provides Appium capability browserstack.updateAppSettings and custom executor with action updateAppSettings to update iOS app settings at the start or in the middle of an App Automate session.

In this guide, you will learn about :

  1. Different app settings in iOS
  2. How to update app settings in an App Automate session

1. Different app settings in iOS

iOS app settings are the app preferences which are accessible after clicking on the <Your app name> in the iOS Settings app. App Settings can be of two types :

  • OS added app settings such as permission settings
  • App settings added by developers using iOS Settings Bundle. For more details on iOS Settings Bundle, please refer to official Apple Documentation.

iOS app settings

Note: Currently, this feature only supports app settings added using iOS settings bundle.

2. How to update app settings in an App Automate session

2.1 Construct JSON for the app settings to be updated

Any app setting can be updated by providing its display label & desired value in a key:value pair format. Finally, they need to be wrapped in a JSON dictionary and nested according to the settings screen they are accessible from.

For example, to update app settings as shown below :

iOS App Settings

JSON needs to be constructed in the following way :

{
   "Environment" : "QA_1",
   "OTP Auto-fill" : "ON",
   "Name" : "Your Name",
   "Child Settings" : {
       "Child Setting 1" : "Value1"
   }
}
Note: Providedkeys & values will be validated from Settings.bundle available in the app & appropriate errors are thrown if any key or value is not found to be correct.

2.2 Use BrowserStack capability or custom executor to update the app settings

To update app settings at the start of the session

DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability("browserstack.updateAppSettings", {
   "Environment" : "QA_1",
   "OTP Auto-fill" : "ON",
   "Name" : "Your Name",
   "Child Settings" : {
       "Child Setting 1" : "Value 1"
   }
});
var capabilities = {
	'browserstack.updateAppSettings':  {
        "Environment" : "QA_1",
        "OTP Auto-fill" : "ON",
        "Name" : "Your Name",
        "Child Settings" : {
            "Child Setting 1" : "Value 1"
        }
    }
}
desired_cap = {
	'browserstack.updateAppSettings': {
        "Environment" : "QA_1",
        "OTP Auto-fill" : "ON",
        "Name" : "Your Name",
        "Child Settings" : {
            "Child Setting 1" : "Value 1"
        }
    }
}
desired_caps = {
    'browserstack.updateAppSettings'=> {
        "Environment" => "QA_1",
        "OTP Auto-fill" => "ON",
        "Name" => "Your Name",
        "Child Settings" => {
            "Child Setting 1" => "Value 1"
        }
    }
}
DesiredCapabilities capability = new DesiredCapabilities();
desiredCapabilities.SetCapability("browserstack.updateAppSettings", {
   "Environment" : "QA_1",
   "OTP Auto-fill" : "ON",
   "Name" : "Your Name",
   "Child Settings" : {
       "Child Setting 1" : "Value 1"
   }
});

To update app settings in the middle of the session

driver.executeScript("browserstack_executor: {\"action\":\"updateAppSettings\", \"arguments\": {
   \"Environment\" : \"QA_1\",
   \"OTP Auto-fill\" : \"ON\",
   \"Name\" : \"Your Name\",
   \"Child Settings\" : {
       \"Child Setting 1\" : \"Value 1\"
   }
}}")
await driver.execute("browserstack_executor: {\"action\":\"updateAppSettings\", \"arguments\": {
   \"Environment\" : \"QA_1\",
   \"OTP Auto-fill\" : \"ON\",
   \"Name\" : \"Your Name\",
   \"Child Settings\" : {
       \"Child Setting 1\" : \"Value 1\"
   }
}}")
driver.execute_script("browserstack_executor: {\"action\":\"updateAppSettings\", \"arguments\": {
   \"Environment\" : \"QA_1\",
   \"OTP Auto-fill\" : \"ON\",
   \"Name\" : \"Your Name\",
   \"Child Settings\" : {
       \"Child Setting 1\" : \"Value 1\"
   }
}}")
@driver.execute_script("browserstack_executor: {\"action\":\"updateAppSettings\", \"arguments\": {
   \"Environment\" : \"QA_1\",
   \"OTP Auto-fill\" : \"ON\",
   \"Name\" : \"Your Name\",
   \"Child Settings\" : {
       \"Child Setting 1\" : \"Value 1\"
   }
}}")
driver.executeScript("browserstack_executor: {\"action\":\"updateAppSettings\", \"arguments\": {
   \"Environment\" : \"QA_1\",
   \"OTP Auto-fill\" : \"ON\",
   \"Name\" : \"Your Name\",
   \"Child Settings\" : {
       \"Child Setting 1\" : \"Value 1\"
   }
}}")
Note:
  • Currently, this feature is supported on iOS 13 & above devices and only for app settings defined in App Under test (AUT).
  • Please note that updating an iOS app setting may lead to a marginal increase in session start-time. Thus, users are expected to use this feature based on their needs.

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
Talk to an Expert