Bold text for xfail

This commit is contained in:
Yevheniia Berdnyk 2022-06-22 01:44:42 +03:00
parent 8a36ee8761
commit ab1eb22f3a
No known key found for this signature in database
GPG Key ID: 0642C73C66214825
3 changed files with 21 additions and 18 deletions

View File

@ -130,11 +130,14 @@ class BaseTestReport:
@staticmethod
def separate_xfail_error(error):
issue_id_list = re.findall(r'#\d+', error)
main_error, no_code_error_str, issue_id = error, '', ''
if issue_id_list:
issue_id = issue_id_list[0]
issue_id = issue_id_list[0] if issue_id_list else ''
xfail_error = re.findall(r'\[\[.*\]\]', error)
if xfail_error:
no_code_error_str = xfail_error[0]
main_error = error.replace(no_code_error_str, '')
return (main_error, no_code_error_str, issue_id)
else:
no_code_error_str = ''
main_error = error
return main_error, no_code_error_str, issue_id

View File

@ -118,12 +118,12 @@ class GithubHtmlReport(BaseTestReport):
html += "%s" % ''.join(test_steps_html[-2:])
html += "</blockquote>"
html += "</p>"
(code_error, no_code_error_str, issue_id) = self.separate_xfail_error(error)
code_error, no_code_error_str, _ = self.separate_xfail_error(error)
if no_code_error_str:
html += "<code>%s</code>" % code_error
html += no_code_error_str
html += "<b>%s</b>" % no_code_error_str
else:
html += "<code>%s</code>" % error
html += "<code>%s</code>" % error.replace("[[", "<b>[[").replace("]]", "]]</b>")
html += "<br/><br/>"
if test.group_name:
html += "<p><b>Class: %s</b></p>" % test.group_name
@ -140,9 +140,8 @@ class GithubHtmlReport(BaseTestReport):
html += "Device %d:" % i
html += "<ul>"
if test_run.first_commands:
html += "<li><a href=\"%s\">Steps, video, logs</a></li>" % self.get_sauce_job_url(job_id,
test_run.first_commands[
job_id])
html += "<li><a href=\"%s\">Steps, video, logs</a></li>" % \
self.get_sauce_job_url(job_id, test_run.first_commands[job_id])
else:
html += "<li><a href=\"%s\">Steps, video, logs</a></li>" % self.get_sauce_job_url(job_id)
if test_run.error:

View File

@ -189,6 +189,7 @@ class TestrailReport(BaseTestReport):
error = "%s %s" % (code_error, test_rail_xfail)
else:
error = full_error
error = error.replace("[[", "**").replace("]]", "**")
comment += '%s' % ('# Error: \n %s \n' % emoji.demojize(error)) + devices + test_steps
else:
comment += devices + test_steps
@ -257,9 +258,9 @@ class TestrailReport(BaseTestReport):
(code_error, no_code_error_str, issue_id) = self.separate_xfail_error(full_error)
if issue_id:
test_rail_xfail = self.make_error_with_gh_issue_link(no_code_error_str, issue_id)
error = "```%s```\n %s \n" % (code_error, test_rail_xfail)
error = "```%s```\n **%s** \n" % (code_error, test_rail_xfail)
else:
error = "```%s```\n" % full_error
error = "```%s```\n **%s** \n" % (code_error, no_code_error_str)
for job_id, f in last_testrun.jobs.items():
if last_testrun.first_commands:
job_url = self.get_sauce_job_url(job_id=job_id,
@ -305,5 +306,5 @@ class TestrailReport(BaseTestReport):
@staticmethod
def make_error_with_gh_issue_link(error, issue_id):
return error.replace(issue_id, '[%s](https://github.com/status-im/status-react/issues/%s)' % (issue_id, issue_id[1:]))
return error.replace(issue_id,
'[%s](https://github.com/status-im/status-react/issues/%s)' % (issue_id, issue_id[1:]))