lib/snapshot/runner.rb in snapshot-1.12.3 vs lib/snapshot/runner.rb in snapshot-1.13.0
- old
+ new
@@ -47,11 +47,11 @@
end
end
print_results(results)
- raise self.collected_errors.join('; ') if self.collected_errors.count > 0
+ UI.user_error!(self.collected_errors.join('; ')) if self.collected_errors.count > 0
# Generate HTML report
ReportsGenerator.new.generate
# Clear the Derived Data
@@ -109,10 +109,11 @@
puts Terminal::Table.new(params)
puts ""
end
# Returns true if it succeded
+ # rubocop:disable Metrics/AbcSize
def launch(language, locale, device_type, launch_arguments)
screenshots_path = TestCommandGenerator.derived_data_path
FileUtils.rm_rf(File.join(screenshots_path, "Logs"))
FileUtils.rm_rf(screenshots_path) if Snapshot.config[:clean]
FileUtils.mkdir_p(screenshots_path)
@@ -187,15 +188,24 @@
dir_name = locale || language
return Collector.fetch_screenshots(raw_output, dir_name, device_type, launch_arguments.first)
end
+ # rubocop:enable Metrics/AbcSize
def open_simulator_for_device(device)
return unless ENV['FASTLANE_EXPLICIT_OPEN_SIMULATOR']
- UI.message("Explicitly opening simulator for device: #{device}")
- `open -a Simulator --args -CurrentDeviceUDID #{TestCommandGenerator.device_udid(device)}`
+ # As a second level of feature switching, see if we want to try the xcode-select variant
+ if ENV['FASTLANE_EXPLICIT_OPEN_SIMULATOR'] == '2'
+ simulator_path = File.join(FastlaneCore::Helper.xcode_path, 'Applications', 'Simulator.app')
+ UI.message("Explicitly opening simulator at #{simulator_path} for device: #{device}")
+ else
+ simulator_path = 'Simulator'
+ UI.message("Explicitly opening simulator for device: #{device}")
+ end
+
+ `open -a #{simulator_path} --args -CurrentDeviceUDID #{TestCommandGenerator.device_udid(device)}`
end
def uninstall_app(device_type)
UI.verbose "Uninstalling app '#{Snapshot.config[:app_identifier]}' from #{device_type}..."
Snapshot.config[:app_identifier] ||= ask("App Identifier: ")