Skip to content

Conversation

@ainame
Copy link

@ainame ainame commented Jul 23, 2021

This PR depends on changes in #4 so this PR includes many unnecessary changes at this moment.
You can see actual changes on this PR is here ainame/xcresult@generate-models...ainame:export-screenshots.


Prior to this PR, I've also submitted the PR that powers this gem to cover all the models that .xcresult file format uses. This PR implemented exporting of screenshots functionality.

Additionally, I added bin/console and bin/setup which are normally bundled with a newly created gem by bundler. It is very handy for basic debugging, like running XCResult::Parser.new(path: '...') locally.

@ainame ainame force-pushed the export-screenshots branch 2 times, most recently from e0d13c2 to ad5a1a5 Compare July 23, 2021 01:18
class ExportOptions
AVAILABLE_OPTIONS = %i[destination by_device by_locale].freeze

def initialize(**options)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo add document comments

@ainame ainame force-pushed the export-screenshots branch 3 times, most recently from 9c39a1e to c4a4bb0 Compare July 29, 2021 05:24
@ainame ainame force-pushed the export-screenshots branch from 157ab94 to c4a4bb0 Compare November 24, 2021 04:49
@ainame ainame force-pushed the export-screenshots branch from c4a4bb0 to 4a6ed0d Compare November 24, 2021 04:54
@tosbaha
Copy link

tosbaha commented Aug 3, 2022

Hi, when I was testing this PR, I confronted a crash during the screenshot export. Some tests don't have summary_ref attribute. Therefore, the next line, which tries to load the reference crashes.

https://github.com/ainame/xcresult/blob/a4f5dcbbbba09fcdd6e99135367d1da75d52d9d1/lib/xcresult/parser.rb#L89

            attachments = action_testable_summary.all_tests
                                                 .map(&:summary_ref)
                                                 .map { |ref| ref.load_object(from: path) }
                                                 .flat_map(&:activity_summaries)
                                                 .flat_map(&:subactivities)
                                                 .flat_map(&:attachments)

I have solved this issue by using a select before the map

attachments = action_testable_summary.all_tests.select {|x| x.summary_ref }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants