This commit is contained in:
dgtlmoon
2026-06-18 14:05:39 +02:00
parent d36a109d1a
commit 4940ec6cd3
+6 -5
View File
@@ -268,23 +268,24 @@ def test_ui_viewed_unread_flag(client, live_server, measure_memory_usage, datast
assert b'Queued 2 watches for rechecking.' in res.data
wait_for_all_checks(client)
res = client.get(url_for("watchlist.index"))
assert b'<span id="unread-tab-counter">2</span>' in res.data
# The Unread filter chip carries the count; the span has classes before the id, so match on the id+value.
assert b'id="unread-tab-counter">2<' in res.data
assert res.data.count(b'data-watch-uuid') == 2
# one should now be viewed, but two in total still
client.get(url_for("ui.ui_diff.diff_history_page", uuid="first"))
res = client.get(url_for("watchlist.index"))
assert b'<span id="unread-tab-counter">1</span>' in res.data
assert b'id="unread-tab-counter">1<' in res.data
assert res.data.count(b'data-watch-uuid') == 2
# check ?unread=1 works
res = client.get(url_for("watchlist.index")+"?unread=1")
assert res.data.count(b'data-watch-uuid') == 1
assert b'<span id="unread-tab-counter">1</span>' in res.data
assert b'id="unread-tab-counter">1<' in res.data
# Mark all viewed test again
# Mark all viewed test again - with 0 unread the Unread filter chip is hidden entirely
client.get(url_for("ui.mark_all_viewed"), follow_redirects=True)
time.sleep(0.2)
res = client.get(url_for("watchlist.index"))
assert b'<span id="unread-tab-counter">0</span>' in res.data
assert b'unread-tab-counter' not in res.data, "Unread filter chip should disappear when there are no unread changes"
delete_all_watches(client)