Skip to content

Commit

Permalink
ISSUE-8: fix crash when we have empty screen objects
Browse files Browse the repository at this point in the history
  • Loading branch information
testableapple committed Aug 22, 2018
1 parent c81df91 commit bf6733f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions lib/skeleton.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,15 @@ def run

def fill_html
languages = ios? ? Language.all : Language.all - ['swift']
languages.each do |lang|
languages.each_with_index do |lang, index|
attach_image
type = Language.domain(lang)
folder = Base::PAGE_OBJECTS_FOLDER
@screen_objects = File.read(Dir["#{folder}/*.#{type}"].first)
begin
@screen_objects = File.read(Dir["#{folder}/*.#{type}"].first)
rescue TypeError
Log.warn('Failed to find any screen objects 💩') if index.zero?
end
@elements_tree = File.read(Dir["#{folder}/*.xml"].first)
@build_version = "v#{VERSION}"
if @driver.class == Android
Expand Down Expand Up @@ -70,7 +74,7 @@ def open_url
port = File.read("#{Base::ROOT_DIR}/server/port")
url = "http://localhost:#{port}/skeleton"
`open #{url}` if @browser
Log.info("Look at your pretty page objects: \n#{url} 😍")
Log.info("Take a peek on #{url} 😍")
rescue Errno::ENOENT
Log.warn('Something went wrong with skeleton server 💩' \
"\nTry to rerun it (:")
Expand Down
2 changes: 1 addition & 1 deletion lib/skeleton/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Skeleton
VERSION ||= '0.1.17'.freeze
VERSION ||= '0.1.18'.freeze
GEM_NAME ||= 'skeleton-ui'.freeze
end

0 comments on commit bf6733f

Please sign in to comment.