Skip to main content

Using The File Repository

The File Repository is supported only for Appium Server (Appium Open Source) commands.

To learn how to store and download files from file repository see 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

A unique file name must be provided using the "cloud:" prefix.

Commands that Can Use Files From The File Repository

The file must exist in file repository before command execution. (You can upload files to file repository using the File Repository Rest API.)

Use a 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.

info

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 in The File Repository

The file must not exist in file repository before command execution. Otherwise the command fails.

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", "10000");

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

Android 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");

Android 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");