Commit 3c2ebab6 authored by Ramya Authappan's avatar Ramya Authappan

Merge branch 'ml-report-correct-shared-examples-location' into 'master'

Report correct shared examples location

See merge request gitlab-org/gitlab!40212
parents 3fa5f0a5 eb41187d
......@@ -35,13 +35,15 @@ module QA
private
def format_example(example)
file_path, line_number = location_including_shared_examples(example.metadata)
{
id: example.id,
description: example.description,
full_description: example.full_description,
status: example.execution_result.status.to_s,
file_path: example.metadata[:file_path],
line_number: example.metadata[:line_number],
file_path: file_path,
line_number: line_number.to_i,
run_time: example.execution_result.run_time,
pending_message: example.execution_result.pending_message,
status_issue: example.metadata[:status_issue],
......@@ -49,6 +51,15 @@ module QA
screenshot: example.metadata[:screenshot]
}
end
def location_including_shared_examples(metadata)
if metadata[:shared_group_inclusion_backtrace].empty?
[metadata[:file_path], metadata[:line_number]]
else
# If there are nested shared examples, the outermost location is last in the array
metadata[:shared_group_inclusion_backtrace].last.formatted_inclusion_location.split(':')
end
end
end
end
end
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