xcresult
xcresult copied to clipboard
Export screenshots
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 https://github.com/ainame/xcresult/compare/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.
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 }