BrowserStack is a cloud-based mobile testing platform that provides the ability to test your applications on real mobile devices. BrowserStack can be used as a part of your Codemagic CI/CD pipeline to test your applications.
Signing up with BrowserStack is required in order to be able to get the username and access token.
-
Open your Codemagic app settings, and go to the Environment variables tab.
-
Enter the desired Variable name, e.g.
BROWSERSTACK_USERNAME. -
Enter the required value as Variable value.
-
Enter the variable group name, e.g. browserstack_credentials. Click the button to create the group.
-
Make sure the Secure option is selected.
-
Click the Add button to add the variable.
-
Repeat the process to add the token as
BROWSERSTACK_ACCESS_TOKEN -
Add the variable group to your
codemagic.yamlfile
environment:
groups:
- browserstack_credentialsTo use App Live and test your .ipa and .apk artifacts directly on real devices rather than simulators, add the following script to your `codemagic.yaml file:
scripts:
- name: Submitting app to Browserstack:
script: |
curl -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_TOKEN" -X POST "https://api-cloud.browserstack.com/app-live/upload" -F "file=@build/ios/ipa/your_app_release.ipa"Note: Make sure that you add this cURL request after building the .ipa and .apk, otherwise you cannot attach their paths to the cURL request.