diff --git a/test/appium/support/base_test_report.py b/test/appium/support/base_test_report.py index 8f898522ff..3fd16f67c6 100644 --- a/test/appium/support/base_test_report.py +++ b/test/appium/support/base_test_report.py @@ -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 diff --git a/test/appium/support/github_report.py b/test/appium/support/github_report.py index b2f3db5a8c..713223b90f 100644 --- a/test/appium/support/github_report.py +++ b/test/appium/support/github_report.py @@ -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 += "
" html += "Click to expand" html += "
" + + 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 += "
  • Rerun tests
  • " % self.get_jenkins_link_to_rerun_e2e(pr_id=pr_id, apk_name=apk_name, tr_case_ids=tr_case_ids) + + html += "
    " html += "" html += "" html += ""