From aabe57b767d0ae1ff24d01fb7b6641e52f67873f Mon Sep 17 00:00:00 2001 From: mwiegand Date: Thu, 21 May 2026 09:56:28 +0200 Subject: [PATCH] test(pages): update assertions stale from prior UI refactors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two pre-existing failures unrelated to autoscroll, both from earlier template redesigns that the corresponding tests never tracked: test_server_actions_fragment_polls_while_running Asserted data-sse-url="/jobs//stream" in the actions fragment. That streaming
 was removed when the inline job-log moved into
  #job-log-modal (see test_server_detail_no_inline_job_log_pre).
  Replace with the modal-open trigger assertion.

test_workshop_overlay_refresh_button_hidden_during_build
  Used "building…" label as the positive companion that the
  build-running guard fired. The workshop overlay path now includes
  _overlay_build_status.html with omit_badge=True, so that label
  isn't rendered. Switch to hx-trigger="every 2s", which the partial
  emits unconditionally while a build is running.

Co-Authored-By: Claude Opus 4.7 (1M context) 
---
 l4d2web/tests/test_pages.py | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/l4d2web/tests/test_pages.py b/l4d2web/tests/test_pages.py
index 612445b..b31596e 100644
--- a/l4d2web/tests/test_pages.py
+++ b/l4d2web/tests/test_pages.py
@@ -147,8 +147,6 @@ def test_server_actions_fragment_polls_while_running(auth_client_with_server) ->
     with session_scope() as session:
         job = Job(user_id=1, server_id=1, operation="start", state="queued")
         session.add(job)
-        session.flush()
-        job_id = job.id
 
     response = auth_client_with_server.get("/servers/1/actions")
     text = response.get_data(as_text=True)
@@ -157,7 +155,10 @@ def test_server_actions_fragment_polls_while_running(auth_client_with_server) ->
     assert 'id="server-actions"' in text
     assert " None:
@@ -772,5 +773,9 @@ def test_workshop_overlay_refresh_button_hidden_during_build(auth_client_with_se
     assert response.status_code == 200
     assert "Refresh from Steam" not in text
     # Positive companion: confirm the build-running guard actually fired,
-    # otherwise the negative could pass vacuously on a broken page.
-    assert "building…" in text
+    # otherwise the negative could pass vacuously on a broken page. The
+    # workshop overlay path includes _overlay_build_status.html with
+    # omit_badge=True, so the "building…" label is not rendered here; the
+    # 'hx-trigger="every 2s"' attribute is the unambiguous running-state
+    # signal that the partial emits regardless of omit_badge.
+    assert 'hx-trigger="every 2s"' in text