From 020b67dda9601a4b51044b83b57e7caf4ff8174d Mon Sep 17 00:00:00 2001 From: somenewacc <62895232+somenewacc@users.noreply.github.com> Date: Mon, 2 Oct 2023 17:46:02 +0300 Subject: [PATCH 1/2] [TestRun] Fix tags when use `reloadRowFor` on multiple executions --- tcms/testruns/static/testruns/js/get.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tcms/testruns/static/testruns/js/get.js b/tcms/testruns/static/testruns/js/get.js index 3c8be61006..38456dd63e 100644 --- a/tcms/testruns/static/testruns/js/get.js +++ b/tcms/testruns/static/testruns/js/get.js @@ -627,7 +627,11 @@ function renderAdditionalInformation (testRunId, execution) { casesInPlan = Object.keys(casesInPlan).map(id => parseInt(id)) for (const testCase of testCases) { - const row = $(`.test-execution-case-${testCase.id}`) + let rowSelector = `.test-execution-case-${testCase.id}` + if (execution) { + rowSelector += `.test-execution-${execution.id}` + } + const row = $(rowSelector) // when loading this page filtered by status some TCs do not exist // but we don't know about it b/c the above queries are overzealous From 6f8a8e934253cfff3c84a7f0cb09a07c3baad704 Mon Sep 17 00:00:00 2001 From: Alexander Todorov Date: Thu, 30 Nov 2023 00:24:16 +0200 Subject: [PATCH 2/2] Add explanation why the fix for #3367 works and what the root cause is --- tcms/testruns/static/testruns/js/get.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tcms/testruns/static/testruns/js/get.js b/tcms/testruns/static/testruns/js/get.js index 38456dd63e..3be26b5ff8 100644 --- a/tcms/testruns/static/testruns/js/get.js +++ b/tcms/testruns/static/testruns/js/get.js @@ -628,6 +628,13 @@ function renderAdditionalInformation (testRunId, execution) { for (const testCase of testCases) { let rowSelector = `.test-execution-case-${testCase.id}` + // Preferably operate over the exact execution row to prevent + // appending new HTML onto existing values, e.g. Tags. See #3367 + // + // Root cause of the bug in #3367 is that some fields contain icons + // and pre-existing HTML coming from the template and we can't call .empty() + // on them. When such TE is parametrized then there are multiple HTML rows + // matching `rowSelector`/`testCase.id`, therefore the UI is appended to many times! if (execution) { rowSelector += `.test-execution-${execution.id}` }