420dced9ff
- api/app.py: sync WireGuard server config on peer add/remove (non-fatal) - docker-compose.yml: add privileged:true to wireguard service - E2E tests: fix logout selector, DNS IP lookup, wg config DNS line, VIP skip guards, badge text selectors, heading .first, async logout wait - Integration tests: fix 4 tests that sent unauthenticated requests expecting 400 (now use authenticated session helpers); accept 401 as valid in webui proxy test; add password field to service_access validation test - Remove stale tracked config templates (config/api/api/*, config/api/cell.env, etc.) that no longer exist on disk after config layout was reorganised Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
51 lines
1.8 KiB
Python
51 lines
1.8 KiB
Python
"""
|
|
WebUI smoke tests — verify the React app is served correctly.
|
|
|
|
These don't test UI interactions (that requires Playwright).
|
|
They verify the static serving layer is working and the JS bundle loads.
|
|
|
|
Run with: pytest tests/integration/test_webui.py -v
|
|
"""
|
|
import requests
|
|
import sys, os
|
|
sys.path.insert(0, os.path.dirname(__file__))
|
|
from conftest import WEBUI_BASE
|
|
|
|
|
|
def get(path, **kw):
|
|
return requests.get(f"{WEBUI_BASE}{path}", **kw)
|
|
|
|
|
|
class TestWebUIServing:
|
|
def test_root_returns_200(self):
|
|
r = get('/')
|
|
assert r.status_code == 200
|
|
|
|
def test_root_is_html(self):
|
|
r = get('/')
|
|
assert 'text/html' in r.headers.get('Content-Type', '')
|
|
|
|
def test_root_contains_react_mount(self):
|
|
r = get('/')
|
|
assert '<div id="root">' in r.text, "React mount point not found in index.html"
|
|
|
|
def test_root_references_js_bundle(self):
|
|
r = get('/')
|
|
assert '.js' in r.text, "No JS bundle reference found in index.html"
|
|
|
|
def test_spa_routing_fallback(self):
|
|
# SPA routes that don't exist as files should still return index.html
|
|
for path in ('/peers', '/settings', '/wireguard', '/network'):
|
|
r = get(path)
|
|
assert r.status_code == 200, f"SPA route {path} returned {r.status_code}"
|
|
assert 'text/html' in r.headers.get('Content-Type', ''), \
|
|
f"SPA route {path} didn't return HTML"
|
|
|
|
def test_api_reachable_from_webui_origin(self):
|
|
# Verify the API is accessible (CORS / proxy config working)
|
|
r = requests.get(f"{WEBUI_BASE.rstrip('/')}/api/status".replace(
|
|
f':{80}', '').replace('///', '//'))
|
|
# The webui container proxies /api → cell-api, so this should work.
|
|
# 401 means the API is reachable but requires auth — that's fine here.
|
|
assert r.status_code in (200, 401, 404, 301, 302)
|