fastlane-plugin-setup_fragile_tests_for_rescan 0.2.0 → 0.3.0

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: 557fef7f513fde4f3de38598da039a33ec049f68
4
- data.tar.gz: e434a406c5d51131d7bf71b37ba01d14f886cd44
3
+ metadata.gz: d417822ec8112b30c7d1a97bb2dfc3870ac00956
4
+ data.tar.gz: 7f4639354e5c4309182b3cf81dad5515a60f4823
5
5
  SHA512:
6
- metadata.gz: d814ddba9a369090685423a3fc88657b45acead4b4d56d006d5b773878cb91ae37feb827476e72005be08f020445e68edd9a4610a112be1f673c0d6c6e406bbd
7
- data.tar.gz: ec20dc5fc30aa47a1ad59cf20381bfea57b1e927b0330ec2e2d2ceb9fb9faa0d25812e48e1315d28d71ea4d17745586172fb4d39c02ad1f113f0eb480c789229
6
+ metadata.gz: 288718bb82cf2d8442a375378551ed955a4f382ba43da55d83850a398b62435c2edc70574cc335e11836faffe85753542f3375214812e8da4b21eafec70a45b8
7
+ data.tar.gz: 8018121b98b1f71fb79c4156f625d814112a78031ad4b4e3342421c526fd07d0ec20f53a086f79300d86475023c559c084845ad3642034553e73c71153490f53
@@ -1,38 +1,40 @@
1
1
  module Fastlane
2
2
  module Actions
3
3
  class SetupFragileTestsForRescanAction < Action
4
- require 'nokogiri'
4
+ require 'rexml/document'
5
+ require 'rexml/xpath'
5
6
  require 'xcodeproj'
6
7
  require 'terminal-table'
7
8
 
8
9
  def self.run(params)
9
- report_file = File.open(params[:report_filepath]) { |f| Nokogiri::XML(f) }
10
- UI.user_error!("Malformed XML test report file given") if report_file.errors.length > 0
11
- UI.user_error!("Valid XML file is not an Xcode test report") if report_file.xpath('//testsuites').length.zero?
10
+ report_file = File.open(params[:report_filepath]) { |f| REXML::Document.new(f) }
11
+ UI.user_error!("Malformed XML test report file given") if report_file.root.nil?
12
+ UI.user_error!("Valid XML file is not an Xcode test report") if report_file.get_elements('testsuites').empty?
12
13
 
13
14
  # remove all testcases that failed from the report file
14
15
  # so that our subsequent steps here can just focus on finding
15
16
  # passing testcases to suppress
16
- report_file.xpath('//failure').each do |failure_element|
17
- failure_element.parent.remove
17
+ report_file.elements.each('*/testsuite/testcase/failure') do |failure_element|
18
+ failure_element.parent.parent.delete_element failure_element.parent
18
19
  end
19
20
 
20
21
  scheme = xcscheme(params)
21
22
  is_dirty = false
22
23
  summary = []
23
- report_file.xpath('//testsuites').each do |testsuite|
24
- buildable_name = testsuite['name'].to_s
24
+ report_file.elements.each('*/testsuite') do |testsuite|
25
+ buildable_name = File.basename(testsuite.attributes['name'], '.*') << '.xctest'
25
26
 
26
27
  test_action = scheme.test_action
27
28
  testable = test_action.testables.find { |t| t.buildable_references[0].buildable_name == buildable_name }
29
+ raise "Unable to find testable named #{buildable_name}" if testable.nil?
28
30
 
29
- report_file.xpath('//testcase').each do |testcase|
31
+ testsuite.elements.each('testcase') do |testcase|
30
32
  skipped_test = Xcodeproj::XCScheme::TestAction::TestableReference::SkippedTest.new
31
- skipped_test.identifier = skipped_test_identifier(testcase['classname'], testcase['name'])
33
+ skipped_test.identifier = skipped_test_identifier(testcase.attributes['classname'], testcase.attributes['name'])
32
34
  testable.add_skipped_test(skipped_test)
33
35
  is_dirty = true
34
36
  summary << [skipped_test.identifier]
35
- testcase.remove
37
+ testsuite.delete_element testcase
36
38
  end
37
39
  end
38
40
  if is_dirty
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module SetupFragileTestsForRescan
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-setup_fragile_tests_for_rescan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lyndsey Ferguson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-14 00:00:00.000000000 Z
11
+ date: 2017-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: nokogiri
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: xcodeproj
29
15
  requirement: !ruby/object:Gem::Requirement