diff --git a/changedetectionio/tests/test_ui.py b/changedetectionio/tests/test_ui.py index d6adbefd..05c5f30b 100644 --- a/changedetectionio/tests/test_ui.py +++ b/changedetectionio/tests/test_ui.py @@ -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'2' 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'1' 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'1' 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'0' 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)