Upload files to devices in App Automate
App Automate provides preloaded media files on BrowserStack remote devices to test scenarios that require access to files on the device.
Apart from preloaded media files, you can also upload your media or non-media files in App Automate.
In this guide, you’ll learn:
- Supported file types and OS versions
- How to upload your files to BrowserStack
- How to set the uploadMedia parameter when executing your build
Supported file types and OS version
The following tab lists the supported files types you can upload, and OS version on which you can upload the files.
The following table shows the supported file types and their size to upload for testing:
File | Type | Maximum file size |
---|---|---|
Image | JPG, JPEG, PNG, GIF, BMP | 10 MB |
Video | MP4, MOV and 3GP | 50 MB |
Non-media | XLS, XLSX, DOC, DOCX, PDF, CSV, TXT | 15 MB |
The following table shows the supported OS and devices to which you can upload your files for testing:
OS | Device | OS version |
---|---|---|
Android | Phones and tablets | v6 and above |
Upload your file to BrowserStack
Run the following upload media cURL command to upload your file to BrowserStack servers:
curl -u "username:accesskey" \
-X POST "https://api-cloud.browserstack.com/app-automate/upload-media" \
-F "file=@/path/to/your/file" \
-F "custom_id=SampleFile"
A sample response for the given cURL command is as follows. It returns the value of the media_url
parameter.
{
"media_url": "media://90c7a8h8dc82308108734e9a46c24d8f01de12881",
"custom_id": "SampleFile"
}
The file you uploaded will be available in the following folders on the device:
Default gallery app.
The file path is /sdcard/Pictures
for images and /sdcard/Movies
for videos.
Default Download folder of the device.
Set uploadMedia parameter when executing build
In the execute build cURL command, set the uploadMedia
parameter to the value of the media_url
parameter returned in the API response.
The following sample cURL command shows the parameter used to access your uploaded files for testing on Samsung Galaxy S8 with Android OS v7.0:
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/build"
\ -d '{"uploadMedia": ["media://90c7a8h8dc82308108734e9a46c24d8f01de12881"],
"devices": ["Samsung Galaxy S8-7.0"], "app": "bs://f5L3azt9pLzE995f49376eb1fa3c284dc321f8d",
"testSuite": "bs://6eb1fa3c284ddbe9971b2d1aee0d52943b9c081"}'
\ -H "Content-Type: application/json"
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
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!