fastlane-plugin-retry_tests 1.3.0 → 1.3.1

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
  SHA1:
3
- metadata.gz: ad6db1868ae50026fe22c693857fb1a1a78f61fb
4
- data.tar.gz: 103f996af1ed6c2ee7bb026ef53731233648f1e1
3
+ metadata.gz: fe339a4e3bda1cf89bd4d256ed998d1f5e8eeb12
4
+ data.tar.gz: 5d05893392c40d4ece6b1421edc32dc920d149cc
5
5
  SHA512:
6
- metadata.gz: 6f5106da53a539dcd50e7e3136e8a4bad77226e3d7d7cb5e3884e8206cb9bbef2f2072df341383feb574cb1a447aa5722b1ca7de40de3ebc6fac462cc9415eb1
7
- data.tar.gz: 7e1f5374483038c240082c79dab5ad1597001ceb3d0d51c674b285005a2b770933ced8463780b02c1a329952f6587561207d8cf2d057146a6a3569d333b9bb2b
6
+ metadata.gz: 2779d970d5a821cacdfa96bebc23d523defc46be1edd0cd24001ec896e74eac53387b09923371561371fb30f399965ccc4cc83a3a32a6f6b1cf4b9da54b7cbf7
7
+ data.tar.gz: c61f2d9b8d0043800ce84112e3ca539a4240f8dbf01fdbec129017f72c9bcb6eec5bf2adcb5a4420c81c26a8d83c28db050ac7df84cf2ad202d09f1748bc73f6
@@ -1,4 +1,3 @@
1
- #Adapted from the "fastlane-plugin-test_center" plugin
2
1
 
3
2
  require 'nokogiri'
4
3
  require 'nokogiri-plist'
@@ -12,12 +11,9 @@ module Fastlane
12
11
  if report_filepaths.size == 1
13
12
  FileUtils.cp(report_filepaths[0], params[:collated_report])
14
13
  else
15
- #Convert .plist reports to Nokogiri XML objects
16
14
  target_report = File.open(report_filepaths.shift) {|f| Nokogiri::XML(f)}
17
15
  file_name = params[:collated_report] + "/#{params[:scheme]}.test_result/1_Test/action_TestSummaries.plist"
18
16
  reports = report_filepaths.map { |report_filepath| Nokogiri::XML(Nokogiri::PList(open(report_filepath)).to_plist_xml) }
19
-
20
- #Merge .plist reports
21
17
  reports.each do |retry_report|
22
18
  mergeLists(target_report, retry_report, params)
23
19
  end
@@ -26,15 +22,24 @@ module Fastlane
26
22
  copy_log(params[:logs], params[:collated_report] + "/")
27
23
  end
28
24
 
25
+ def self.clean_report(report)
26
+ report = report.gsub(/<(\w+): 0x(\w+)>/, '(\1: 0x\2)')
27
+ report = report.gsub(/<XCAccessibilityElement:\/>0x(\w+)/, '(XCAccessibilityElement): 0x\1')
28
+ report
29
+ end
30
+
31
+ def self.copy_log(log_files, logs_folder)
32
+ target_log = log_files.shift
33
+ FileUtils.cp_r(target_log, logs_folder)
34
+ end
35
+
29
36
  def self.mergeLists(target_report, retry_report, params)
30
37
  retry_report = clean_report(retry_report)
38
+ UI.verbose("Merging retried results...")
31
39
  Dir.mkdir(params[:collated_report]) unless File.exists?(params[:collated_report])
32
40
  file_name = params[:collated_report] + "/action_TestSummaries.plist"
33
41
  retried_tests = retry_report.xpath("//key[contains(.,'TestSummaryGUID')]/..")
34
-
35
42
  current_node = retried_tests.shift
36
-
37
- #Copy retried test results into the base report
38
43
  while (current_node != nil)
39
44
  testName = get_test_name(current_node)
40
45
  matching_node = target_report.at_xpath("//string[contains(.,'#{testName}')]/..")
@@ -47,37 +52,28 @@ module Fastlane
47
52
  end
48
53
  end
49
54
 
50
- def self.clean_report(report)
51
- report = report.gsub(/<(\w+): 0x(\w+)>/, '(\1: 0x\2)')
52
- report = report.gsub(/<XCAccessibilityElement:\/>0x(\w+)/, '(XCAccessibilityElement): 0x\1')
53
- report
54
- end
55
-
56
55
  def self.merge_assets(asset_files, assets_folder)
57
- #copy screenshots from all retries into the results folder
56
+ UI.verbose ("Merging screenshot folders...")
58
57
  Dir.mkdir(assets_folder) unless File.exists?(assets_folder)
59
58
  asset_files.each do |folder|
60
59
  FileUtils.cp_r(Dir[folder + '/*'], assets_folder)
61
60
  end
62
61
  end
63
62
 
64
- def self.copy_log(log_files, logs_folder)
65
- target_log = log_files.shift
66
- FileUtils.cp_r(target_log, logs_folder)
67
- end
68
-
69
63
  def self.merge_logs(log_files, logs_folder)
70
64
  UI.verbose("Merging console logs...")
71
- all = ""
72
65
  target_log = log_files.shift
73
66
  log_files.each do |log|
74
- all = all + log + " "
67
+ to_append = File.read(log)
68
+ File.open(target_log, "a") do |handle|
69
+ handle.puts to_append
70
+ end
71
+ FileUtils.cp_r(target_log, logs_folder)
75
72
  end
76
- sh("cat #{all}> #{target_log}")
77
- FileUtils.cp_r(target_log, logs_folder)
78
73
  end
79
74
 
80
75
  def self.write_report_to_file(report, file_name)
76
+ UI.verbose("Writing merged results to file...")
81
77
  File.new(file_name, 'w')
82
78
  File.open(file_name, 'w') do |f|
83
79
  f.write(report.to_xml)
@@ -171,7 +167,6 @@ module Fastlane
171
167
  end
172
168
 
173
169
  def self.authors
174
- #Adapted from the "fastlane-plugin-test_center" plugin by:
175
170
  ["lyndsey-ferguson/@lyndseydf"]
176
171
  end
177
172
 
@@ -1,5 +1,3 @@
1
- #Adapted from the "fastlane-plugin-test_center" plugin
2
-
3
1
  module Fastlane
4
2
  module Actions
5
3
  require 'fastlane/actions/scan'
@@ -25,8 +23,7 @@ module Fastlane
25
23
  config = FastlaneCore::Configuration.create(Fastlane::Actions::ScanAction.available_options, scan_options)
26
24
  Fastlane::Actions::ScanAction.run(config)
27
25
  rescue FastlaneCore::Interface::FastlaneTestFailure => e
28
- FastlaneCore::UI.verbose("Scan failed with error #{e}")
29
- #Retry for the specified number of times if there were failed tests
26
+ UI.verbose("Scan failed with #{e}")
30
27
  if try_count < params[:try_count]
31
28
  report_filepath = junit_report_filepath(scan_options)
32
29
  failed_tests = other_action.tests_from_junit(junit: report_filepath)[:failed]
@@ -43,6 +40,7 @@ module Fastlane
43
40
  asset_files = Dir.glob("#{folder}*/#{scan_options[:scheme]}.test_result/1_Test/Attachments")
44
41
  log_files = Dir.glob("#{folder}*/#{scan_options[:scheme]}.test_result/1_Test/action.xcactivitylog")
45
42
  #Merge all reports, screenshots, and logs if there were retried tests
43
+
46
44
  if report_files.size > 1
47
45
  other_action.collate_junit_reports(
48
46
  scheme: scan_options[:scheme],
@@ -134,7 +132,6 @@ module Fastlane
134
132
  end
135
133
 
136
134
  def self.authors
137
- #Adapted from the "fastlane-plugin-test_center" plugin by:
138
135
  ["lyndsey-ferguson/@lyndseydf"]
139
136
  end
140
137
 
@@ -1,7 +1,7 @@
1
- require 'fastlane/plugin/retry_tests/version'
1
+ #require 'fastlane/plugin/retry_tests/version'
2
2
 
3
3
  module Fastlane
4
- module RetryTests
4
+ module TestCenter
5
5
  # Return all .rb files inside the "actions" and "helper" directory
6
6
  def self.all_classes
7
7
  Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
@@ -11,6 +11,6 @@ end
11
11
 
12
12
  # By default we want to import all available actions and helpers
13
13
  # A plugin can contain any number of actions and plugins
14
- Fastlane::RetryTests.all_classes.each do |current|
14
+ Fastlane::TestCenter.all_classes.each do |current|
15
15
  require current
16
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-retry_tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gloria Chow
@@ -217,5 +217,5 @@ rubyforge_project:
217
217
  rubygems_version: 2.6.14
218
218
  signing_key:
219
219
  specification_version: 4
220
- summary: Makes testing your iOS app easier
220
+ summary: Makes testing your iOS app easier.
221
221
  test_files: []