massive additions made thru somewhat new apps.epic.models, .urls, .views; new html page & partial in apps/gameboard; new apps.epic FT & ITs (all green); New Game applet now actually leads to game room feat. token-drop gatekeeper mechanism intended for 6 gamers
This commit is contained in:
42
src/functional_tests/test_gatekeeper.py
Normal file
42
src/functional_tests/test_gatekeeper.py
Normal file
@@ -0,0 +1,42 @@
|
||||
from selenium.webdriver.common.by import By
|
||||
|
||||
from .base import FunctionalTest
|
||||
from apps.applets.models import Applet
|
||||
|
||||
|
||||
class GatekeeperTest(FunctionalTest):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
Applet.objects.get_or_create(
|
||||
slug="new-game", defaults={"name": "New Game", "context": "gameboard"}
|
||||
)
|
||||
|
||||
def test_founder_creates_room_and_sees_gatekeeper(self):
|
||||
# 1. Log in, navigate to gameboard
|
||||
self.create_pre_authenticated_session("founder@test.io")
|
||||
self.browser.get(self.live_server_url + "/gameboard/")
|
||||
# 2. New Game applet has room name input, create button
|
||||
self.wait_for(
|
||||
lambda: self.browser.find_element(By.ID, "id_applet_new_game")
|
||||
)
|
||||
self.browser.find_element(By.ID, "id_new_game_name").send_keys("Test Room")
|
||||
self.browser.find_element(By.ID, "id_create_game_btn").click()
|
||||
# 3. User is redirected to Gatekeeper page for new room
|
||||
self.wait_for(
|
||||
lambda: self.assertIn("/gameboard/room/", self.browser.current_url)
|
||||
)
|
||||
self.wait_for(
|
||||
lambda: self.assertIn("/gate/", self.browser.current_url)
|
||||
)
|
||||
# 4. Page shows room name, GATHERING status
|
||||
body = self.browser.find_element(By.TAG_NAME, "body")
|
||||
self.assertIn("Test Room", body.text)
|
||||
self.assertIn("GATHERING", body.text)
|
||||
# 5. Six token slots are visible
|
||||
slots = self.browser.find_elements(By.CSS_SELECTOR, ".gate-slot")
|
||||
self.assertEqual(len(slots), 6)
|
||||
# 6. Slot 1 has Drop Token btn; slots 2–6 show as empty
|
||||
slot_1 = slots[0]
|
||||
slot_1.find_element(By.CSS_SELECTOR, ".drop-token-btn")
|
||||
for slot in slots[1:]:
|
||||
self.assertIn("empty", slot.get_attribute("class"))
|
||||
Reference in New Issue
Block a user