fastlane-plugin-test_center 3.14.2 → 3.14.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5110e6b44d55945155e5769bf07fa9a1883521d125349f0d06211eea98014d14
4
- data.tar.gz: ae0ffaa0f14c026a2ffdf2413f9b119142a130ba530742746715f2338cd058d2
3
+ metadata.gz: e081e2a0d9d6bcb59c38f24072eb0059edef4457f03fed6e2318930260e9f5a4
4
+ data.tar.gz: 681403d6200f5d943e28f9c3fa6b90a6f450d7a9252c476eb7cf77c7e0c6101d
5
5
  SHA512:
6
- metadata.gz: 00eeb25839214b31b2cdf248f0daa5978fba3a3e1e03c31b994bf24b618e6fd56588a2e2c41c4b6610346892c5a4460db0df854c78014b2aafdf3ee1651b37cb
7
- data.tar.gz: 4928830dfca2a60011d1435ee38532bebfb4d9e7b3887cd3088f1a7dcc26fe503028229b4d73d64e04d166ac21ee25d8bd8641a0a8b30e4eb96400e160d932e5
6
+ metadata.gz: 98e979a4fbafe31e6dc33bd1a3a94a1e1da316ce8226c3688e9d223461a33c5d75c9291dc837e256c227915959547f8964df38c524e40b45742408235ee94713
7
+ data.tar.gz: 3049728d26e108dea44480f7445e41be419f4189e3bb2b63b8cef7871a9d7bf58b5edcee01351dc40496209f6805706bfcb0b6cf08b9fee6c43bba1decbfecda
@@ -44,9 +44,10 @@ module Fastlane
44
44
  html_file_contents = File.read(html_report_filepath)
45
45
  File.open(html_report_filepath, 'w') do |file|
46
46
  html_file_contents.each_line do |line|
47
- m = %r{(<section class="test-detail[^"]*">)(.*(<|>).*)(</section>)}.match(line)
47
+ m = %r{(<section class="test-detail[^"]*">)(.*(<|>|&(?!amp;)).*)(</section>)}.match(line)
48
48
  if m
49
49
  test_details = m[2]
50
+ test_details.gsub!(/&(?!amp;)/, '&amp;')
50
51
  test_details.gsub!('<', '&lt;')
51
52
  test_details.gsub!('>', '&gt;')
52
53
  line = m[1] + test_details + m[4]
@@ -1,6 +1,7 @@
1
1
  module Fastlane
2
2
  module Actions
3
3
  class CollateJunitReportsAction < Action
4
+ require 'set'
4
5
 
5
6
  def self.run(params)
6
7
  report_filepaths = params[:reports]
@@ -9,17 +10,27 @@ module Fastlane
9
10
  else
10
11
  UI.verbose("collate_junit_reports with #{report_filepaths}")
11
12
  reports = report_filepaths.map { |report_filepath| REXML::Document.new(File.new(report_filepath)) }
13
+ packages = reports.map { |r| r.root.attribute('name').value }.uniq
14
+ combine_multiple_targets = packages.size > 1
15
+
12
16
  # copy any missing testsuites
13
17
  target_report = reports.shift
14
- preprocess_testsuites(target_report)
18
+
19
+ package = target_report.root.attribute('name').value
20
+ preprocess_testsuites(target_report, package, combine_multiple_targets)
15
21
 
16
22
  reports.each do |report|
17
23
  increment_testable_tries(target_report.root, report.root)
18
- preprocess_testsuites(report)
24
+ package = report.root.attribute('name').value
25
+ preprocess_testsuites(report, package, combine_multiple_targets)
19
26
  UI.verbose("> collating last report file #{report_filepaths.last}")
20
27
  report.elements.each('//testsuite') do |testsuite|
21
28
  testsuite_name = testsuite.attribute('name').value
22
- target_testsuite = REXML::XPath.first(target_report, "//testsuite[@name='#{testsuite_name}']")
29
+ package_attribute = ''
30
+ if combine_multiple_targets
31
+ package_attribute = "@package='#{package}'"
32
+ end
33
+ target_testsuite = REXML::XPath.first(target_report, "//testsuite[@name='#{testsuite_name}' #{package_attribute}]")
23
34
  if target_testsuite
24
35
  UI.verbose(" > collating testsuite #{testsuite_name}")
25
36
  collate_testsuite(target_testsuite, testsuite)
@@ -36,6 +47,7 @@ module Fastlane
36
47
  end
37
48
  testable = REXML::XPath.first(target_report, 'testsuites')
38
49
  update_testable_counts(testable)
50
+ testable.add_attribute('name', packages.to_a.join(', '))
39
51
 
40
52
  FileUtils.mkdir_p(File.dirname(params[:collated_report]))
41
53
  File.open(params[:collated_report], 'w') do |f|
@@ -81,10 +93,11 @@ module Fastlane
81
93
  update_testsuite_counts(testsuite)
82
94
  end
83
95
 
84
- def self.preprocess_testsuites(report)
96
+ def self.preprocess_testsuites(report, package, combine_multiple_targets)
85
97
  report.elements.each('//testsuite') do |testsuite|
86
98
  flatten_duplicate_testsuites(report, testsuite)
87
99
  collapse_testcase_multiple_failures_in_testsuite(testsuite)
100
+ testsuite.add_attribute('package', package) if combine_multiple_targets
88
101
  end
89
102
  end
90
103
 
@@ -234,6 +234,7 @@ module TestCenter
234
234
  @test_collector.testables.each do |testable|
235
235
  collate_batched_reports_for_testable(testable)
236
236
  end
237
+ collate_multitarget_junits
237
238
  move_single_testable_reports_to_final_location
238
239
  end
239
240
 
@@ -295,6 +296,31 @@ module TestCenter
295
296
  File.symlink(xcresult_bundlename_path, test_result_bundlename_path)
296
297
  end
297
298
 
299
+ def collate_multitarget_junits
300
+ return if @test_collector.testables.size < 2
301
+
302
+ Fastlane::UI.verbose("Collating test targets's junit results")
303
+
304
+ given_custom_report_file_name = @options[:custom_report_file_name]
305
+ given_output_types = @options[:output_types]
306
+ given_output_files = @options[:output_files]
307
+
308
+ report_name_helper = ReportNameHelper.new(
309
+ given_output_types,
310
+ given_output_files,
311
+ given_custom_report_file_name
312
+ )
313
+
314
+ absolute_output_directory = File.absolute_path(output_directory)
315
+ source_reports_directory_glob = "#{absolute_output_directory}/*"
316
+
317
+ TestCenter::Helper::MultiScanManager::ReportCollator.new(
318
+ source_reports_directory_glob: source_reports_directory_glob,
319
+ output_directory: absolute_output_directory,
320
+ reportnamer: report_name_helper
321
+ ).collate_junit_reports
322
+ end
323
+
298
324
  def collate_batched_reports_for_testable(testable)
299
325
  FastlaneCore::UI.verbose("Collating results for all batches")
300
326
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module TestCenter
3
- VERSION = "3.14.2"
3
+ VERSION = "3.14.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-test_center
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.14.2
4
+ version: 3.14.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lyndsey Ferguson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-01 00:00:00.000000000 Z
11
+ date: 2020-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json