Class: Fastlane::FirebaseTestLabResult

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_test_lab_result.rb

Instance Method Summary collapse

Constructor Details

#initialize(log_file_path:) ⇒ FirebaseTestLabResult

Returns a new instance of FirebaseTestLabResult.



3
4
5
6
7
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_test_lab_result.rb', line 3

def initialize(log_file_path:)
  raise "No log file found at path #{log_file_path}" unless File.file? log_file_path

  @path = log_file_path
end

Instance Method Details

#more_details_urlObject

Parse the log for the “More details are available…” URL



15
16
17
18
19
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_test_lab_result.rb', line 15

def more_details_url
  File.readlines(@path)
      .flat_map { |line| URI.extract(line) }
      .find { |url| URI(url).host == 'console.firebase.google.com' && url.include?('/matrices/') }
end

#raw_results_pathsObject

Parse the log for the Google Cloud Storage Bucket URL



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_test_lab_result.rb', line 22

def raw_results_paths
  uri = File.readlines(@path)
            .flat_map { |line| URI.extract(line) }
            .map { |string| URI(string) }
            .find { |u| u.scheme == 'gs' }

  return nil if uri.nil?

  {
    bucket: uri.host,
    prefix: uri.path.delete_prefix('/').chomp('/')
  }
end

#success?Boolean

Scan the log file to for indications that no test cases failed

Returns:

  • (Boolean)


10
11
12
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_test_lab_result.rb', line 10

def success?
  File.readlines(@path).any? { |line| line.include?('Passed') && line.include?('test cases passed') }
end