new migrations in apps.epic & apps.lyric apps; new Token fields of latter articulate upon Room model helper fns of former; new FTs, ITs & UTs capture new behavior accordingly; new template partial content in templates/apps/gameboard

This commit is contained in:
Disco DeDisco
2026-03-13 17:31:52 -04:00
parent 5773462b4c
commit 6a42b91420
12 changed files with 239 additions and 9 deletions

View File

@@ -10,6 +10,9 @@ class GatekeeperTest(FunctionalTest):
Applet.objects.get_or_create(
slug="new-game", defaults={"name": "New Game", "context": "gameboard"}
)
Applet.objects.get_or_create(
slug="my-games", defaults={"name": "My Games", "context": "gameboard"}
)
def test_founder_creates_room_and_sees_gatekeeper(self):
# 1. Log in, navigate to gameboard
@@ -40,3 +43,50 @@ class GatekeeperTest(FunctionalTest):
slot_1.find_element(By.CSS_SELECTOR, ".drop-token-btn")
for slot in slots[1:]:
self.assertIn("empty", slot.get_attribute("class"))
def test_founder_drops_token_and_slot_fills(self):
# 1. Set up: log in, create room, arrive at gatekeeper
self.create_pre_authenticated_session("founder@test.io")
self.browser.get(self.live_server_url + "/gameboard/")
self.wait_for(
lambda: self.browser.find_element(By.ID, "id_new_game_name")
)
self.browser.find_element(By.ID, "id_new_game_name").send_keys("Dragon's Den")
self.browser.find_element(By.ID, "id_create_game_btn").click()
self.wait_for(
lambda: self.assertIn("/gate/", self.browser.current_url)
)
# 2. Founder clicks Drop Token on slot 1
drop_btn = self.wait_for(
lambda: self.browser.find_element(By.CSS_SELECTOR, ".drop-token-btn")
)
drop_btn.click()
# 3. Slot 1 now filled; drop btn gone
self.wait_for(
lambda: self.browser.find_element(By.CSS_SELECTOR, ".gate-slot.filled")
)
slots = self.browser.find_elements(By.CSS_SELECTOR, ".gate-slot")
self.assertIn("filled", slots[0].get_attribute("class"))
self.assertEqual(
len(self.browser.find_elements(By.CSS_SELECTOR, ".drop-token-btn")), 0
)
def test_room_appears_in_my_games_after_creation(self):
# 1. Set up founder, game room, name
self.create_pre_authenticated_session("founder@test.io")
self.browser.get(self.live_server_url + "/gameboard/")
self.wait_for(
lambda: self.browser.find_element(By.ID, "id_new_game_name")
)
self.browser.find_element(By.ID, "id_new_game_name").send_keys("Dragon's Den")
self.browser.find_element(By.ID, "id_create_game_btn").click()
self.wait_for(
lambda: self.assertIn("/gate/", self.browser.current_url)
)
# 2. Navigate back to gameboard
self.browser.get(self.live_server_url + "/gameboard/")
my_games = self.wait_for(
lambda: self.browser.find_element(By.ID, "id_applet_my_games")
)
self.assertIn("Dragon's Den", my_games.text)