Sig select: _card-deck.scss extract, WS cursor fixes, own-role indicators, role icon refresh
- New _card-deck.scss: sig select styles moved out of _room.scss + _game-kit.scss - sig-select.js: 3 WS bug fixes — thumbs-up deferred to window.load (layout settled before getBoundingClientRect), hover cursor cleared for all cards on reservation (not just the reserved card), applyHover guards against already-reserved roles - Own-role indicators: gamer now sees their own role-coloured card outline + thumbs-up - Reservation glow: replaced blurry role+ninUser double-shadow with crisp 2px outline - Gravity qualifier: Graven text set to --terUser (matches Leavened/--quiUser pattern) - Role card SVGs refreshed; starter-role-Blank removed - FTs + Jasmine specs extended for sig select WS behaviour - setup_sig_session management command for multi-browser manual testing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
128
src/functional_tests/management/commands/setup_sig_session.py
Normal file
128
src/functional_tests/management/commands/setup_sig_session.py
Normal file
@@ -0,0 +1,128 @@
|
||||
"""
|
||||
Management command for manual multi-user sig-select testing.
|
||||
|
||||
Creates (or reuses) a room with all 6 gate slots filled, roles assigned,
|
||||
and table_status=SIG_SELECT. Prints one pre-auth URL per gamer so you can
|
||||
paste them into 6 Firefox Multi-Account Container tabs.
|
||||
|
||||
Usage:
|
||||
python src/manage.py setup_sig_session
|
||||
python src/manage.py setup_sig_session --base-url http://localhost:8000
|
||||
python src/manage.py setup_sig_session --room <uuid> # reuse existing room
|
||||
"""
|
||||
|
||||
from django.contrib.auth import BACKEND_SESSION_KEY, HASH_SESSION_KEY, SESSION_KEY
|
||||
from django.contrib.sessions.backends.db import SessionStore
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from apps.epic.models import DeckVariant, GateSlot, Room, TableSeat, TarotCard
|
||||
from apps.lyric.models import User
|
||||
|
||||
|
||||
GAMERS = [
|
||||
("founder@test.io", "discoman"),
|
||||
("amigo@test.io", "amigo"),
|
||||
("bud@test.io", "bud"),
|
||||
("pal@test.io", "pal"),
|
||||
("dude@test.io", "dude"),
|
||||
("bro@test.io", "bro"),
|
||||
]
|
||||
|
||||
ROLES = ["PC", "NC", "EC", "SC", "AC", "BC"]
|
||||
|
||||
|
||||
def _ensure_earthman():
|
||||
"""Return (or create) the Earthman DeckVariant with enough sig-deck cards seeded."""
|
||||
earthman, _ = DeckVariant.objects.get_or_create(
|
||||
slug="earthman",
|
||||
defaults={"name": "Earthman Deck", "card_count": 108, "is_default": True},
|
||||
)
|
||||
_NAME = {11: "Maid", 12: "Jack", 13: "Queen", 14: "King"}
|
||||
for suit in ("WANDS", "PENTACLES", "SWORDS", "CUPS"):
|
||||
for number in (11, 12, 13, 14):
|
||||
TarotCard.objects.get_or_create(
|
||||
deck_variant=earthman,
|
||||
slug=f"{_NAME[number].lower()}-of-{suit.lower()}-em",
|
||||
defaults={
|
||||
"arcana": "MINOR",
|
||||
"suit": suit,
|
||||
"number": number,
|
||||
"name": f"{_NAME[number]} of {suit.capitalize()}",
|
||||
},
|
||||
)
|
||||
return earthman
|
||||
|
||||
|
||||
def _make_session(user):
|
||||
session = SessionStore()
|
||||
session[SESSION_KEY] = str(user.pk)
|
||||
session[BACKEND_SESSION_KEY] = "apps.lyric.authentication.PasswordlessAuthenticationBackend"
|
||||
session[HASH_SESSION_KEY] = user.get_session_auth_hash()
|
||||
session.save()
|
||||
return session.session_key
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "Set up a SIG_SELECT room and print pre-auth URLs for all six gamers"
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument("--base-url", default="http://localhost:8000")
|
||||
parser.add_argument("--room", default=None, help="UUID of an existing room to reuse")
|
||||
|
||||
def handle(self, *args, **options):
|
||||
base_url = options["base_url"].rstrip("/")
|
||||
earthman = _ensure_earthman()
|
||||
|
||||
# ── Users ────────────────────────────────────────────────────────────
|
||||
users = []
|
||||
for email, _ in GAMERS:
|
||||
user, _ = User.objects.get_or_create(email=email)
|
||||
user.is_staff = True
|
||||
user.is_superuser = True
|
||||
if not user.equipped_deck:
|
||||
user.equipped_deck = earthman
|
||||
user.save()
|
||||
users.append(user)
|
||||
|
||||
# ── Room ─────────────────────────────────────────────────────────────
|
||||
if options["room"]:
|
||||
room = Room.objects.get(pk=options["room"])
|
||||
else:
|
||||
room = Room.objects.create(
|
||||
name="Sig Select Test Room",
|
||||
owner=users[0],
|
||||
visibility=Room.PUBLIC,
|
||||
)
|
||||
|
||||
# ── Gate slots ───────────────────────────────────────────────────────
|
||||
for i, user in enumerate(users, start=1):
|
||||
slot = room.gate_slots.get(slot_number=i)
|
||||
slot.gamer = user
|
||||
slot.status = GateSlot.FILLED
|
||||
slot.save()
|
||||
|
||||
room.gate_status = Room.OPEN
|
||||
room.save()
|
||||
|
||||
# ── Table seats + roles ──────────────────────────────────────────────
|
||||
for i, (user, role) in enumerate(zip(users, ROLES), start=1):
|
||||
TableSeat.objects.update_or_create(
|
||||
room=room, slot_number=i,
|
||||
defaults={"gamer": user, "role": role, "role_revealed": True},
|
||||
)
|
||||
|
||||
room.table_status = Room.SIG_SELECT
|
||||
room.save()
|
||||
|
||||
# ── Print URLs ───────────────────────────────────────────────────────
|
||||
room_path = f"/gameboard/room/{room.pk}/"
|
||||
self.stdout.write(f"\nRoom: {base_url}{room_path}\n")
|
||||
self.stdout.write(f"{'Container':<12} {'Email':<22} {'Role':<6} URL")
|
||||
self.stdout.write("─" * 100)
|
||||
|
||||
for (email, container), user, role in zip(GAMERS, users, ROLES):
|
||||
session_key = _make_session(user)
|
||||
url = f"{base_url}/lyric/dev-login/{session_key}/?next={room_path}"
|
||||
self.stdout.write(f"{container:<12} {email:<22} {role:<6} {url}")
|
||||
|
||||
self.stdout.write("")
|
||||
Reference in New Issue
Block a user