PICK SKY: natal wheel polish — house/sign fill fixes, button layout, localStorage FT
- Fix D3 arc coordinate offset (add π/2 to all arc angles — D3 subtracts it
internally, causing fills to render 90° CW from label midpoints)
- Fix house-12 wrap-around: normalise nextCusp += 360 when it crosses 0°,
eliminating the 330° ghost arc that buried house fill/number layers
- Draw all house fills before cusp lines + numbers (z-order fix)
- SCSS: sign/element fills corrected to rgba(var(--priXx, R, G, B), α) —
CSS vars are raw RGB tuples so bare var() in fill was invalid
- brighten Stone/Air/Water fallback colours; raise house fill opacities
- Button layout: SAVE SKY moves into form column (full-width, pinned bottom);
NVM becomes a btn-sm circle anchored on the modal's top-right corner via
.natus-modal-wrap (position:relative, outside overflow:hidden modal);
entrance animation moved to wrapper so NVM rides the fade+slide
- Form fields wrapped in .natus-form-main (scrollable); portrait layout
switches form-col to flex-row so form spans most width, SAVE SKY on right
- Modal max-height 92→96vh, max-width 840→920px, SVG cap 400→480px
- FT: PickSkyLocalStorageTest (2 tests) — form fields restored after NVM
and after page refresh
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 00:49:14 -04:00
|
|
|
"""Functional tests for the PICK SKY overlay — natal chart entry."""
|
|
|
|
|
|
|
|
|
|
from selenium.webdriver.common.by import By
|
|
|
|
|
|
|
|
|
|
from apps.applets.models import Applet
|
|
|
|
|
from apps.epic.models import GateSlot, Room
|
|
|
|
|
from apps.lyric.models import User
|
|
|
|
|
|
|
|
|
|
from .base import FunctionalTest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _make_sky_select_room():
|
|
|
|
|
"""Minimal SKY_SELECT room — just enough for the overlay to render."""
|
|
|
|
|
email = "founder@test.io"
|
|
|
|
|
gamer, _ = User.objects.get_or_create(email=email)
|
|
|
|
|
room = Room.objects.create(name="Sky Test Room", table_status=Room.SKY_SELECT, owner=gamer)
|
|
|
|
|
# Put the founder in slot 1 so the view recognises them as a participant
|
|
|
|
|
slot = room.gate_slots.get(slot_number=1)
|
|
|
|
|
slot.gamer = gamer
|
|
|
|
|
slot.status = GateSlot.FILLED
|
|
|
|
|
slot.save()
|
|
|
|
|
room.gate_status = Room.OPEN
|
|
|
|
|
room.save()
|
|
|
|
|
return room, gamer, email
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PickSkyLocalStorageTest(FunctionalTest):
|
|
|
|
|
"""PICK SKY form fields persist to localStorage."""
|
|
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
|
super().setUp()
|
|
|
|
|
Applet.objects.get_or_create(
|
|
|
|
|
slug="new-game", defaults={"name": "New Game", "context": "gameboard"}
|
|
|
|
|
)
|
|
|
|
|
Applet.objects.get_or_create(
|
|
|
|
|
slug="my-games", defaults={"name": "My Games", "context": "gameboard"}
|
|
|
|
|
)
|
|
|
|
|
self.room, self.founder, self.founder_email = _make_sky_select_room()
|
|
|
|
|
self.room_url = (
|
|
|
|
|
self.live_server_url + f"/gameboard/room/{self.room.id}/"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
def _open_overlay(self):
|
|
|
|
|
btn = self.wait_for(
|
|
|
|
|
lambda: self.browser.find_element(By.ID, "id_pick_sky_btn")
|
|
|
|
|
)
|
|
|
|
|
self.browser.execute_script("arguments[0].click()", btn)
|
|
|
|
|
self.wait_for(
|
|
|
|
|
lambda: self.browser.find_element(By.ID, "id_natus_overlay")
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
def _fill_form(self):
|
|
|
|
|
"""Set date, lat, lon directly (bypasses Nominatim network call)."""
|
|
|
|
|
self.browser.execute_script(
|
2026-04-16 01:57:02 -04:00
|
|
|
"document.getElementById('id_nf_date').value = '2008-05-27';"
|
|
|
|
|
"document.getElementById('id_nf_lat').value = '38.3754';"
|
|
|
|
|
"document.getElementById('id_nf_lon').value = '-76.6955';"
|
|
|
|
|
"document.getElementById('id_nf_place').value = 'Morganza, MD';"
|
PICK SKY: natal wheel polish — house/sign fill fixes, button layout, localStorage FT
- Fix D3 arc coordinate offset (add π/2 to all arc angles — D3 subtracts it
internally, causing fills to render 90° CW from label midpoints)
- Fix house-12 wrap-around: normalise nextCusp += 360 when it crosses 0°,
eliminating the 330° ghost arc that buried house fill/number layers
- Draw all house fills before cusp lines + numbers (z-order fix)
- SCSS: sign/element fills corrected to rgba(var(--priXx, R, G, B), α) —
CSS vars are raw RGB tuples so bare var() in fill was invalid
- brighten Stone/Air/Water fallback colours; raise house fill opacities
- Button layout: SAVE SKY moves into form column (full-width, pinned bottom);
NVM becomes a btn-sm circle anchored on the modal's top-right corner via
.natus-modal-wrap (position:relative, outside overflow:hidden modal);
entrance animation moved to wrapper so NVM rides the fade+slide
- Form fields wrapped in .natus-form-main (scrollable); portrait layout
switches form-col to flex-row so form spans most width, SAVE SKY on right
- Modal max-height 92→96vh, max-width 840→920px, SVG cap 400→480px
- FT: PickSkyLocalStorageTest (2 tests) — form fields restored after NVM
and after page refresh
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 00:49:14 -04:00
|
|
|
"document.getElementById('id_nf_tz').value = 'America/New_York';"
|
|
|
|
|
)
|
|
|
|
|
# Fire input events so the save listener triggers
|
|
|
|
|
self.browser.execute_script("""
|
|
|
|
|
['id_nf_date','id_nf_lat','id_nf_lon','id_nf_place','id_nf_tz'].forEach(id => {
|
|
|
|
|
const el = document.getElementById(id);
|
|
|
|
|
el.dispatchEvent(new Event('input', {bubbles: true}));
|
|
|
|
|
});
|
|
|
|
|
""")
|
|
|
|
|
|
|
|
|
|
def _field_values(self):
|
|
|
|
|
return self.browser.execute_script("""
|
|
|
|
|
return {
|
|
|
|
|
date: document.getElementById('id_nf_date').value,
|
|
|
|
|
lat: document.getElementById('id_nf_lat').value,
|
|
|
|
|
lon: document.getElementById('id_nf_lon').value,
|
|
|
|
|
place: document.getElementById('id_nf_place').value,
|
|
|
|
|
tz: document.getElementById('id_nf_tz').value,
|
|
|
|
|
};
|
|
|
|
|
""")
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------ #
|
|
|
|
|
# T1 — fields survive NVM (close + reopen, same page load) #
|
|
|
|
|
# ------------------------------------------------------------------ #
|
|
|
|
|
|
|
|
|
|
def test_form_fields_repopulated_after_nvm(self):
|
|
|
|
|
self.create_pre_authenticated_session(self.founder_email)
|
|
|
|
|
self.browser.get(self.room_url)
|
|
|
|
|
|
|
|
|
|
self._open_overlay()
|
|
|
|
|
self._fill_form()
|
|
|
|
|
|
|
|
|
|
# Close via NVM
|
|
|
|
|
self.browser.find_element(By.ID, "id_natus_cancel").click()
|
|
|
|
|
|
|
|
|
|
# Reopen
|
|
|
|
|
self._open_overlay()
|
|
|
|
|
|
|
|
|
|
values = self._field_values()
|
2026-04-16 01:57:02 -04:00
|
|
|
self.assertEqual(values["date"], "2008-05-27")
|
|
|
|
|
self.assertEqual(values["lat"], "38.3754")
|
|
|
|
|
self.assertEqual(values["lon"], "-76.6955")
|
|
|
|
|
self.assertEqual(values["place"], "Morganza, MD")
|
PICK SKY: natal wheel polish — house/sign fill fixes, button layout, localStorage FT
- Fix D3 arc coordinate offset (add π/2 to all arc angles — D3 subtracts it
internally, causing fills to render 90° CW from label midpoints)
- Fix house-12 wrap-around: normalise nextCusp += 360 when it crosses 0°,
eliminating the 330° ghost arc that buried house fill/number layers
- Draw all house fills before cusp lines + numbers (z-order fix)
- SCSS: sign/element fills corrected to rgba(var(--priXx, R, G, B), α) —
CSS vars are raw RGB tuples so bare var() in fill was invalid
- brighten Stone/Air/Water fallback colours; raise house fill opacities
- Button layout: SAVE SKY moves into form column (full-width, pinned bottom);
NVM becomes a btn-sm circle anchored on the modal's top-right corner via
.natus-modal-wrap (position:relative, outside overflow:hidden modal);
entrance animation moved to wrapper so NVM rides the fade+slide
- Form fields wrapped in .natus-form-main (scrollable); portrait layout
switches form-col to flex-row so form spans most width, SAVE SKY on right
- Modal max-height 92→96vh, max-width 840→920px, SVG cap 400→480px
- FT: PickSkyLocalStorageTest (2 tests) — form fields restored after NVM
and after page refresh
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 00:49:14 -04:00
|
|
|
self.assertEqual(values["tz"], "America/New_York")
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------ #
|
|
|
|
|
# T2 — fields survive a page refresh #
|
|
|
|
|
# ------------------------------------------------------------------ #
|
|
|
|
|
|
|
|
|
|
def test_form_fields_repopulated_after_page_refresh(self):
|
|
|
|
|
self.create_pre_authenticated_session(self.founder_email)
|
|
|
|
|
self.browser.get(self.room_url)
|
|
|
|
|
|
|
|
|
|
self._open_overlay()
|
|
|
|
|
self._fill_form()
|
|
|
|
|
|
|
|
|
|
# Refresh the page
|
|
|
|
|
self.browser.refresh()
|
|
|
|
|
|
|
|
|
|
self._open_overlay()
|
|
|
|
|
|
|
|
|
|
values = self._field_values()
|
2026-04-16 01:57:02 -04:00
|
|
|
self.assertEqual(values["date"], "2008-05-27")
|
|
|
|
|
self.assertEqual(values["lat"], "38.3754")
|
|
|
|
|
self.assertEqual(values["lon"], "-76.6955")
|
|
|
|
|
self.assertEqual(values["place"], "Morganza, MD")
|
PICK SKY: natal wheel polish — house/sign fill fixes, button layout, localStorage FT
- Fix D3 arc coordinate offset (add π/2 to all arc angles — D3 subtracts it
internally, causing fills to render 90° CW from label midpoints)
- Fix house-12 wrap-around: normalise nextCusp += 360 when it crosses 0°,
eliminating the 330° ghost arc that buried house fill/number layers
- Draw all house fills before cusp lines + numbers (z-order fix)
- SCSS: sign/element fills corrected to rgba(var(--priXx, R, G, B), α) —
CSS vars are raw RGB tuples so bare var() in fill was invalid
- brighten Stone/Air/Water fallback colours; raise house fill opacities
- Button layout: SAVE SKY moves into form column (full-width, pinned bottom);
NVM becomes a btn-sm circle anchored on the modal's top-right corner via
.natus-modal-wrap (position:relative, outside overflow:hidden modal);
entrance animation moved to wrapper so NVM rides the fade+slide
- Form fields wrapped in .natus-form-main (scrollable); portrait layout
switches form-col to flex-row so form spans most width, SAVE SKY on right
- Modal max-height 92→96vh, max-width 840→920px, SVG cap 400→480px
- FT: PickSkyLocalStorageTest (2 tests) — form fields restored after NVM
and after page refresh
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 00:49:14 -04:00
|
|
|
self.assertEqual(values["tz"], "America/New_York")
|
2026-04-16 01:57:02 -04:00
|
|
|
|
|
|
|
|
|