b0VIM 8.2DÁÓ`ÍÍ,§cjoshholtzJoshs-MacBook-Air.local~joshholtz/Developer/fastlane/fastlane/snapshot/lib/snapshot/collector.rb 3210#"! Utpeÿÿÿÿÿÿÿÿ'fadÃeðïÕ«ªš3!ÿ©hÕ Ô „ [ Z  Ç | Y   Û « ¡   m X N M $ ¢ ˜ — e K ( ' ù ø ¥ 5 óò¸·’ˆvnmK Õ¬…X%ùÒÀ¸·‘i$ëẲ±Œ^úÍÅÄ—e:9êéµ…P׎YE3# ÿþàUI.message("Found #{to_store.count} screenshots...") end end end end end end check_activity(activity, to_store) (subtest3["ActivitySummaries"] || []).each do |activity| (subtest2["Subtests"] || []).each do |subtest3| (subtest["Subtests"] || []).each do |subtest2| (test["Subtests"] || []).each do |subtest| (summary["Tests"] || []).each do |test| report["TestableSummaries"].each do |summary| to_store = [] # contains the names of all the attachments we want to use report = Plist.parse_xml(plist_path) UI.verbose("Loading up '#{plist_path}'...") def self.attachments_in_file(plist_path) end return attachments_in_file(plist_path) plist_path = Dir[File.join(containing, "*.plist")].last # we clean the folder before each run UI.message("Collecting screenshots...") def self.attachments(containing) end FileUtils.cp(from_path, to_path) end UI.success("Copying '#{to_path}'...") else UI.success("Copying file '#{from_path}' to '#{to_path}'...") if FastlaneCore::Globals.verbose? def self.copy(from_path, to_path) end return true FileUtils.rm_rf(SCREENSHOTS_DIR) end copy(screenshot, to_path) to_path = File.join(destination, filename) filename = File.basename(screenshot) screenshots.each do |screenshot| return false if screenshots.empty? screenshots = Dir["#{SCREENSHOTS_DIR}/*.png"] def self.collect_screenshots_for_language_folder(destination) # Returns true if it succeeds end return true end copy(from_path, output_path) from_path = File.join(attachments_path, filename) output_path = File.join(language_folder, screenshot_name) screenshot_name = device_name + "-" + name + "-" + Digest::MD5.hexdigest(components.join("-")) + ".png" components = [launch_arguments_index].delete_if { |a| a.to_s.length == 0 } device_name = device_type.delete(" ") filename = to_store[index] name = current[0] matches.each_with_index do |current, index| end UI.error("Looks like the number of screenshots (#{to_store.count}) doesn't match the number of names (#{matches.count})") if matches.count != to_store.count end return false if to_store.count == 0 && matches.count == 0 end matches = output.scan(/snapshot: (.*)/) to_store = attachments(containing) else return collect_screenshots_for_language_folder(language_folder) if Helper.xcode_at_least?(9) # and instead, we can save them to a known location to use later on. # to avoid parsing the generated plist file to find the screenshots # Xcode 9 introduced a new API to take screenshots which allows us FileUtils.mkdir_p(language_folder) language_folder = File.join(Snapshot.config[:output_directory], dir_name) attachments_path = File.join(containing, "Attachments") containing = File.join(TestCommandGenerator.derived_data_path, "Logs", "Test") # Documentation about how this works in the project README def self.fetch_screenshots(output, dir_name, device_type, launch_arguments_index) # Returns true if it succeeds class Collector # Responsible for collecting the generated screenshots and copying them over to the output directorymodule Snapshotrequire_relative 'test_command_generator'require_relative 'module'require 'plist'adH 'Ϲ±°€ï”3¸ Q è ± } Y O N  â Ø Ð Ï ¨ j  ¿ µ ´ G  ë ³ P    ÿend end end end return "Screenshot_#{activity['UUID']}.png" else # Xcode 7.3 has stopped including 'Attachments', so we synthesize the filename manually return activity["Attachments"].last["FileName"] elsif activity["Attachments"] return activity["Attachments"].last["Filename"] if activity["Attachments"] && activity["Attachments"].last && activity["Attachments"].last["Filename"] end return find_screenshot(subactivity) if subactivity["Title"] == "Synthesize event" # we are interested in `Synthesize event` part of event in subactivities (activity["SubActivities"] || []).each do |subactivity| def self.find_screenshot(activity) end end check_activity(subactivity, to_store) (activity["SubActivities"] || []).each do |subactivity| end to_store << find_screenshot find_screenshot = find_screenshot(activity) if ios_detected || tvos_detected || osx_detected osx_detected = activity["Title"] == "Type 'Fn' key (XCUIKeyboardKeySecondaryFn) with no modifiers" tvos_detected = activity["Title"] == "Get number of matches for: Children matching type Browser" ios_detected = activity["Title"] == "Set device orientation to Unknown" # locate where snapshot() was invoked. # These are events that are not normally triggered by UI testing, making it easy for us to # On OSX we look for type `Fn` key on keyboard, it shouldn't change anything for app # On tvOS, we look for "Browser" count. # On iOS, we look for the "Unknown" rotation gesture that signals a snapshot was taken here. def self.check_activity(activity, to_store) end return to_store UI.verbose("Found #{to_store.join(', ')}")