functional_tests + CI: rename pass + structural consolidations + parallel test-FTs split — every FT file now starts with one of 6 prefixes (test_admin_* / test_bill_* / test_core_* / test_dash_* / test_game_room_* / test_trinket_*) plus the 4 page-roots test_billboard / test_dashboard / test_gameboard / test_jasmine, so the partition is unambiguous and stable for tooling (the previous mix of test_applet_*, test_room_*, test_component_*, ad-hoc names had no consistent grouping); session-side: merged test_gatekeeper_bud_btn.py into test_bud_btn.py (then user renamed to test_core_bud_btn.py) — both files drove the same #id_bud_btn UI in two contexts (post-share + gatekeeper invite) and shared the bud-btn.js skeleton, so consolidation was overdue; split test_component_cards_tarot.py into test_admin_tarot.py (just TarotAdminTest, sitting next to test_admin / test_admin_post_readonly) + 3 classes (TarotDeckTest / GameKitDeckSelectionTest / GameKitPageTest) appended to test_game_room_tray.py; updated stale test_bud_btn.py references in the test_core_bud_btn.py docstring + test_admin_post_readonly.py comment to point at the new filename; user-driven renames (22 files): test_applet_my_notes/posts → test_bill_my_*, test_applet_new_post[_line_validation] → test_bill_new_post[_line_validation], test_applet_my_sky → test_dash_my_sky, test_applet_palette → test_dash_palette, test_wallet → test_dash_wallet, test_login → test_core_login, test_navbar → test_core_navbar, test_sharing → test_core_sharing, test_layout_and_styling → test_core_styling, test_my_buds → test_bill_my_buds, test_bud_btn → test_core_bud_btn, test_deck_contribution → test_game_room_deck_contrib, test_game_invite → test_game_room_invite, test_room_gatekeeper → test_game_room_gatekeeper, test_room_role_select → test_game_room_select_role, test_room_sea_select → test_game_room_select_sea, test_room_sig_select → test_game_room_select_sig, test_room_sky_select → test_game_room_select_sky, test_room_tray → test_game_room_tray, test_component_tray_tooltip → test_game_room_tray_tooltip; the post_page.py / room_page.py helper modules from the May-12 sprint absorbed the cross-file FT imports that would otherwise have cascade-broken on these renames
.woodpecker/main.yaml — CI test-FTs step splits into parallel siblings test-FTs-non-room (22 files via `ls functional_tests/test_*.py | grep -v 'test_game_room_'`) + test-FTs-room (9 files via `ls functional_tests/test_game_room_*.py`); room cluster is the heaviest (~70% of the pre-split ~40-min wall-clock) and now runs concurrently w. the rest instead of in series; DAG explicit via depends_on on every step (Woodpecker mixes default-sequential w. depends_on awkwardly, so each step pins its prerequisite); collectstatic stays in test-two-browser-FTs only — the shared workspace propagates assets to both parallel FT steps, no race + no duplication; screendumps + build-and-push fan back in (depends_on both parallel steps); deploy-staging + deploy-prod depend on build-and-push smoke-import: 31/31 FT modules green after the rename pass Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
182
src/functional_tests/test_core_navbar.py
Normal file
182
src/functional_tests/test_core_navbar.py
Normal file
@@ -0,0 +1,182 @@
|
||||
from django.urls import reverse
|
||||
from selenium.webdriver.common.by import By
|
||||
|
||||
from apps.drama.models import GameEvent, record
|
||||
from apps.epic.models import Room
|
||||
from apps.lyric.models import User
|
||||
|
||||
from .base import FunctionalTest
|
||||
|
||||
|
||||
def _guard_rect(browser):
|
||||
"""Return the guard portal's bounding rect (reflects CSS transform)."""
|
||||
return browser.execute_script(
|
||||
"return document.getElementById('id_guard_portal').getBoundingClientRect().toJSON()"
|
||||
)
|
||||
|
||||
|
||||
def _elem_rect(browser, element):
|
||||
"""Return an element's bounding rect."""
|
||||
return browser.execute_script(
|
||||
"return arguments[0].getBoundingClientRect().toJSON()", element
|
||||
)
|
||||
|
||||
|
||||
class NavbarByeTest(FunctionalTest):
|
||||
"""
|
||||
The BYE btn-abandon replaces LOG OUT in the identity group.
|
||||
It should confirm before logging out and its tooltip must appear below
|
||||
the button (not above, which would be off-screen in the navbar).
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.create_pre_authenticated_session("disco@test.io")
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
# T1 — BYE btn present; "Log Out" text gone #
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
def test_bye_btn_replaces_log_out(self):
|
||||
self.browser.get(self.live_server_url)
|
||||
self.wait_for(lambda: self.browser.find_element(By.ID, "id_logout"))
|
||||
|
||||
logout_btn = self.browser.find_element(By.ID, "id_logout")
|
||||
self.assertEqual(logout_btn.text, "BYE")
|
||||
self.assertIn("btn-abandon", logout_btn.get_attribute("class"))
|
||||
self.assertNotIn("btn-primary", logout_btn.get_attribute("class"))
|
||||
|
||||
# Old "Log Out" text nowhere in navbar
|
||||
navbar = self.browser.find_element(By.CSS_SELECTOR, ".navbar")
|
||||
self.assertNotIn("Log Out", navbar.text)
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
# T2 — BYE tooltip appears below btn #
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
def test_bye_tooltip_appears_below_btn(self):
|
||||
self.browser.get(self.live_server_url)
|
||||
btn = self.wait_for(
|
||||
lambda: self.browser.find_element(By.ID, "id_logout")
|
||||
)
|
||||
btn_rect = _elem_rect(self.browser, btn)
|
||||
|
||||
# Click BYE — guard should become active
|
||||
self.browser.execute_script("arguments[0].click()", btn)
|
||||
self.wait_for(
|
||||
lambda: self.browser.find_element(
|
||||
By.CSS_SELECTOR, "#id_guard_portal.active"
|
||||
)
|
||||
)
|
||||
|
||||
portal_rect = _guard_rect(self.browser)
|
||||
self.assertGreaterEqual(
|
||||
portal_rect["top"],
|
||||
btn_rect["bottom"] - 2, # 2 px tolerance for sub-pixel rounding
|
||||
"Guard portal should appear below the BYE btn, not above it",
|
||||
)
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
# T3 — BYE btn logs out on confirm #
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
def test_bye_btn_logs_out_on_confirm(self):
|
||||
self.browser.get(self.live_server_url)
|
||||
btn = self.wait_for(
|
||||
lambda: self.browser.find_element(By.ID, "id_logout")
|
||||
)
|
||||
self.browser.execute_script("arguments[0].click()", btn)
|
||||
self.confirm_guard()
|
||||
|
||||
self.wait_for(
|
||||
lambda: self.browser.find_element(By.CSS_SELECTOR, "input[name=email]")
|
||||
)
|
||||
navbar = self.browser.find_element(By.CSS_SELECTOR, ".navbar")
|
||||
self.assertNotIn("disco@test.io", navbar.text)
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
# T4 — No CONT GAME btn when user has no rooms with events #
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
def test_cont_game_btn_absent_without_recent_room(self):
|
||||
self.browser.get(self.live_server_url)
|
||||
self.wait_for(
|
||||
lambda: self.browser.find_element(By.ID, "id_logout")
|
||||
)
|
||||
cont_game_btns = self.browser.find_elements(By.ID, "id_cont_game")
|
||||
self.assertEqual(
|
||||
len(cont_game_btns), 0,
|
||||
"CONT GAME btn should not appear when user has no rooms with events",
|
||||
)
|
||||
|
||||
|
||||
class NavbarContGameTest(FunctionalTest):
|
||||
"""
|
||||
When the authenticated user has at least one room with a game event the
|
||||
CONT GAME btn-primary appears in the navbar and navigates to that
|
||||
room on confirmation. Its tooltip must also appear below the button.
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.create_pre_authenticated_session("disco@test.io")
|
||||
self.user = User.objects.get(email="disco@test.io")
|
||||
self.room = Room.objects.create(name="Arena of Peril", owner=self.user)
|
||||
record(
|
||||
self.room, GameEvent.SLOT_FILLED, actor=self.user,
|
||||
slot_number=1, token_type="coin",
|
||||
token_display="Coin-on-a-String", renewal_days=7,
|
||||
)
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
# T5 — CONT GAME btn present when recent room exists #
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
def test_cont_game_btn_present(self):
|
||||
self.browser.get(self.live_server_url)
|
||||
self.wait_for(
|
||||
lambda: self.browser.find_element(By.ID, "id_cont_game")
|
||||
)
|
||||
btn = self.browser.find_element(By.ID, "id_cont_game")
|
||||
self.assertIn("btn-primary", btn.get_attribute("class"))
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
# T6 — CONT GAME tooltip appears below btn #
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
def test_cont_game_tooltip_appears_below_btn(self):
|
||||
self.browser.get(self.live_server_url)
|
||||
btn = self.wait_for(
|
||||
lambda: self.browser.find_element(By.ID, "id_cont_game")
|
||||
)
|
||||
btn_rect = _elem_rect(self.browser, btn)
|
||||
|
||||
self.browser.execute_script("arguments[0].click()", btn)
|
||||
self.wait_for(
|
||||
lambda: self.browser.find_element(
|
||||
By.CSS_SELECTOR, "#id_guard_portal.active"
|
||||
)
|
||||
)
|
||||
|
||||
portal_rect = _guard_rect(self.browser)
|
||||
self.assertGreaterEqual(
|
||||
portal_rect["top"],
|
||||
btn_rect["bottom"] - 2,
|
||||
"Guard portal should appear below the CONT GAME btn, not above it",
|
||||
)
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
# T7 — CONT GAME navigates to the room on confirm #
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
def test_cont_game_navigates_to_room_on_confirm(self):
|
||||
self.browser.get(self.live_server_url)
|
||||
btn = self.wait_for(
|
||||
lambda: self.browser.find_element(By.ID, "id_cont_game")
|
||||
)
|
||||
self.browser.execute_script("arguments[0].click()", btn)
|
||||
self.confirm_guard()
|
||||
|
||||
self.wait_for(
|
||||
lambda: self.assertIn(str(self.room.id), self.browser.current_url)
|
||||
)
|
||||
Reference in New Issue
Block a user