Skip to content

Commit

Permalink
ISSUE-3: modify check_udid method
Browse files Browse the repository at this point in the history
  • Loading branch information
testableapple committed Jul 30, 2018
1 parent 829241a commit 4fa65ce
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
6 changes: 3 additions & 3 deletions lib/skeleton/android.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ def save_screenshot
end

def check_udid
Log.info('Checking Android udid 👨‍💻')
Log.info('Checking device udid 👨‍💻')
@udid = devices.first if @udid.nil? && devices.size == 1
return if devices.include?(@udid)
if @udid.nil?
Log.error("Provide device udid")
else
Log.error("Provide device udid [-u]")
elsif !devices.include?(@udid)
Log.error("No such devices with udid: #{@udid}")
end
end
Expand Down
31 changes: 15 additions & 16 deletions lib/skeleton/ios.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,22 +156,6 @@ def page_source
@page_source
end

def check_udid
return unless @simulator.nil?
Log.info('Checking iOS udid 👨‍💻')
if @udid.nil? && devices.size == 1
@udid = devices.first
else
@simulator = `xcrun simctl list`.include?(@udid)
end
return if @simulator || devices.include?(@udid)
if @udid.nil?
Log.error("Provide device udid")
else
Log.error("No such devices with udid: #{@udid}")
end
end

def check_bundle
if @simulator
return if `xcrun simctl appinfo #{@udid} #{@bundle_id}`
Expand All @@ -191,4 +175,19 @@ def save_screenshot
FileUtils.cp(screenshots[0], new_path)
FileUtils.rm_rf(XCRESULTS_FOLDER)
end

def check_udid
return unless @simulator.nil?
Log.info('Checking device udid 👨‍💻')
if @udid.nil? && devices.size == 1
@udid = devices.first
else
@simulator = `xcrun simctl list`.include?(@udid)
end
if @udid.nil?
Log.error("Provide device udid [-u]")
elsif !@simulator || !devices.include?(@udid)
Log.error("No such devices with udid: #{@udid}")
end
end
end

0 comments on commit 4fa65ce

Please sign in to comment.