class Gitlab::QA::Report::TestResult::JsonTestResult

def ci_job_url

def ci_job_url
  report['ci_job_url']
end

def failure_issue

def failure_issue
  report['failure_issue']
end

def failure_issue=(new_failure_issue)

def failure_issue=(new_failure_issue)
  report['failure_issue'] = new_failure_issue
end

def failures_from_exceptions

rubocop:disable Metrics/AbcSize
def failures_from_exceptions
  return [] unless report.key?('exceptions')
  report['exceptions'].map do |exception|
    spec_file_first_index = exception['backtrace'].rindex do |line|
      line.include?(File.basename(report['file_path']))
    end
    {
      'message' => "#{exception['class']}: #{exception['message']}",
      'message_lines' => exception['message_lines'],
      'stacktrace' => "#{exception['message_lines'].join("\n")}\n#{exception['backtrace'].slice(0..spec_file_first_index).join("\n")}"
    }
  end
end

def file

def file
  report['file_path']
end

def name

def name
  report['full_description']
end

def quarantine?

def quarantine?
  # The value for 'quarantine' could be nil, a hash, a string,
  # or true (if the test just has the :quarantine tag)
  # But any non-nil or false value should means the test is in quarantine
  report['quarantine'].present?
end

def skipped

def skipped
  status == 'pending'
end

def status

def status
  report['status']
end

def testcase

def testcase
  report['testcase']
end

def testcase=(new_testcase)

def testcase=(new_testcase)
  report['testcase'] = new_testcase
end