class Cuesmash::AppiumText

Creates the appium.txt file that is needed by appium

@author [jarod]

Attributes

app[RW]
appium_text_for_file[RW]
device_name[RW]
new_command_timeout[RW]
platform_name[RW]
platform_version[RW]
udid[RW]

Public Class Methods

new(platform_name:, device_name:, platform_version: nil, app:, new_command_timeout: 60, udid: nil) click to toggle source

Create a new appium_text instance. These params are based off the appium.txt

caps

format.

@param platform_name [String] The platform_name platformName = “iOS” @param device_name [String] deviceName = “iPhone Simulator” @param platform_version [String] platformVersion = “7.1” @param app [String] path to built .app file

@return [AppiumText] A appiumtext instance

# File lib/cuesmash/appium_text.rb, line 29
def initialize(platform_name:, device_name:, platform_version: nil, app:, new_command_timeout: 60, udid: nil)
  @platform_name = platform_name
  @device_name = device_name
  @platform_version = platform_version
  @app = app
  @new_command_timeout = new_command_timeout
  @udid = udid
end

Public Instance Methods

execute() click to toggle source
# File lib/cuesmash/appium_text.rb, line 38
def execute
  started
  update
  completed
end

Private Instance Methods

completed() click to toggle source
# File lib/cuesmash/appium_text.rb, line 55
def completed
  Logger.info 'appium.txt updated 👌'
end
file_text() click to toggle source
caps

platformName = “iOS” deviceName = “iPhone Simulator” platformVersion = “7.1” app = “/Users/name/Library/Developer/Xcode/DerivedData/proj-xxx/Build/Products/Debug-iphonesimulator/proj.app”

# File lib/cuesmash/appium_text.rb, line 64
def file_text
  text = "[caps]\n"
  text << "platformName = \"#{platform_name}\"\n"
  text << "deviceName = \"#{device_name}\"\n"
  text << "platformVersion = \"#{platform_version}\"\n" unless platform_version.nil?
  text << "app = \"#{app}\"\n"
  text << "newCommandTimeout = #{new_command_timeout}\n"
  text << "udid = \"#{udid}\"\n" unless udid.nil?
  Logger.debug "appium.text == #{text}"
  text
end
started() click to toggle source
# File lib/cuesmash/appium_text.rb, line 46
def started
  Logger.info 'Updating appium.txt'
end
update() click to toggle source
# File lib/cuesmash/appium_text.rb, line 50
def update
  @appium_text_for_file = file_text
  IO.write('features/support/appium.txt', @appium_text_for_file)
end