Jenkins URL to rerun tests
Signed-off-by: Serhy <sergii@status.im>
This commit is contained in:
parent
f6e480344d
commit
4ca7c0b989
|
@ -77,6 +77,10 @@ class BaseTestReport:
|
|||
token = self.get_sauce_token(job_id)
|
||||
return 'https://saucelabs.com/jobs/%s?auth=%s' % (job_id, token)
|
||||
|
||||
def get_jenkins_link_to_rerun_e2e(self, branch_name="develop", pr_id="", apk_name="", tr_case_ids=""):
|
||||
return 'https://ci.status.im/job/end-to-end-tests/job/status-app-prs-rerun/parambuild/' \
|
||||
'?BRANCH_NAME=%s&APK_NAME=%s&PR_ID=%s&TR_CASE_IDS=%s' % (branch_name, apk_name, pr_id, tr_case_ids)
|
||||
|
||||
def get_sauce_final_screenshot_url(self, job_id):
|
||||
token = self.get_sauce_token(job_id)
|
||||
from tests.conftest import sauce
|
||||
|
|
|
@ -2,13 +2,19 @@ import os
|
|||
from support.base_test_report import BaseTestReport
|
||||
from support.testrail_report import TestrailReport
|
||||
|
||||
|
||||
class GithubHtmlReport(BaseTestReport):
|
||||
TEST_REPORT_DIR = "%s/../report" % os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
def __init__(self):
|
||||
super(GithubHtmlReport, self).__init__()
|
||||
|
||||
def list_of_failed_testrail_ids(self, tests_data):
|
||||
ids_failed_test = []
|
||||
for i, test in enumerate(tests_data):
|
||||
if test.testrail_case_id:
|
||||
ids_failed_test.append(test.testrail_case_id)
|
||||
return ','.join(map(str, ids_failed_test))
|
||||
|
||||
def build_html_report(self, run_id):
|
||||
tests = self.get_all_tests()
|
||||
passed_tests = self.get_passed_tests()
|
||||
|
@ -26,11 +32,7 @@ class GithubHtmlReport(BaseTestReport):
|
|||
if failed_tests:
|
||||
failed_tests_html = self.build_tests_table_html(failed_tests, run_id, failed_tests=True)
|
||||
summary_html += "```\n"
|
||||
ids_failed_test = []
|
||||
for i, test in enumerate(failed_tests):
|
||||
if test.testrail_case_id:
|
||||
ids_failed_test.append(test.testrail_case_id)
|
||||
summary_html += 'IDs of failed tests: %s \n' % ','.join(map(str, ids_failed_test))
|
||||
summary_html += 'IDs of failed tests: %s \n' % self.list_of_failed_testrail_ids(failed_tests)
|
||||
summary_html += "```\n"
|
||||
if passed_tests:
|
||||
passed_tests_html = self.build_tests_table_html(passed_tests, run_id, failed_tests=False)
|
||||
|
@ -44,6 +46,15 @@ class GithubHtmlReport(BaseTestReport):
|
|||
html += "<details>"
|
||||
html += "<summary>Click to expand</summary>"
|
||||
html += "<br/>"
|
||||
|
||||
if failed_tests:
|
||||
from tests import pytest_config_global
|
||||
pr_id = pytest_config_global['pr_number']
|
||||
apk_name = pytest_config_global['apk']
|
||||
tr_case_ids = self.list_of_failed_testrail_ids(self.get_failed_tests())
|
||||
html += "<li><a href=\"%s\">Rerun tests</a></li>" % self.get_jenkins_link_to_rerun_e2e(pr_id=pr_id, apk_name=apk_name, tr_case_ids=tr_case_ids)
|
||||
|
||||
html += "<br/>"
|
||||
html += "<table style=\"width: 100%\">"
|
||||
html += "<colgroup>"
|
||||
html += "<col span=\"1\" style=\"width: 20%;\">"
|
||||
|
|
Loading…
Reference in New Issue