Files
python-tdd/src/functional_tests/test_game_room_deck_contrib.py

202 lines
8.8 KiB
Python
Raw Normal View History

"""
Functional tests: deck-to-seat contribution mechanics.
Sprint 1 (DeckContributionTest):
Confirming a role in ROLE SELECT assigns the gamer's equipped deck to the
TableSeat. The Game Kit immediately reflects the in-use state: the deck
card gains the game name in its tooltip and the micro-status reads "In-Use".
Sprint 2 (DeckInUseGameKitTest):
With a deck already assigned to an active seat the Game Kit DON button is
btn-disabled and no DOFF toggle is shown (unlike the normal equipped state
where DOFF is visible). Clicking the card shows a tooltip naming the game.
A second deck that is NOT assigned to any active seat has normal DON/DOFF
behaviour.
"""
import time
from django.test import tag
from selenium.webdriver.common.by import By
from apps.applets.models import Applet
from apps.epic.models import DeckVariant, GateSlot, Room, TableSeat
from apps.lyric.models import User
from functional_tests.base import FunctionalTest
from functional_tests.room_page import _fill_room_via_orm
FOUNDER_EMAIL = "founder@test.io"
GAMER_EMAIL = "gamer@test.io"
def _equip_earthman(user):
fix CI FT regressions: deck contribution, ROLE SELECT no-deck guard, sig qualifiers, Carte Blanche multi-slot - test_deck_contribution: get_or_create _equip_earthman + unlocked_decks.add; slot_number=2 on _setup_in_use_deck seat; navigate to /gameboard/ (not gate — game-kit panel absent there); drop #id_kit_card_deck click ({% empty %} placeholder; deck renders in loop when present); use textContent for CSS-hidden tooltip; drop stale .deck-micro-status assertion (now mini-portal) - ROLE SELECT FTs (RoleSelectTest + RoleSelectTrayTest): equip Earthman deck for active-slot user in each test that opens the fan — fixes no-deck JS guard blocking #id_role_select - test_room_sig_select: seed The Nomad/Schizo w. correct Earthman slugs/names + Enlightened/ Engraven qualifiers; grant super-nomad + super-schizo Notes to all gamers so Major Arcana appear in overlay; seed Middle Arcana w. Elevated/Graven qualifiers; rename test methods - test_game_kit: drop stale assertIn("active", text) — availability moved to In-Use mini-portal - Carte Blanche: CB stays equipped after multi-slot deposit (revert drop_token unequip); select_role existing-seat query gains order_by("slot_number") for deterministic primary seat; multi-slot FT: kit bag shows placeholder after first deposit (CB unequipped); cold-feet verifies DON via hover→portal; re-equip via portal DON before re-deposit; new test_carte_in_use_game_kit_shows_room_attribution checks Game Kit tooltip after deposit Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 16:29:51 -04:00
earthman, _ = DeckVariant.objects.get_or_create(
slug="earthman",
defaults={"name": "Earthman", "card_count": 106, "is_default": True},
)
user.equipped_deck = earthman
user.save(update_fields=["equipped_deck"])
fix CI FT regressions: deck contribution, ROLE SELECT no-deck guard, sig qualifiers, Carte Blanche multi-slot - test_deck_contribution: get_or_create _equip_earthman + unlocked_decks.add; slot_number=2 on _setup_in_use_deck seat; navigate to /gameboard/ (not gate — game-kit panel absent there); drop #id_kit_card_deck click ({% empty %} placeholder; deck renders in loop when present); use textContent for CSS-hidden tooltip; drop stale .deck-micro-status assertion (now mini-portal) - ROLE SELECT FTs (RoleSelectTest + RoleSelectTrayTest): equip Earthman deck for active-slot user in each test that opens the fan — fixes no-deck JS guard blocking #id_role_select - test_room_sig_select: seed The Nomad/Schizo w. correct Earthman slugs/names + Enlightened/ Engraven qualifiers; grant super-nomad + super-schizo Notes to all gamers so Major Arcana appear in overlay; seed Middle Arcana w. Elevated/Graven qualifiers; rename test methods - test_game_kit: drop stale assertIn("active", text) — availability moved to In-Use mini-portal - Carte Blanche: CB stays equipped after multi-slot deposit (revert drop_token unequip); select_role existing-seat query gains order_by("slot_number") for deterministic primary seat; multi-slot FT: kit bag shows placeholder after first deposit (CB unequipped); cold-feet verifies DON via hover→portal; re-equip via portal DON before re-deposit; new test_carte_in_use_game_kit_shows_room_attribution checks Game Kit tooltip after deposit Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 16:29:51 -04:00
# Signal may not have added this (earthman didn't exist when the user was created)
user.unlocked_decks.add(earthman)
return earthman
def _room_at_role_select(name="Wildfire"):
"""Create a room filled to 6 and at ROLE_SELECT table status."""
founder, _ = User.objects.get_or_create(email=FOUNDER_EMAIL)
room = Room.objects.create(name=name, owner=founder)
emails = [FOUNDER_EMAIL, GAMER_EMAIL,
"b@test.io", "c@test.io", "d@test.io", "e@test.io"]
_fill_room_via_orm(room, emails)
for slot in room.gate_slots.all():
if slot.gamer:
_equip_earthman(slot.gamer)
room.table_status = Room.ROLE_SELECT
room.save()
return room, founder
# ── Sprint 1 ─────────────────────────────────────────────────────────────────
class DeckContributionTest(FunctionalTest):
"""Sprint 1: role confirmation → TableSeat.deck_variant set; Game Kit shows In-Use."""
def setUp(self):
super().setUp()
self.browser.set_window_size(800, 1200)
for slug, name, ctx in [
("game-kit", "Game Kit", "gameboard"),
("gk-decks", "Card Decks","game-kit"),
]:
Applet.objects.get_or_create(slug=slug, defaults={"name": name, "context": ctx})
def test_confirming_role_assigns_equipped_deck_to_seat(self):
"""After the gamer confirms a role, Game Kit shows the Earthman deck as 'In-Use'
with the game name in the deck tooltip, and the micro-status changes from
'Equipped' to 'In-Use'.
"""
room, founder = _room_at_role_select()
gamer = User.objects.get(email=GAMER_EMAIL)
fix CI FT regressions: deck contribution, ROLE SELECT no-deck guard, sig qualifiers, Carte Blanche multi-slot - test_deck_contribution: get_or_create _equip_earthman + unlocked_decks.add; slot_number=2 on _setup_in_use_deck seat; navigate to /gameboard/ (not gate — game-kit panel absent there); drop #id_kit_card_deck click ({% empty %} placeholder; deck renders in loop when present); use textContent for CSS-hidden tooltip; drop stale .deck-micro-status assertion (now mini-portal) - ROLE SELECT FTs (RoleSelectTest + RoleSelectTrayTest): equip Earthman deck for active-slot user in each test that opens the fan — fixes no-deck JS guard blocking #id_role_select - test_room_sig_select: seed The Nomad/Schizo w. correct Earthman slugs/names + Enlightened/ Engraven qualifiers; grant super-nomad + super-schizo Notes to all gamers so Major Arcana appear in overlay; seed Middle Arcana w. Elevated/Graven qualifiers; rename test methods - test_game_kit: drop stale assertIn("active", text) — availability moved to In-Use mini-portal - Carte Blanche: CB stays equipped after multi-slot deposit (revert drop_token unequip); select_role existing-seat query gains order_by("slot_number") for deterministic primary seat; multi-slot FT: kit bag shows placeholder after first deposit (CB unequipped); cold-feet verifies DON via hover→portal; re-equip via portal DON before re-deposit; new test_carte_in_use_game_kit_shows_room_attribution checks Game Kit tooltip after deposit Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 16:29:51 -04:00
# Create TableSeats; pre-assign slot 1 (PC) so gamer (slot 2) is the active seat
for slot in room.gate_slots.order_by("slot_number"):
role = "PC" if slot.slot_number == 1 else None
TableSeat.objects.create(
room=room, gamer=slot.gamer, slot_number=slot.slot_number, role=role
)
# Gamer logs in and navigates to the role-select room
fix CI FT regressions: deck contribution, ROLE SELECT no-deck guard, sig qualifiers, Carte Blanche multi-slot - test_deck_contribution: get_or_create _equip_earthman + unlocked_decks.add; slot_number=2 on _setup_in_use_deck seat; navigate to /gameboard/ (not gate — game-kit panel absent there); drop #id_kit_card_deck click ({% empty %} placeholder; deck renders in loop when present); use textContent for CSS-hidden tooltip; drop stale .deck-micro-status assertion (now mini-portal) - ROLE SELECT FTs (RoleSelectTest + RoleSelectTrayTest): equip Earthman deck for active-slot user in each test that opens the fan — fixes no-deck JS guard blocking #id_role_select - test_room_sig_select: seed The Nomad/Schizo w. correct Earthman slugs/names + Enlightened/ Engraven qualifiers; grant super-nomad + super-schizo Notes to all gamers so Major Arcana appear in overlay; seed Middle Arcana w. Elevated/Graven qualifiers; rename test methods - test_game_kit: drop stale assertIn("active", text) — availability moved to In-Use mini-portal - Carte Blanche: CB stays equipped after multi-slot deposit (revert drop_token unequip); select_role existing-seat query gains order_by("slot_number") for deterministic primary seat; multi-slot FT: kit bag shows placeholder after first deposit (CB unequipped); cold-feet verifies DON via hover→portal; re-equip via portal DON before re-deposit; new test_carte_in_use_game_kit_shows_room_attribution checks Game Kit tooltip after deposit Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 16:29:51 -04:00
self.create_pre_authenticated_session(GAMER_EMAIL)
self.browser.get(self.live_server_url + f"/gameboard/room/{room.pk}/")
fix CI FT regressions: deck contribution, ROLE SELECT no-deck guard, sig qualifiers, Carte Blanche multi-slot - test_deck_contribution: get_or_create _equip_earthman + unlocked_decks.add; slot_number=2 on _setup_in_use_deck seat; navigate to /gameboard/ (not gate — game-kit panel absent there); drop #id_kit_card_deck click ({% empty %} placeholder; deck renders in loop when present); use textContent for CSS-hidden tooltip; drop stale .deck-micro-status assertion (now mini-portal) - ROLE SELECT FTs (RoleSelectTest + RoleSelectTrayTest): equip Earthman deck for active-slot user in each test that opens the fan — fixes no-deck JS guard blocking #id_role_select - test_room_sig_select: seed The Nomad/Schizo w. correct Earthman slugs/names + Enlightened/ Engraven qualifiers; grant super-nomad + super-schizo Notes to all gamers so Major Arcana appear in overlay; seed Middle Arcana w. Elevated/Graven qualifiers; rename test methods - test_game_kit: drop stale assertIn("active", text) — availability moved to In-Use mini-portal - Carte Blanche: CB stays equipped after multi-slot deposit (revert drop_token unequip); select_role existing-seat query gains order_by("slot_number") for deterministic primary seat; multi-slot FT: kit bag shows placeholder after first deposit (CB unequipped); cold-feet verifies DON via hover→portal; re-equip via portal DON before re-deposit; new test_carte_in_use_game_kit_shows_room_attribution checks Game Kit tooltip after deposit Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 16:29:51 -04:00
# Gamer is slot 2 — card stack is eligible because slot 1/PC is pre-assigned
self.wait_for(
lambda: self.browser.find_element(By.CSS_SELECTOR, ".card-stack[data-state='eligible']")
).click()
self.wait_for(lambda: self.browser.find_element(By.ID, "id_role_select"))
self.browser.find_element(By.CSS_SELECTOR, "#id_role_select .card").click()
self.confirm_guard()
# Deck is now assigned to the seat in the DB
self.wait_for(lambda: self.assertTrue(
TableSeat.objects.filter(
gamer=gamer,
room=room,
deck_variant=gamer.equipped_deck,
).exists(),
"TableSeat.deck_variant was not set after role confirmation",
))
fix CI FT regressions: deck contribution, ROLE SELECT no-deck guard, sig qualifiers, Carte Blanche multi-slot - test_deck_contribution: get_or_create _equip_earthman + unlocked_decks.add; slot_number=2 on _setup_in_use_deck seat; navigate to /gameboard/ (not gate — game-kit panel absent there); drop #id_kit_card_deck click ({% empty %} placeholder; deck renders in loop when present); use textContent for CSS-hidden tooltip; drop stale .deck-micro-status assertion (now mini-portal) - ROLE SELECT FTs (RoleSelectTest + RoleSelectTrayTest): equip Earthman deck for active-slot user in each test that opens the fan — fixes no-deck JS guard blocking #id_role_select - test_room_sig_select: seed The Nomad/Schizo w. correct Earthman slugs/names + Enlightened/ Engraven qualifiers; grant super-nomad + super-schizo Notes to all gamers so Major Arcana appear in overlay; seed Middle Arcana w. Elevated/Graven qualifiers; rename test methods - test_game_kit: drop stale assertIn("active", text) — availability moved to In-Use mini-portal - Carte Blanche: CB stays equipped after multi-slot deposit (revert drop_token unequip); select_role existing-seat query gains order_by("slot_number") for deterministic primary seat; multi-slot FT: kit bag shows placeholder after first deposit (CB unequipped); cold-feet verifies DON via hover→portal; re-equip via portal DON before re-deposit; new test_carte_in_use_game_kit_shows_room_attribution checks Game Kit tooltip after deposit Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 16:29:51 -04:00
# Navigate to Game Kit — earthman deck renders directly (in-use, no placeholder click needed)
self.browser.get(self.live_server_url + "/gameboard/")
earthman_card = self.wait_for(
lambda: self.browser.find_element(By.CSS_SELECTOR, "#id_kit_earthman_deck")
)
game kit + role icons + tarot fan: in-use mini-portal label, FLIP cue polarity reset, role icon redraws Heterogeneous pre-existing changes (carried across multiple sessions, finally committed alongside the SIG SELECT exit sprint). Grouped: - gameboard.js: _inUseLabel(roomName) — buildMiniContent renders "In-Use: <name>" on hover (cap 24 chars; overflow → 21 + "…"). Reads token.dataset.inUseRoomName for decks & token.dataset.currentRoomName for trinkets. - _applet-game-kit.html: removes the inline <p class="tt-token-room-name"> + <p class="tt-deck-game-name"> paragraphs (now redundant — mini-portal carries the name); deck token gains data-in-use-room-name attr. - gameboard tests: assertions retargeted at data-in-use-room-name + the mini-portal flow rather than the deleted inline paragraphs (test_views, test_deck_contribution, test_trinket_carte_blanche). - game-kit.js: openFan + _testOpen reset _polarity = 'levity' so reopening the fan after FLIP-to-gravity always lands on the levity-painted face (the FLIP cue). The sessionStorage bookmark intentionally tracks card index only; polarity does NOT persist across reopen. - _tarot_fan.html: SSR-default polarity flipped from levity to gravity (levity_emanation → gravity_emanation, levity_qualifier → gravity_qualifier, levity_reversal → gravity_reversal across upright + reversal faces). Pairs w. the JS polarity reset above so JS repaints to levity on open. - FanStageSpec: 2 new specs — openFan polarity reset on reopen even after FLIP-to-gravity; sessionStorage stores no levity/gravity string. - starter-role-*.svg (Alchemist, Builder, Economist, Narrator, Player, Shepherd): redrawn / re-cropped art — viewBox tightened from 288×560 to ~154×156, paths re-traced. No new role added; existing 6 swapped in place. New starter-role-blank.svg added as fallback for unmapped role codes (referenced by tray.js _ROLE_SCRAWL default → 'Blank'). Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 22:28:32 -04:00
# Game name lives on data-in-use-room-name; the mini-portal renders it as
# "In-Use: <name>" on hover (Jasmine covers the JS truncation).
self.assertEqual(
room.name, earthman_card.get_attribute("data-in-use-room-name")
)
# ── Sprint 2 ─────────────────────────────────────────────────────────────────
class DeckInUseGameKitTest(FunctionalTest):
"""Sprint 2: DON disabled + no DOFF toggle for in-use deck; second deck unaffected."""
def setUp(self):
super().setUp()
self.browser.set_window_size(800, 1200)
for slug, name, ctx in [
("game-kit", "Game Kit", "gameboard"),
("gk-decks", "Card Decks","game-kit"),
]:
Applet.objects.get_or_create(slug=slug, defaults={"name": name, "context": ctx})
def _setup_in_use_deck(self):
"""Create a seated gamer whose Earthman deck is already assigned to a seat."""
room, founder = _room_at_role_select()
gamer = User.objects.get(email=GAMER_EMAIL)
earthman = _equip_earthman(gamer)
# Assign deck directly (Sprint 1 must be green first)
fix CI FT regressions: deck contribution, ROLE SELECT no-deck guard, sig qualifiers, Carte Blanche multi-slot - test_deck_contribution: get_or_create _equip_earthman + unlocked_decks.add; slot_number=2 on _setup_in_use_deck seat; navigate to /gameboard/ (not gate — game-kit panel absent there); drop #id_kit_card_deck click ({% empty %} placeholder; deck renders in loop when present); use textContent for CSS-hidden tooltip; drop stale .deck-micro-status assertion (now mini-portal) - ROLE SELECT FTs (RoleSelectTest + RoleSelectTrayTest): equip Earthman deck for active-slot user in each test that opens the fan — fixes no-deck JS guard blocking #id_role_select - test_room_sig_select: seed The Nomad/Schizo w. correct Earthman slugs/names + Enlightened/ Engraven qualifiers; grant super-nomad + super-schizo Notes to all gamers so Major Arcana appear in overlay; seed Middle Arcana w. Elevated/Graven qualifiers; rename test methods - test_game_kit: drop stale assertIn("active", text) — availability moved to In-Use mini-portal - Carte Blanche: CB stays equipped after multi-slot deposit (revert drop_token unequip); select_role existing-seat query gains order_by("slot_number") for deterministic primary seat; multi-slot FT: kit bag shows placeholder after first deposit (CB unequipped); cold-feet verifies DON via hover→portal; re-equip via portal DON before re-deposit; new test_carte_in_use_game_kit_shows_room_attribution checks Game Kit tooltip after deposit Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 16:29:51 -04:00
seat = TableSeat.objects.create(
gamer=gamer, room=room, slot_number=2, role="NC", deck_variant=earthman
)
return gamer, earthman, room, seat
def test_don_is_disabled_and_doff_absent_for_in_use_deck(self):
"""DON button carries btn-disabled; DOFF is not rendered at all (not just disabled)."""
gamer, earthman, room, seat = self._setup_in_use_deck()
fix CI FT regressions: deck contribution, ROLE SELECT no-deck guard, sig qualifiers, Carte Blanche multi-slot - test_deck_contribution: get_or_create _equip_earthman + unlocked_decks.add; slot_number=2 on _setup_in_use_deck seat; navigate to /gameboard/ (not gate — game-kit panel absent there); drop #id_kit_card_deck click ({% empty %} placeholder; deck renders in loop when present); use textContent for CSS-hidden tooltip; drop stale .deck-micro-status assertion (now mini-portal) - ROLE SELECT FTs (RoleSelectTest + RoleSelectTrayTest): equip Earthman deck for active-slot user in each test that opens the fan — fixes no-deck JS guard blocking #id_role_select - test_room_sig_select: seed The Nomad/Schizo w. correct Earthman slugs/names + Enlightened/ Engraven qualifiers; grant super-nomad + super-schizo Notes to all gamers so Major Arcana appear in overlay; seed Middle Arcana w. Elevated/Graven qualifiers; rename test methods - test_game_kit: drop stale assertIn("active", text) — availability moved to In-Use mini-portal - Carte Blanche: CB stays equipped after multi-slot deposit (revert drop_token unequip); select_role existing-seat query gains order_by("slot_number") for deterministic primary seat; multi-slot FT: kit bag shows placeholder after first deposit (CB unequipped); cold-feet verifies DON via hover→portal; re-equip via portal DON before re-deposit; new test_carte_in_use_game_kit_shows_room_attribution checks Game Kit tooltip after deposit Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 16:29:51 -04:00
self.create_pre_authenticated_session(GAMER_EMAIL)
self.browser.get(self.live_server_url + "/gameboard/")
self.wait_for(
lambda: self.browser.find_element(By.CSS_SELECTOR, "#id_kit_earthman_deck")
).click()
# DON is disabled
don_btn = self.wait_for(
lambda: self.browser.find_element(
By.CSS_SELECTOR, f"#id_kit_earthman_deck .btn-equip"
)
)
self.assertIn("btn-disabled", don_btn.get_attribute("class"))
fix CI FT regressions: deck contribution, ROLE SELECT no-deck guard, sig qualifiers, Carte Blanche multi-slot - test_deck_contribution: get_or_create _equip_earthman + unlocked_decks.add; slot_number=2 on _setup_in_use_deck seat; navigate to /gameboard/ (not gate — game-kit panel absent there); drop #id_kit_card_deck click ({% empty %} placeholder; deck renders in loop when present); use textContent for CSS-hidden tooltip; drop stale .deck-micro-status assertion (now mini-portal) - ROLE SELECT FTs (RoleSelectTest + RoleSelectTrayTest): equip Earthman deck for active-slot user in each test that opens the fan — fixes no-deck JS guard blocking #id_role_select - test_room_sig_select: seed The Nomad/Schizo w. correct Earthman slugs/names + Enlightened/ Engraven qualifiers; grant super-nomad + super-schizo Notes to all gamers so Major Arcana appear in overlay; seed Middle Arcana w. Elevated/Graven qualifiers; rename test methods - test_game_kit: drop stale assertIn("active", text) — availability moved to In-Use mini-portal - Carte Blanche: CB stays equipped after multi-slot deposit (revert drop_token unequip); select_role existing-seat query gains order_by("slot_number") for deterministic primary seat; multi-slot FT: kit bag shows placeholder after first deposit (CB unequipped); cold-feet verifies DON via hover→portal; re-equip via portal DON before re-deposit; new test_carte_in_use_game_kit_shows_room_attribution checks Game Kit tooltip after deposit Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 16:29:51 -04:00
# DOFF is present but disabled (both buttons disabled for in-use deck)
doff_btn = self.wait_for(
lambda: self.browser.find_element(
By.CSS_SELECTOR, f"#id_kit_earthman_deck .btn-unequip"
)
)
fix CI FT regressions: deck contribution, ROLE SELECT no-deck guard, sig qualifiers, Carte Blanche multi-slot - test_deck_contribution: get_or_create _equip_earthman + unlocked_decks.add; slot_number=2 on _setup_in_use_deck seat; navigate to /gameboard/ (not gate — game-kit panel absent there); drop #id_kit_card_deck click ({% empty %} placeholder; deck renders in loop when present); use textContent for CSS-hidden tooltip; drop stale .deck-micro-status assertion (now mini-portal) - ROLE SELECT FTs (RoleSelectTest + RoleSelectTrayTest): equip Earthman deck for active-slot user in each test that opens the fan — fixes no-deck JS guard blocking #id_role_select - test_room_sig_select: seed The Nomad/Schizo w. correct Earthman slugs/names + Enlightened/ Engraven qualifiers; grant super-nomad + super-schizo Notes to all gamers so Major Arcana appear in overlay; seed Middle Arcana w. Elevated/Graven qualifiers; rename test methods - test_game_kit: drop stale assertIn("active", text) — availability moved to In-Use mini-portal - Carte Blanche: CB stays equipped after multi-slot deposit (revert drop_token unequip); select_role existing-seat query gains order_by("slot_number") for deterministic primary seat; multi-slot FT: kit bag shows placeholder after first deposit (CB unequipped); cold-feet verifies DON via hover→portal; re-equip via portal DON before re-deposit; new test_carte_in_use_game_kit_shows_room_attribution checks Game Kit tooltip after deposit Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 16:29:51 -04:00
self.assertIn("btn-disabled", doff_btn.get_attribute("class"),
"DOFF should be present but disabled for an in-use deck")
game kit + role icons + tarot fan: in-use mini-portal label, FLIP cue polarity reset, role icon redraws Heterogeneous pre-existing changes (carried across multiple sessions, finally committed alongside the SIG SELECT exit sprint). Grouped: - gameboard.js: _inUseLabel(roomName) — buildMiniContent renders "In-Use: <name>" on hover (cap 24 chars; overflow → 21 + "…"). Reads token.dataset.inUseRoomName for decks & token.dataset.currentRoomName for trinkets. - _applet-game-kit.html: removes the inline <p class="tt-token-room-name"> + <p class="tt-deck-game-name"> paragraphs (now redundant — mini-portal carries the name); deck token gains data-in-use-room-name attr. - gameboard tests: assertions retargeted at data-in-use-room-name + the mini-portal flow rather than the deleted inline paragraphs (test_views, test_deck_contribution, test_trinket_carte_blanche). - game-kit.js: openFan + _testOpen reset _polarity = 'levity' so reopening the fan after FLIP-to-gravity always lands on the levity-painted face (the FLIP cue). The sessionStorage bookmark intentionally tracks card index only; polarity does NOT persist across reopen. - _tarot_fan.html: SSR-default polarity flipped from levity to gravity (levity_emanation → gravity_emanation, levity_qualifier → gravity_qualifier, levity_reversal → gravity_reversal across upright + reversal faces). Pairs w. the JS polarity reset above so JS repaints to levity on open. - FanStageSpec: 2 new specs — openFan polarity reset on reopen even after FLIP-to-gravity; sessionStorage stores no levity/gravity string. - starter-role-*.svg (Alchemist, Builder, Economist, Narrator, Player, Shepherd): redrawn / re-cropped art — viewBox tightened from 288×560 to ~154×156, paths re-traced. No new role added; existing 6 swapped in place. New starter-role-blank.svg added as fallback for unmapped role codes (referenced by tray.js _ROLE_SCRAWL default → 'Blank'). Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 22:28:32 -04:00
def test_in_use_deck_carries_game_name_for_mini_portal(self):
"""The in-use deck token exposes the room name via data-in-use-room-name
so the mini-portal can render it as 'In-Use: <name>' on hover."""
gamer, earthman, room, seat = self._setup_in_use_deck()
fix CI FT regressions: deck contribution, ROLE SELECT no-deck guard, sig qualifiers, Carte Blanche multi-slot - test_deck_contribution: get_or_create _equip_earthman + unlocked_decks.add; slot_number=2 on _setup_in_use_deck seat; navigate to /gameboard/ (not gate — game-kit panel absent there); drop #id_kit_card_deck click ({% empty %} placeholder; deck renders in loop when present); use textContent for CSS-hidden tooltip; drop stale .deck-micro-status assertion (now mini-portal) - ROLE SELECT FTs (RoleSelectTest + RoleSelectTrayTest): equip Earthman deck for active-slot user in each test that opens the fan — fixes no-deck JS guard blocking #id_role_select - test_room_sig_select: seed The Nomad/Schizo w. correct Earthman slugs/names + Enlightened/ Engraven qualifiers; grant super-nomad + super-schizo Notes to all gamers so Major Arcana appear in overlay; seed Middle Arcana w. Elevated/Graven qualifiers; rename test methods - test_game_kit: drop stale assertIn("active", text) — availability moved to In-Use mini-portal - Carte Blanche: CB stays equipped after multi-slot deposit (revert drop_token unequip); select_role existing-seat query gains order_by("slot_number") for deterministic primary seat; multi-slot FT: kit bag shows placeholder after first deposit (CB unequipped); cold-feet verifies DON via hover→portal; re-equip via portal DON before re-deposit; new test_carte_in_use_game_kit_shows_room_attribution checks Game Kit tooltip after deposit Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 16:29:51 -04:00
self.create_pre_authenticated_session(GAMER_EMAIL)
self.browser.get(self.live_server_url + "/gameboard/")
game kit + role icons + tarot fan: in-use mini-portal label, FLIP cue polarity reset, role icon redraws Heterogeneous pre-existing changes (carried across multiple sessions, finally committed alongside the SIG SELECT exit sprint). Grouped: - gameboard.js: _inUseLabel(roomName) — buildMiniContent renders "In-Use: <name>" on hover (cap 24 chars; overflow → 21 + "…"). Reads token.dataset.inUseRoomName for decks & token.dataset.currentRoomName for trinkets. - _applet-game-kit.html: removes the inline <p class="tt-token-room-name"> + <p class="tt-deck-game-name"> paragraphs (now redundant — mini-portal carries the name); deck token gains data-in-use-room-name attr. - gameboard tests: assertions retargeted at data-in-use-room-name + the mini-portal flow rather than the deleted inline paragraphs (test_views, test_deck_contribution, test_trinket_carte_blanche). - game-kit.js: openFan + _testOpen reset _polarity = 'levity' so reopening the fan after FLIP-to-gravity always lands on the levity-painted face (the FLIP cue). The sessionStorage bookmark intentionally tracks card index only; polarity does NOT persist across reopen. - _tarot_fan.html: SSR-default polarity flipped from levity to gravity (levity_emanation → gravity_emanation, levity_qualifier → gravity_qualifier, levity_reversal → gravity_reversal across upright + reversal faces). Pairs w. the JS polarity reset above so JS repaints to levity on open. - FanStageSpec: 2 new specs — openFan polarity reset on reopen even after FLIP-to-gravity; sessionStorage stores no levity/gravity string. - starter-role-*.svg (Alchemist, Builder, Economist, Narrator, Player, Shepherd): redrawn / re-cropped art — viewBox tightened from 288×560 to ~154×156, paths re-traced. No new role added; existing 6 swapped in place. New starter-role-blank.svg added as fallback for unmapped role codes (referenced by tray.js _ROLE_SCRAWL default → 'Blank'). Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 22:28:32 -04:00
deck_el = self.wait_for(
lambda: self.browser.find_element(By.CSS_SELECTOR, "#id_kit_earthman_deck")
)
game kit + role icons + tarot fan: in-use mini-portal label, FLIP cue polarity reset, role icon redraws Heterogeneous pre-existing changes (carried across multiple sessions, finally committed alongside the SIG SELECT exit sprint). Grouped: - gameboard.js: _inUseLabel(roomName) — buildMiniContent renders "In-Use: <name>" on hover (cap 24 chars; overflow → 21 + "…"). Reads token.dataset.inUseRoomName for decks & token.dataset.currentRoomName for trinkets. - _applet-game-kit.html: removes the inline <p class="tt-token-room-name"> + <p class="tt-deck-game-name"> paragraphs (now redundant — mini-portal carries the name); deck token gains data-in-use-room-name attr. - gameboard tests: assertions retargeted at data-in-use-room-name + the mini-portal flow rather than the deleted inline paragraphs (test_views, test_deck_contribution, test_trinket_carte_blanche). - game-kit.js: openFan + _testOpen reset _polarity = 'levity' so reopening the fan after FLIP-to-gravity always lands on the levity-painted face (the FLIP cue). The sessionStorage bookmark intentionally tracks card index only; polarity does NOT persist across reopen. - _tarot_fan.html: SSR-default polarity flipped from levity to gravity (levity_emanation → gravity_emanation, levity_qualifier → gravity_qualifier, levity_reversal → gravity_reversal across upright + reversal faces). Pairs w. the JS polarity reset above so JS repaints to levity on open. - FanStageSpec: 2 new specs — openFan polarity reset on reopen even after FLIP-to-gravity; sessionStorage stores no levity/gravity string. - starter-role-*.svg (Alchemist, Builder, Economist, Narrator, Player, Shepherd): redrawn / re-cropped art — viewBox tightened from 288×560 to ~154×156, paths re-traced. No new role added; existing 6 swapped in place. New starter-role-blank.svg added as fallback for unmapped role codes (referenced by tray.js _ROLE_SCRAWL default → 'Blank'). Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 22:28:32 -04:00
self.assertEqual(room.name, deck_el.get_attribute("data-in-use-room-name"))
def test_non_contributing_deck_has_normal_don_doff(self):
"""A deck not assigned to any active seat shows the normal DON/DOFF apparatus."""
gamer, earthman, room, seat = self._setup_in_use_deck()
# Unlock Fiorentine for the gamer so it appears in Game Kit
fix CI FT regressions: deck contribution, ROLE SELECT no-deck guard, sig qualifiers, Carte Blanche multi-slot - test_deck_contribution: get_or_create _equip_earthman + unlocked_decks.add; slot_number=2 on _setup_in_use_deck seat; navigate to /gameboard/ (not gate — game-kit panel absent there); drop #id_kit_card_deck click ({% empty %} placeholder; deck renders in loop when present); use textContent for CSS-hidden tooltip; drop stale .deck-micro-status assertion (now mini-portal) - ROLE SELECT FTs (RoleSelectTest + RoleSelectTrayTest): equip Earthman deck for active-slot user in each test that opens the fan — fixes no-deck JS guard blocking #id_role_select - test_room_sig_select: seed The Nomad/Schizo w. correct Earthman slugs/names + Enlightened/ Engraven qualifiers; grant super-nomad + super-schizo Notes to all gamers so Major Arcana appear in overlay; seed Middle Arcana w. Elevated/Graven qualifiers; rename test methods - test_game_kit: drop stale assertIn("active", text) — availability moved to In-Use mini-portal - Carte Blanche: CB stays equipped after multi-slot deposit (revert drop_token unequip); select_role existing-seat query gains order_by("slot_number") for deterministic primary seat; multi-slot FT: kit bag shows placeholder after first deposit (CB unequipped); cold-feet verifies DON via hover→portal; re-equip via portal DON before re-deposit; new test_carte_in_use_game_kit_shows_room_attribution checks Game Kit tooltip after deposit Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 16:29:51 -04:00
fiorentine, _ = DeckVariant.objects.get_or_create(
slug="fiorentine-minchiate",
defaults={"name": "Fiorentine Minchiate", "card_count": 97},
)
gamer.unlocked_decks.add(fiorentine)
fix CI FT regressions: deck contribution, ROLE SELECT no-deck guard, sig qualifiers, Carte Blanche multi-slot - test_deck_contribution: get_or_create _equip_earthman + unlocked_decks.add; slot_number=2 on _setup_in_use_deck seat; navigate to /gameboard/ (not gate — game-kit panel absent there); drop #id_kit_card_deck click ({% empty %} placeholder; deck renders in loop when present); use textContent for CSS-hidden tooltip; drop stale .deck-micro-status assertion (now mini-portal) - ROLE SELECT FTs (RoleSelectTest + RoleSelectTrayTest): equip Earthman deck for active-slot user in each test that opens the fan — fixes no-deck JS guard blocking #id_role_select - test_room_sig_select: seed The Nomad/Schizo w. correct Earthman slugs/names + Enlightened/ Engraven qualifiers; grant super-nomad + super-schizo Notes to all gamers so Major Arcana appear in overlay; seed Middle Arcana w. Elevated/Graven qualifiers; rename test methods - test_game_kit: drop stale assertIn("active", text) — availability moved to In-Use mini-portal - Carte Blanche: CB stays equipped after multi-slot deposit (revert drop_token unequip); select_role existing-seat query gains order_by("slot_number") for deterministic primary seat; multi-slot FT: kit bag shows placeholder after first deposit (CB unequipped); cold-feet verifies DON via hover→portal; re-equip via portal DON before re-deposit; new test_carte_in_use_game_kit_shows_room_attribution checks Game Kit tooltip after deposit Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 16:29:51 -04:00
self.create_pre_authenticated_session(GAMER_EMAIL)
self.browser.get(self.live_server_url + "/gameboard/")
self.wait_for(
lambda: self.browser.find_element(By.CSS_SELECTOR, "#id_kit_fiorentine_deck")
).click()
don_btn = self.wait_for(
lambda: self.browser.find_element(
By.CSS_SELECTOR, "#id_kit_fiorentine_deck .btn-equip"
)
)
self.assertNotIn("btn-disabled", don_btn.get_attribute("class"))