fix: original sort order (#768)
This commit is contained in:
parent
e48a649247
commit
4ee12c42cc
|
@ -6,6 +6,13 @@ Versions follow `Semantic Versioning`_ (``<major>.<minor>.<patch>``).
|
|||
Version History
|
||||
---------------
|
||||
|
||||
Unreleased
|
||||
~~~~~~~~~~
|
||||
|
||||
* Fix original initial sort INI-setting.
|
||||
|
||||
* Thanks to `@sturmf <https://github.com/sturmf>`_ for reporting.
|
||||
|
||||
4.1.0 (2023-11-04)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ const renderContent = (tests) => {
|
|||
|
||||
// remove all sorting classes and set the relevant
|
||||
findAll('.sortable', tableHeader).forEach((elem) => elem.classList.remove('asc', 'desc'))
|
||||
tableHeader.querySelector(`.sortable[data-column-type="${sortAttr}"]`).classList.add(sortAsc ? 'desc' : 'asc')
|
||||
tableHeader.querySelector(`.sortable[data-column-type="${sortAttr}"]`)?.classList.add(sortAsc ? 'desc' : 'asc')
|
||||
newTable.appendChild(tableHeader)
|
||||
|
||||
if (!rows.length) {
|
||||
|
|
|
@ -823,6 +823,52 @@ class TestHTML:
|
|||
count = log.count(each)
|
||||
assert_that(count).is_equal_to(occurrence)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"sort, order",
|
||||
[
|
||||
(None, ["BBB", "AAA", "CCC"]),
|
||||
("result", ["BBB", "AAA", "CCC"]),
|
||||
("testId", ["AAA", "BBB", "CCC"]),
|
||||
("duration", ["CCC", "BBB", "AAA"]),
|
||||
("original", ["AAA", "BBB", "CCC"]),
|
||||
],
|
||||
)
|
||||
def test_initial_sort(self, pytester, sort, order):
|
||||
if sort is not None:
|
||||
pytester.makeini(
|
||||
f"""
|
||||
[pytest]
|
||||
initial_sort = {sort}
|
||||
"""
|
||||
)
|
||||
|
||||
pytester.makepyfile(
|
||||
"""
|
||||
import pytest
|
||||
from time import sleep
|
||||
|
||||
def test_AAA():
|
||||
sleep(0.3)
|
||||
assert True
|
||||
|
||||
def test_BBB():
|
||||
sleep(0.2)
|
||||
assert False
|
||||
|
||||
def test_CCC():
|
||||
sleep(0.1)
|
||||
assert True
|
||||
"""
|
||||
)
|
||||
|
||||
page = run(pytester)
|
||||
assert_results(page, passed=2, failed=1)
|
||||
|
||||
result = page.select("td.col-testId")
|
||||
assert_that(result).is_length(3)
|
||||
for row, expected in zip(result, order):
|
||||
assert_that(row.string).contains(expected)
|
||||
|
||||
|
||||
class TestLogCapturing:
|
||||
LOG_LINE_REGEX = r"\s+this is {}"
|
||||
|
|
Loading…
Reference in New Issue