Top Level Namespace

Defined Under Namespace

Modules: CS Classes: ElementFoundError, ElementNotFoundError, TouchElementError, UnexpectedPageError

Constant Summary collapse

FeatureMemory =
Struct.new(:feature, :invocation).new

Instance Method Summary collapse

Instance Method Details

#device?Boolean



67
68
69
70
71
72
73
# 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_appObject



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# 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