Skip to content

Commit

Permalink
[TestRun] Fix filter check on TestRun page
Browse files Browse the repository at this point in the history
when a TestRun is filtered via query param (?status_id=) if you change
statuses then `stop_date` field will also change once all of the
filtered TestExecution rows become non-neutral.

This is a bug because the page isn't checking all TEs outside of the currently
filtered selection!
  • Loading branch information
somenewacc authored and atodorov committed Oct 2, 2023
1 parent 1c08a6e commit e7ff187
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tcms/testruns/static/testruns/js/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ export function pageTestrunsGetReadyHandler () {
})
}

function isFiltered () {
const filterParams = new URLSearchParams(location.search)
return $('#toolbar-filter').val() !== '' || filterParams.has('status_id')
}

function filterTestExecutionsByProperty (runId, executions, filterBy, filterValue) {
// no input => show all rows
if (filterValue.trim().length === 0) {
Expand Down Expand Up @@ -496,7 +501,7 @@ function getExpandArea (testExecution) {
const $this = $(this)
jsonRPC('TestExecution.update', [testExecution.id, testExecutionUpdateArgs(statusId)], execution => {
// update TestRun if not filtered
reloadRowFor(execution, $('#toolbar-filter').val() === '')
reloadRowFor(execution, !isFiltered())

$this.parents('.list-group-item-container').addClass('hidden')
// click the .list-group-item-header, not the .test-execution-element itself, because otherwise the handler will fail
Expand Down Expand Up @@ -751,11 +756,10 @@ function changeStatusBulk (statusId) {
}

const updateArgs = testExecutionUpdateArgs(statusId)
const notFiltered = $('#toolbar-filter').val() === ''
selected.executionIds.forEach(executionId => {
jsonRPC('TestExecution.update', [executionId, updateArgs], execution => {
// update TestRun if not filtered
reloadRowFor(execution, notFiltered)
reloadRowFor(execution, !isFiltered())
})
})
}
Expand Down

0 comments on commit e7ff187

Please sign in to comment.