new applet structure for apps.billboard, incl. My Scrolls, Contacts & Most Recent applets; completely revamped _billboard.scss, tho some styling inconsistencies persist; ensured #id_billboard_applets_container inherited base styles found in _applets.scss; a pair of new migrations in apps.applets to support new applet models & fields; billboard gets its first ITs, new urls & views; pair of new FT classes in FTs.test_billboard

This commit is contained in:
Disco DeDisco
2026-03-24 16:46:46 -04:00
parent 18898c7a0f
commit 189d329e76
18 changed files with 492 additions and 31 deletions

View File

@@ -1,6 +1,7 @@
from selenium.webdriver.common.by import By
from .base import FunctionalTest
from apps.applets.models import Applet
from apps.drama.models import GameEvent, record
from apps.epic.models import Room, GateSlot
from apps.lyric.models import User
@@ -18,8 +19,17 @@ class BillboardScrollTest(FunctionalTest):
def setUp(self):
super().setUp()
self.founder = User.objects.create(email="founder@scroll.io")
self.other = User.objects.create(email="other@scroll.io")
for slug, name, cols, rows in [
("billboard-my-scrolls", "My Scrolls", 4, 3),
("billboard-my-contacts", "Contacts", 4, 3),
("billboard-most-recent", "Most Recent", 8, 6),
]:
Applet.objects.get_or_create(
slug=slug,
defaults={"name": name, "grid_cols": cols, "grid_rows": rows, "context": "billboard"},
)
self.founder = User.objects.create(email="founder@test.io")
self.other = User.objects.create(email="other@test.io")
self.room = Room.objects.create(name="Blissful Ignorance", owner=self.founder)
# Simulate two gate fills — one by founder, one by the other gamer
record(
@@ -44,7 +54,7 @@ class BillboardScrollTest(FunctionalTest):
def test_footer_scroll_icon_leads_to_billboard_with_rooms(self):
# Founder logs in and lands on the dashboard
self.create_pre_authenticated_session("founder@scroll.io")
self.create_pre_authenticated_session("founder@test.io")
self.browser.get(self.live_server_url + "/")
# Footer contains a scroll icon link pointing to /billboard/
@@ -65,7 +75,7 @@ class BillboardScrollTest(FunctionalTest):
# ------------------------------------------------------------------ #
def test_scroll_shows_human_readable_event_log(self):
self.create_pre_authenticated_session("founder@scroll.io")
self.create_pre_authenticated_session("founder@test.io")
self.browser.get(self.live_server_url + "/billboard/")
# Click the room link to reach the scroll
@@ -93,7 +103,7 @@ class BillboardScrollTest(FunctionalTest):
# ------------------------------------------------------------------ #
def test_scroll_aligns_own_events_right_and_others_left(self):
self.create_pre_authenticated_session("founder@scroll.io")
self.create_pre_authenticated_session("founder@test.io")
self.browser.get(self.live_server_url + "/billboard/")
self.wait_for(
lambda: self.browser.find_element(By.LINK_TEXT, "Blissful Ignorance")
@@ -111,3 +121,102 @@ class BillboardScrollTest(FunctionalTest):
# The other gamer's event mentions their display name
self.assertIn("other", theirs_events[0].text)
class BillboardAppletsTest(FunctionalTest):
"""
FT: billboard page renders three applets in the grid — My Scrolls,
My Contacts, and Most Recent — with a functioning gear menu.
"""
def setUp(self):
super().setUp()
self.founder = User.objects.create(email="founder@test.io")
self.room = Room.objects.create(name="Arcane Assembly", owner=self.founder)
for slug, name, cols, rows in [
("billboard-my-scrolls", "My Scrolls", 4, 3),
("billboard-my-contacts", "Contacts", 4, 3),
("billboard-most-recent", "Most Recent", 8, 6),
]:
Applet.objects.get_or_create(
slug=slug,
defaults={"name": name, "grid_cols": cols, "grid_rows": rows, "context": "billboard"},
)
def test_billboard_shows_three_applets(self):
# 1. Log in, navigate to billboard
self.create_pre_authenticated_session("founder@test.io")
self.browser.get(self.live_server_url + "/billboard/")
# 2. Assert all three applet sections present
self.wait_for(
lambda: self.browser.find_element(By.ID, "id_applet_billboard_my_scrolls")
)
self.browser.find_element(By.ID, "id_applet_billboard_my_contacts")
self.browser.find_element(By.ID, "id_applet_billboard_most_recent")
def test_billboard_my_scrolls_lists_rooms(self):
# 1. Log in, navigate to billboard
self.create_pre_authenticated_session("founder@test.io")
self.browser.get(self.live_server_url + "/billboard/")
# 2. My Scrolls applet contains a link to the room's scroll
self.wait_for(
lambda: self.assertIn(
"Arcane Assembly",
self.browser.find_element(By.ID, "id_applet_billboard_my_scrolls").text,
)
)
def test_billboard_gear_btn_opens_applet_menu(self):
# 1. Log in, navigate to billboard
self.create_pre_authenticated_session("founder@test.io")
self.browser.get(self.live_server_url + "/billboard/")
# 2. Gear button is visible
gear_btn = self.wait_for(
lambda: self.browser.find_element(By.CSS_SELECTOR, ".billboard-page .gear-btn")
)
# 3. Menu is hidden before click
menu = self.browser.find_element(By.ID, "id_billboard_applet_menu")
self.assertFalse(menu.is_displayed())
# 4. Clicking gear opens the menu (JS click bypasses kit-bag overlap in headless)
self.browser.execute_script("arguments[0].click()", gear_btn)
self.wait_for_slow(lambda: self.assertTrue(menu.is_displayed()))
class BillscrollAppletsTest(FunctionalTest):
"""
FT: billscroll page renders as a single full-width applet that fills
the viewport aperture and contains the room's drama events.
"""
def setUp(self):
super().setUp()
self.founder = User.objects.create(email="founder@billtest.io")
self.room = Room.objects.create(name="Spectral Council", owner=self.founder)
record(
self.room, GameEvent.SLOT_FILLED, actor=self.founder,
slot_number=1, token_type="coin",
token_display="Coin-on-a-String", renewal_days=7,
)
def test_billscroll_shows_full_width_applet(self):
# 1. Log in, navigate to the room's scroll
self.create_pre_authenticated_session("founder@billtest.io")
self.browser.get(
self.live_server_url + f"/billboard/room/{self.room.id}/scroll/"
)
# 2. The full-width applet section is present
self.wait_for(
lambda: self.browser.find_element(By.ID, "id_applet_billboard_scroll")
)
def test_billscroll_applet_contains_drama_events(self):
# 1. Log in, navigate to the room's scroll
self.create_pre_authenticated_session("founder@billtest.io")
self.browser.get(
self.live_server_url + f"/billboard/room/{self.room.id}/scroll/"
)
# 2. Drama scroll is inside the applet and shows the event
scroll = self.wait_for(
lambda: self.browser.find_element(By.ID, "id_drama_scroll")
)
self.assertIn("Coin-on-a-String", scroll.text)