diff --git a/tcms/testruns/static/testruns/js/get.js b/tcms/testruns/static/testruns/js/get.js index 3c8be61006..3be26b5ff8 100644 --- a/tcms/testruns/static/testruns/js/get.js +++ b/tcms/testruns/static/testruns/js/get.js @@ -627,7 +627,18 @@ 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}` + // 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}` + } + 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