Initial commit: Canteen Asset Geolocation Tool v2

This commit is contained in:
2026-05-17 18:55:28 -04:00
commit 7da3f28c6a
50 changed files with 19509 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
"""Frontend E2E tests — GPS badge states."""
import pytest
def _login(page):
"""Helper: login as admin."""
page.locator("#loginUsername").fill("admin")
page.locator("#loginPassword").fill("changeme")
page.locator("button:has-text('Sign In')").click()
page.wait_for_selector("#loginOverlay", state="hidden", timeout=5000)
@pytest.mark.frontend
def test_gps_badge_shows_ok_when_geolocation_granted(page, live_server):
"""With geolocation permission granted, GPS badge shows OK state."""
_login(page)
# Wait for GPS to initialize (initGPS() runs on page load,
# and with permissions=['geolocation'] set in browser context,
# navigator.geolocation.getCurrentPosition succeeds immediately)
gps_badge = page.locator("#gpsBadge")
gps_badge.wait_for(timeout=10000)
# The badge should exist and show coordinates (OK state)
badge_text = gps_badge.inner_text()
assert "📍" in badge_text
# Check it's in OK state (class contains 'ok')
assert "ok" in gps_badge.get_attribute("class")