Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/run description bug #271

Merged
merged 2 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion tests_e2e/test_end2end.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,4 +424,24 @@ def test_cli_add_run_upload_results(self):
"Uploading 1 attachments for 1 test results.",
"Submitted 6 test results"
]
)
)

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"
]
)

7 changes: 6 additions & 1 deletion trcli/api/api_request_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down