Class: Maze::Api::Appium::FileManager
- Inherits:
-
Object
- Object
- Maze::Api::Appium::FileManager
- Defined in:
- lib/maze/api/appium/file_manager.rb
Overview
Provides operations for working with files during Appium runs.
Instance Method Summary collapse
-
#initialize ⇒ FileManager
constructor
param driver.
-
#write_app_file(contents, filename) ⇒ Object
Creates a file with the given contents on the device (using Appium).
Constructor Details
#initialize ⇒ FileManager
param driver
7 8 9 |
# File 'lib/maze/api/appium/file_manager.rb', line 7 def initialize @driver = Maze.driver end |
Instance Method Details
#write_app_file(contents, filename) ⇒ Object
Creates a file with the given contents on the device (using Appium). The file will be located in the app’s Documents directory for iOS and /sdcard/Android/data/<app-id>/ for Android.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/maze/api/appium/file_manager.rb', line 15 def write_app_file(contents, filename) path = case Maze::Helper.get_current_platform when 'ios' "@#{@driver.app_id}/Documents/#{filename}" when 'android' "/sdcard/Android/data/#{@driver.app_id}/files/#{filename}" end $logger.debug "Pushing file to '#{path}' with contents: #{contents}" @driver.push_file(path, contents) end |