From 080d6339bfa1a64a1453bca33cf79518f1fba3c6 Mon Sep 17 00:00:00 2001 From: acuanico-tr-galt Date: Thu, 12 Sep 2024 17:56:54 +0800 Subject: [PATCH 1/2] add test for run description bug --- tests_e2e/test_end2end.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tests_e2e/test_end2end.py b/tests_e2e/test_end2end.py index 6582754..017391d 100644 --- a/tests_e2e/test_end2end.py +++ b/tests_e2e/test_end2end.py @@ -424,4 +424,24 @@ def test_cli_add_run_upload_results(self): "Uploading 1 attachments for 1 test results.", "Submitted 6 test results" ] - ) \ No newline at end of file + ) + + def bug_test_cli_robot_description_bug(self): + output = _run_cmd(f""" +trcli -y \\ + -h {self.TR_INSTANCE} \\ + --project "SA - (DO NOT DELETE) TRCLI-E2E-Tests" \\ + parse_robot \\ + --title "[CLI-E2E-Tests] RUN DESCRIPTION BUG" \\ + -f "reports_robot/simple_report_RF50.xml" \\ + --run-id 2332 + """) + _assert_contains( + output, + [ + "Processed 3 test cases in 2 sections.", + "Uploading 1 attachments for 1 test results.", + "Submitted 3 test results in" + ] + ) + \ No newline at end of file From e602bae993be296308ce0fc5aedfdeab74d2ee44 Mon Sep 17 00:00:00 2001 From: acuanico-tr-galt Date: Thu, 12 Sep 2024 17:57:32 +0800 Subject: [PATCH 2/2] update request handler to preserve test run description --- trcli/api/api_request_handler.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/trcli/api/api_request_handler.py b/trcli/api/api_request_handler.py index 1f875a4..3a50755 100644 --- a/trcli/api/api_request_handler.py +++ b/trcli/api/api_request_handler.py @@ -416,13 +416,18 @@ def update_run(self, run_id: int, run_name: str, milestone_id: int = None) -> Tu :run_name: run name :returns: Tuple with run and error string. """ + run_response = self.client.send_get(f"get_run/{run_id}") + existing_description = run_response.response_text.get("description", "") + add_run_data = self.data_provider.add_run(run_name, milestone_id=milestone_id) + add_run_data["description"] = existing_description # Retain the current description + run_tests, error_message = self.__get_all_tests_in_run(run_id) run_case_ids = [test["case_id"] for test in run_tests] report_case_ids = add_run_data["case_ids"] joint_case_ids = list(set(report_case_ids + run_case_ids)) add_run_data["case_ids"] = joint_case_ids - run_response = self.client.send_get(f"get_run/{run_id}") + plan_id = run_response.response_text["plan_id"] config_ids = run_response.response_text["config_ids"] if not plan_id: