class Object

Constants

FeatureMemory

Public Instance Methods

device?() click to toggle source
# File lib/skeleton/features/ios/support/01_launch.rb, line 67
def device?
  # Check if UUID (ENV['DEVICE_TARGET']) is from a device or a simulator
  # Getting all the simulator's UUID
  uuids = `xcrun simctl list`
  return false if uuids.include? ENV['DEVICE_TARGET']
  return true
end
reinstall_app() click to toggle source
# File lib/skeleton/features/ios/support/01_launch.rb, line 75
def reinstall_app
  if device?
    system "echo 'Installing the app...'"
    # Trying to reinstall the app
    success = system "ios-deploy -r -b #{ENV['APP_BUNDLE_PATH']} -i #{ENV['DEVICE_TARGET']} -t 5 > /dev/null"

    # If the app is not installed the above command will throw an error
    # So we just install the app
    unless success
      success = system "ios-deploy -b #{ENV['APP_BUNDLE_PATH']} -i #{ENV['DEVICE_TARGET']} -t 5 > /dev/null"
      fail 'Error. Could not install the app.' unless
        success # If there is any error raises an exception
    end

    system "echo 'Installed.'"
    sleep(3) # Gives a time to finish the installation of the app in the device
  end
end