File Repository is currently supported only for Appium Server (Appium Open Source) commands.
How to store and how to download files from file repository: File Repository Rest API
Permissions
There are several configurations that define the access to the file repository
- File repository can be globally enabled or disabled for the cloud (see File Repository)
- File repository can be enabled or disabled for each project (see Project Resources)
- The administrator can prevent users with the "User" role to upload/modify files in the file repository (see Project Resources)
Commands
File unique name should be provided with "cloud:" prefix
Commands that can use files from the file repository
- simulateCapture
- startAudioPlay / stopAudioPlay
File must exist in file repository before command execution (upload files to file repository using File Repository Rest API)
Use file unique name in the repository in order to execute a command, for example:
driver.executeScript("seetest:client.simulateCapture", "cloud:my_image");
In this case, my_image is a file unique name in the file repository.
File URL
When a file is provided without the "cloud:" prefix - it is treated as a URL
driver.executeScript("seetest:client.simulateCapture", "https://myserver.com/my_image");
Commands that produce files and store them to file repository:
- startAudioRecording / stopAudioRecording
- startHarRecording / stopHarRecording
File must not exist in file repository before command execution (otherwise the command will fail)
driver.executeScript("seetest:client.startAudioRecording", "cloud:my_audio"); // Commands that play audio on device driver.executeScript("seetest:client.stopAudioRecording");
Now the file with the unique name my_audio can be downloaded from the file repository using File Repository Rest API
Examples
Simulate Capture
// File with unique name my_image must exist in file repository driver.executeScript("seetest:client.simulateCapture", "cloud:my_image");
Audio Play Commands
// File with unique name my_music must exist in file repository driver.executeScript("seetest:client.startAudioPlay", "cloud:my_music"); driver.executeScript("seetest:client.stopAudioPlay"); driver.executeScript("seetest:client.startAudioPlay", "cloud:my_music"); driver.executeScript("seetest:client.waitForAudioPlayEnd", 10_000);
Audio Recording Commands
// File with unique name my_audio_recording must NOT exist in file repository driver.executeScript("seetest:client.startAudioRecording", "cloud:my_audio_recording"); // Commands that play audio on device driver.executeScript("seetest:client.stopAudioRecording"); // Download file with unique name my_audio_recording from file repository using Rest API
HAR File Recording Commands
// File with unique name my_har_file must NOT exist in file repository driver.executeScript("seetest:client.startHarRecording", "cloud:my_har_recording"); // Commands that perform web requests on device driver.executeScript("seetest:client.stopHarRecording"); // Download file with unique name my_har_recording from file repository using Rest API
ADB push File to device Command
// File with unique name must exist in file repository // File from repository will be uploaded to provided path on device. driver.executeScript("seetest:client.pushFile", "path_on_device", "cloud:file_in_repo");
ADB pull File from device Command
// File with unique name must NOT exist in file repository // File downloaded from device will be stored in file repository with given unique name. driver.executeScript("seetest:client.pullFile", "path_on_device", "cloud:file_in_repo");
Start/Stop Logging device Command
// File with unique name must not exist in file repository // Device log file will be uploaded to the provided "log_file_name" on file repository in the 'Stop Logging device command'. driver.executeScript("seetest:client.startLoggingDevice", "cloud:log_file_name"); . . . // Device log file will be uploaded to path on file repository that was provided on 'Start Logging device command'. driver.executeScript("seetest:client.stopLoggingDevice");