Commit 0fa3cd15 authored by Andrejs Cunskis's avatar Andrejs Cunskis

Merge branch 'acunskis-fix-allure-report' into 'master'

E2E: Handle multiple quarantine issue links for allure report

See merge request gitlab-org/gitlab!79424
parents b8c49bcb 9d4a04ff
...@@ -15,14 +15,42 @@ module QA ...@@ -15,14 +15,42 @@ module QA
def example_started(example_notification) def example_started(example_notification)
example = example_notification.example example = example_notification.example
quarantine_issue = example.metadata.dig(:quarantine, :issue) add_quarantine_issue_link(example)
example.issue('Quarantine issue', quarantine_issue) if quarantine_issue add_failure_issues_link(example)
add_ci_job_link(example)
end
private
# Add quarantine issue links
#
# @param [RSpec::Core::Example] example
# @return [void]
def add_quarantine_issue_link(example)
issue_link = example.metadata.dig(:quarantine, :issue)
return unless issue_link
return example.issue('Quarantine issue', issue_link) if issue_link.is_a?(String)
return issue_link.each { |link| example.issue('Quarantine issue', link) } if issue_link.is_a?(Array)
end
# Add failure issues link
#
# @param [RSpec::Core::Example] example
# @return [void]
def add_failure_issues_link(example)
spec_file = example.file_path.split('/').last spec_file = example.file_path.split('/').last
example.issue( example.issue(
'Failure issues', 'Failure issues',
"https://gitlab.com/gitlab-org/gitlab/-/issues?scope=all&state=opened&search=#{spec_file}" "https://gitlab.com/gitlab-org/gitlab/-/issues?scope=all&state=opened&search=#{spec_file}"
) )
end
# Add ci job link
#
# @param [RSpec::Core::Example] example
# @return [void]
def add_ci_job_link(example)
return unless Runtime::Env.running_in_ci? return unless Runtime::Env.running_in_ci?
example.add_link(name: "Job(#{Runtime::Env.ci_job_name})", url: Runtime::Env.ci_job_url) example.add_link(name: "Job(#{Runtime::Env.ci_job_name})", url: Runtime::Env.ci_job_url)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment