lib/appium_lib/driver.rb in appium_lib-0.22.1 vs lib/appium_lib/driver.rb in appium_lib-0.23.0
- old
+ new
@@ -68,17 +68,10 @@
'APP_ACTIVITY', 'APP_WAIT_ACTIVITY',
'DEVICE'
# ensure app path is resolved correctly from the context of the .txt file
ENV['APP_PATH'] = Appium::Driver.absolute_app_path ENV['APP_PATH']
-
- # device is not case sensitive
- ENV['DEVICE'] = ENV['DEVICE'].strip.downcase if !ENV['DEVICE'].nil?
- if ! %w(ios android selendroid).include? ENV['DEVICE']
- raise %(DEVICE="#{ENV['DEVICE']}" must be ios, android,
-or selendroid.)
- end
end
# return list of require files as an array
# nil if require doesn't exist
if data && data['require']
@@ -302,23 +295,16 @@
#
# :ios, :android, :selendroid
@device = opts.fetch :device, ENV['DEVICE']
raise 'Device must be set' unless @device
- @version = opts[:version]
- if @device == 'Android' || @device == 'Selendroid'
- @version = '4.3' unless @version # default android to 4.3
- else
- @version = '7' unless @version # default ios to 7
- end
-
@device_type = opts.fetch :device_type, 'tablet'
@device_orientation = opts.fetch :device_orientation, 'portrait'
# load common methods
extend Appium::Common
- if @device == 'Android'
+ if @device.downcase == 'android'
# load Android specific methods
extend Appium::Android
else
# load iOS specific methods
extend Appium::Ios
@@ -383,11 +369,10 @@
# https://github.com/jlipps/appium/blob/master/app/android.js
def android_capabilities
{
compressXml: @compress_xml,
platform: 'Linux',
- version: @version,
device: @device,
:'device-type' => @device_type,
:'device-orientation' => @device_orientation,
name: @app_name || 'Ruby Console Android Appium',
:'app-package' => @app_package,
@@ -399,19 +384,18 @@
# @private
# WebDriver capabilities. Must be valid for Sauce to work.
def ios_capabilities
{
platform: 'OS X 10.9',
- version: @version,
device: @device,
name: @app_name || 'Ruby Console iOS Appium',
:'device-orientation' => @device_orientation
}.merge(@raw_capabilities)
end
# @private
def capabilities
- caps = ['iPhone Simulator', 'iPad Simulator'].include?(@device) ? ios_capabilities : android_capabilities
+ caps = @device.downcase === 'android' ? android_capabilities : ios_capabilities
caps[:app] = self.class.absolute_app_path(@app_path) unless @app_path.nil? || @app_path.empty?
caps
end
# Converts environment variable APP_PATH to an absolute path.
\ No newline at end of file