fastlane-plugin-retry_tests 1.1.7 → 1.2.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
  SHA1:
3
- metadata.gz: 1f56171856d8c246101317bbc026cce537082d96
4
- data.tar.gz: 22a39b879bb9d131754ecff1ad73049875818451
3
+ metadata.gz: cf787e00a75492f256a7eb024485674d9ee775ff
4
+ data.tar.gz: 1bf716ccf0f658b7ed844e2593919c9ce4666597
5
5
  SHA512:
6
- metadata.gz: 118263fbe6f78500fde492ee7ba96d7ff6ebb971723006daafe0e084cdbdc8f4642d0cf01b5fd138d3ba3c46e83bcdba686ba3190fbde6865a3c16f8cb67f723
7
- data.tar.gz: c3b32a77437de17a6f12c50a9d40ae00eb39439b3cce547fb3937d654a30e4a877d4b041cd3b447d67b0765b766f1e9fb1a8434dea0cf322b33c64aba5c01411
6
+ metadata.gz: bc965c5d35156bdaf1705bd246d3790dc5a3a258d1d6a9193b02890febce64b3a8cf03abc792232bcbd2d8c429586e25c1d41ebdf674475f07d5a128572449c4
7
+ data.tar.gz: d4971ba07cb80886c04762c0dd9b908eb06822ce61446c7f9381a896f7b6ede87caea17d42e9d2b46c5ecc4d4702145617ecd2a361d5627378aa84dae5e7569e
@@ -1,7 +1,7 @@
1
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
@@ -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
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-retry_tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.7
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gloria Chow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-19 00:00:00.000000000 Z
11
+ date: 2018-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plist
@@ -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: []