diff --git a/src/functional_tests/test_bill_my_sign.py b/src/functional_tests/test_bill_my_sign.py index d7bdb64..4bf8a08 100644 --- a/src/functional_tests/test_bill_my_sign.py +++ b/src/functional_tests/test_bill_my_sign.py @@ -11,7 +11,7 @@ from selenium.webdriver.common.by import By from .base import FunctionalTest from apps.applets.models import Applet -from apps.epic.models import personal_sig_cards +from apps.epic.models import DeckVariant, TarotCard, personal_sig_cards from apps.lyric.models import User @@ -23,19 +23,37 @@ def _seed_my_sign_applet(): ) +def _seed_earthman_sig_pile(): + """Re-seed Earthman DeckVariant + the 16 MIDDLE court cards that + personal_sig_cards() returns. TransactionTestCase flushes wipe the + migration seed between tests, so each setUp must restore them. + See [[feedback_transactiontestcase_flush]].""" + earthman, _ = DeckVariant.objects.get_or_create( + slug="earthman", + defaults={"name": "Earthman", "card_count": 106, "is_default": True}, + ) + _NAME = {11: "Maid", 12: "Jack", 13: "Queen", 14: "King"} + for suit in ("BRANDS", "CROWNS", "BLADES", "GRAILS"): + 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": "MIDDLE", "suit": suit, "number": number, + "name": f"{_NAME[number]} of {suit.capitalize()}", + "levity_qualifier": "Elevated", + "gravity_qualifier": "Graven"}, + ) + return earthman + + class MySignPickerTest(FunctionalTest): """Happy-path picker: a user with the Earthman deck equipped lands at /billboard/my-sign/, picks a card, clicks SAVE SIGN, and sees the sig propagate to the Game Sign applet on /billboard/.""" - # StaticLiveServerTestCase → TransactionTestCase flushes DB between tests, - # wiping migration-seeded DeckVariant + TarotCard rows. Without this flag, - # personal_sig_cards(user) returns [] because the signal that auto-equips - # Earthman can't find the deck. See [[feedback_transactiontestcase_flush]]. - serialized_rollback = True - def setUp(self): super().setUp() + _seed_earthman_sig_pile() _seed_my_sign_applet() # Seed the rest of the billboard applets so /billboard/ renders # without missing-applet errors. @@ -339,10 +357,9 @@ class MySignBackupDeckTest(FunctionalTest): NVM dismisses + picker stays usable w. backup deck cards; FYI links to the gameboard (Game Kit applet).""" - serialized_rollback = True - def setUp(self): super().setUp() + _seed_earthman_sig_pile() for slug, name in [ ("my-sign", "Game Sign"), ("my-scrolls", "My Scrolls"), ("my-buds", "My Buds"), ("most-recent-scroll", "Most Recent Scroll"), diff --git a/src/functional_tests/test_game_my_sea.py b/src/functional_tests/test_game_my_sea.py index 065846b..3946ee0 100644 --- a/src/functional_tests/test_game_my_sea.py +++ b/src/functional_tests/test_game_my_sea.py @@ -10,17 +10,19 @@ from selenium.webdriver.common.by import By from .base import FunctionalTest from apps.applets.models import Applet -from apps.epic.models import personal_sig_cards +from apps.epic.models import DeckVariant, TarotCard, personal_sig_cards from apps.lyric.models import User def _seed_gameboard_applets(): """My Sea + the rest of the gameboard applets so /gameboard/ renders - without missing-applet errors during the applet-side assertions.""" + without missing-applet errors during the applet-side assertions. + Mirrors the migration seed (0003 + 0008) — every slug must have a + matching _applet-.html partial under apps/gameboard/_partials/.""" for slug, name, cols, rows, ctx in [ ("my-sea", "My Sea", 12, 4, "gameboard"), - ("game-kit", "Game Kit", 4, 6, "gameboard"), - ("my-palette", "My Palette", 4, 4, "gameboard"), + ("game-kit", "Game Kit", 4, 3, "gameboard"), + ("new-game", "New Game", 4, 3, "gameboard"), ("my-games", "My Games", 4, 4, "gameboard"), ]: Applet.objects.get_or_create( @@ -30,15 +32,37 @@ def _seed_gameboard_applets(): ) +def _seed_earthman_sig_pile(): + """Re-seed Earthman DeckVariant + the 16 MIDDLE court cards that + personal_sig_cards() returns. TransactionTestCase flushes wipe the + migration seed between tests, so each setUp must restore them. + See [[feedback_transactiontestcase_flush]].""" + earthman, _ = DeckVariant.objects.get_or_create( + slug="earthman", + defaults={"name": "Earthman", "card_count": 106, "is_default": True}, + ) + _NAME = {11: "Maid", 12: "Jack", 13: "Queen", 14: "King"} + for suit in ("BRANDS", "CROWNS", "BLADES", "GRAILS"): + 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": "MIDDLE", "suit": suit, "number": number, + "name": f"{_NAME[number]} of {suit.capitalize()}", + "levity_qualifier": "Elevated", + "gravity_qualifier": "Graven"}, + ) + return earthman + + class MySeaSignGateTest(FunctionalTest): """Sign-gate UX on the standalone /gameboard/my-sea/ page + the /gameboard/ My Sea applet. User without a saved sig sees a Look!- formatted nudge w. FYI to the picker + BACK to the gameboard.""" - serialized_rollback = True - def setUp(self): super().setUp() + _seed_earthman_sig_pile() _seed_gameboard_applets() self.email = "sea@test.io" self.gamer = User.objects.create(email=self.email)