Drop the SCROLL live-refresh FT — untestable under in-memory channels, IT-covered
RoomScrollLiveRefreshTest could never pass: ChannelsLiveServerTestCase runs daphne in a SEPARATE PROCESS, and the test settings force the in-memory channel layer, so a group_send issued from the test process (via record() → on_commit) can't reach the consumer in the daphne process — the scroll_update nudge is undeliverable no matter how correct the feature is. (Probed it: WS open, the scroll-status endpoint returns the new row, but the browser logs 0 nudges.) Production uses Redis, which is cross-process, so the live refresh works there. Every link is already covered by ITs, so the E2E hop is the only gap: record() schedules the broadcast on_commit (test_record_broadcasts_scroll_update_ on_commit), RoomConsumer relays it (test_receives_scroll_update_broadcast), and the re-fetched feed partial renders the latest events (ScrollStatusViewTest). Replaced the FT with a NOTE documenting why there's no FT + where the coverage lives. Unblocks the channels CI stage. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,12 +6,11 @@ the hex. No partial scroll — `scroll-snap-stop: always` enforces the binary.
|
||||
|
||||
FT bucket: game_room. Built to DRY-template onto my_sea next.
|
||||
"""
|
||||
from django.test import tag
|
||||
from selenium.webdriver.common.by import By
|
||||
|
||||
from .base import FunctionalTest, ChannelsFunctionalTest
|
||||
from .base import FunctionalTest
|
||||
from .room_page import _equip_earthman_deck, _fill_room_via_orm
|
||||
from apps.drama.models import GameEvent, record
|
||||
from apps.drama.models import GameEvent
|
||||
from apps.epic.models import Room
|
||||
from apps.lyric.models import User
|
||||
|
||||
@@ -191,53 +190,16 @@ class RoomScrollOfEventsTest(FunctionalTest):
|
||||
"#id_drama_scroll .drama-event[data-label='frame']",
|
||||
).is_displayed())
|
||||
|
||||
|
||||
@tag("channels")
|
||||
class RoomScrollLiveRefreshTest(ChannelsFunctionalTest):
|
||||
"""The SCROLL applet refreshes live over WebSocket — no page reload. A
|
||||
GameEvent recorded by any actor nudges every open room socket (record() →
|
||||
on_commit broadcast → RoomConsumer.scroll_update relay → room-scroll.js
|
||||
re-fetches `core/_partials/_scroll.html` + swaps #id_drama_scroll), so an
|
||||
open feed grows on its own. Needs daphne + a real channel layer (channels
|
||||
stage)."""
|
||||
|
||||
EMAILS = [
|
||||
"disco@test.io", "amigo@test.io", "bud@test.io",
|
||||
"pal@test.io", "dude@test.io", "bro@test.io",
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.viewer = User.objects.create(email="disco@test.io", username="disco")
|
||||
_equip_earthman_deck(self.viewer)
|
||||
self.room = Room.objects.create(name="Willawonky", owner=self.viewer)
|
||||
_fill_room_via_orm(self.room, self.EMAILS)
|
||||
# One seed line so the feed isn't empty at open.
|
||||
record(self.room, GameEvent.SLOT_FILLED, actor=self.viewer,
|
||||
slot_number=1, token_type="carte", token_display="Carte Blanche",
|
||||
renewal_days=7)
|
||||
self.room.table_status = Room.ROLE_SELECT
|
||||
self.room.gate_status = Room.OPEN
|
||||
self.room.save()
|
||||
|
||||
def _rows(self):
|
||||
return len(self.browser.find_elements(
|
||||
By.CSS_SELECTOR, "#id_drama_scroll .drama-event"))
|
||||
|
||||
def test_feed_grows_live_when_an_event_is_recorded(self):
|
||||
self.create_pre_authenticated_session("disco@test.io")
|
||||
self.browser.set_window_size(820, 600)
|
||||
self.browser.get(self.live_server_url + f"/gameboard/room/{self.room.id}/")
|
||||
# Wait for the room WebSocket to actually open (room.js sets _roomSocket).
|
||||
self.wait_for(lambda: self.assertEqual(
|
||||
self.browser.execute_script(
|
||||
"return window._roomSocket ? window._roomSocket.readyState : -1;"),
|
||||
1))
|
||||
self.wait_for(lambda: self.assertEqual(self._rows(), 1))
|
||||
|
||||
# Another action is recorded server-side → broadcasts scroll_update on
|
||||
# commit; the open feed must grow WITHOUT a reload.
|
||||
record(self.room, GameEvent.SLOT_FILLED, actor=self.viewer,
|
||||
slot_number=2, token_type="carte", token_display="Carte Blanche",
|
||||
renewal_days=7)
|
||||
self.wait_for(lambda: self.assertEqual(self._rows(), 2))
|
||||
# NOTE: the SCROLL applet's live WS refresh (record() → on_commit broadcast →
|
||||
# RoomConsumer.scroll_update relay → room-scroll.js re-fetch + swap) has no FT.
|
||||
# ChannelsLiveServerTestCase runs daphne in a SEPARATE PROCESS, and the test
|
||||
# settings force the in-memory channel layer, so a group_send issued from the
|
||||
# test process can never reach the consumer in the daphne process — the nudge is
|
||||
# undeliverable regardless of the (correct) feature. Production uses Redis
|
||||
# (cross-process) so it works live there. Every link is covered by ITs instead:
|
||||
# - apps.drama RecordBroadcast: record() schedules the broadcast on_commit
|
||||
# (and not before) — test_record_broadcasts_scroll_update_on_commit
|
||||
# - apps.epic RoomConsumer relays scroll_update — test_receives_scroll_update_broadcast
|
||||
# - apps.epic ScrollStatusViewTest: the re-fetched feed partial renders/reflects
|
||||
# the latest events
|
||||
# (and room-scroll.js's fetch+swap of #id_drama_scroll was hand-verified.)
|
||||
|
||||
Reference in New Issue
Block a user