class Gitlab::QA::Report::GenerateTestSession

def generate_test_actions(tests_with_same_testcase)

def generate_test_actions(tests_with_same_testcase)
  # All failed tests would be grouped together, meaning that
  # if one failed, all the tests here would be failed too.
  # So this check is safe. Same applies to 'passed'.
  # But all other status might be mixing together,
  # we cannot assume other statuses.
  if tests_with_same_testcase.first.status == 'failed'
    tests_having_failure_issue =
      tests_with_same_testcase.select(&:failure_issue)
    if tests_having_failure_issue.any?
      items = tests_having_failure_issue.uniq(&:failure_issue).map do |test|
        "<li>[ ] [failure issue](#{test.failure_issue})</li>"
      end.join(' ')
      "<ul>#{items}</ul>"
    else
      '<ul><li>[ ] failure issue exists or was created</li></ul>'
    end
  else
    '-'
  end
end