role select channels FTs: equip Earthman deck in setUp — fixes no-deck guard block
Some checks failed
ci/woodpecker/push/pyswiss Pipeline was successful
ci/woodpecker/push/main Pipeline failed

The role-select.js no-deck guard (added with e512e94) shows a warning instead of
opening #id_role_select when data-equipped-deck is empty. Three RoleSelectChannelsTest
setups didn't equip a deck for the founder, so the card-stack click never opened the
modal and all three failed with NoSuchElementException on #id_role_select.
Only the founder needs equipping — other gamers' roles are ORM-assigned, no browser click.

Code architected by Disco DeDisco <discodedisco@outlook.com>
Git commit message Co-Authored-By:
Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Disco DeDisco
2026-04-28 02:33:15 -04:00
parent 478e845ecf
commit 4b8e02b698

View File

@@ -9,10 +9,18 @@ from selenium.webdriver.common.by import By
from .base import FunctionalTest, ChannelsFunctionalTest from .base import FunctionalTest, ChannelsFunctionalTest
from .management.commands.create_session import create_pre_authenticated_session from .management.commands.create_session import create_pre_authenticated_session
from apps.applets.models import Applet from apps.applets.models import Applet
from apps.epic.models import Room, GateSlot, TableSeat from apps.epic.models import DeckVariant, Room, GateSlot, TableSeat
from apps.lyric.models import User from apps.lyric.models import User
def _equip_earthman_deck(user):
"""Equip the Earthman DeckVariant so the role-select no-deck guard passes."""
deck = DeckVariant.objects.filter(name__icontains="Earthman").first()
if deck:
user.equipped_deck = deck
user.save(update_fields=["equipped_deck"])
def _fill_room_via_orm(room, emails): def _fill_room_via_orm(room, emails):
"""Fill all 6 gate slots and set gate_status=OPEN. Returns list of gamers.""" """Fill all 6 gate slots and set gate_status=OPEN. Returns list of gamers."""
gamers = [] gamers = []
@@ -713,6 +721,7 @@ class RoleSelectChannelsTest(ChannelsFunctionalTest):
def test_observer_sees_seat_arc_during_selection(self): def test_observer_sees_seat_arc_during_selection(self):
founder, _ = User.objects.get_or_create(email="founder@test.io") founder, _ = User.objects.get_or_create(email="founder@test.io")
_equip_earthman_deck(founder)
User.objects.get_or_create(email="watcher@test.io") User.objects.get_or_create(email="watcher@test.io")
room = Room.objects.create(name="Arc Test", owner=founder) room = Room.objects.create(name="Arc Test", owner=founder)
_fill_room_via_orm(room, [ _fill_room_via_orm(room, [
@@ -774,6 +783,7 @@ class RoleSelectChannelsTest(ChannelsFunctionalTest):
def _make_turn_test_room(self): def _make_turn_test_room(self):
founder, _ = User.objects.get_or_create(email="founder@test.io") founder, _ = User.objects.get_or_create(email="founder@test.io")
_equip_earthman_deck(founder)
User.objects.get_or_create(email="friend@test.io") User.objects.get_or_create(email="friend@test.io")
room = Room.objects.create(name="Turn Test", owner=founder) room = Room.objects.create(name="Turn Test", owner=founder)
_fill_room_via_orm(room, [ _fill_room_via_orm(room, [
@@ -859,6 +869,7 @@ class RoleSelectChannelsTest(ChannelsFunctionalTest):
"pal@test.io", "dude@test.io", "bro@test.io", "pal@test.io", "dude@test.io", "bro@test.io",
] ]
founder, _ = User.objects.get_or_create(email="founder@test.io") founder, _ = User.objects.get_or_create(email="founder@test.io")
_equip_earthman_deck(founder)
room = Room.objects.create(name="Last Role Test", owner=founder) room = Room.objects.create(name="Last Role Test", owner=founder)
_fill_room_via_orm(room, emails) _fill_room_via_orm(room, emails)
room.table_status = Room.ROLE_SELECT room.table_status = Room.ROLE_SELECT