Documentation / Build Sphinx Documentation (push) Successful in 1m3s
CI/CD Pipeline - Northern Thailand Ping River Monitor / Test Suite (3.11) (push) Failing after 1m4s
CI/CD Pipeline - Northern Thailand Ping River Monitor / Build Docker Image (push) Skipped
CI/CD Pipeline - Northern Thailand Ping River Monitor / Integration Test with Services (push) Skipped
CI/CD Pipeline - Northern Thailand Ping River Monitor / Deploy to Staging (push) Skipped
CI/CD Pipeline - Northern Thailand Ping River Monitor / Deploy to Production (push) Skipped
CI/CD Pipeline - Northern Thailand Ping River Monitor / Performance Test (push) Skipped
Documentation / Generate API Documentation (push) Successful in 23s
Documentation / Validate Documentation (push) Failing after 18s
CI/CD Pipeline - Northern Thailand Ping River Monitor / Cleanup (push) Successful in 1s
Documentation / Documentation Summary (push) Successful in 3s
CI/CD Pipeline - Northern Thailand Ping River Monitor / Code Quality (push) Failing after 11m16s
New endpoints GET /api/hii/rainfall/latest and /api/hii/waterlevel/latest serve the latest per-station rows from the hii_* tables. The map gains a TWA-style rain layer: circle markers binned by TMD 24-h classes (blues for light/moderate/heavy, site amber/red for very-heavy/extreme), with a legend block and show/hide toggle. The ThaiWater sensor panel now prefers the DB-backed HII feed (no API key required, 97+ stations, ThaiWater storage-percent situation colors, gauge-datum conversion via offset_msl) and falls back to the live /sensors/thaiwater passthrough.
60 lines
1.9 KiB
Python
60 lines
1.9 KiB
Python
from pathlib import Path
|
||
|
||
|
||
DASHBOARD_PATH = Path(__file__).parents[1] / "src" / "static" / "dashboard.html"
|
||
|
||
|
||
def test_dashboard_contains_live_map_and_flow_visualization():
|
||
html = DASHBOARD_PATH.read_text(encoding="utf-8")
|
||
|
||
assert "id=\"station-map\"" in html
|
||
assert "id=\"river-flow\"" in html
|
||
assert "fetch('/stations')" in html or 'fetch("/stations")' in html
|
||
assert "fetch('/measurements/latest" in html or 'fetch(\"/measurements/latest' in html
|
||
assert "leaflet" in html.lower()
|
||
|
||
|
||
def test_dashboard_explains_flow_legend_and_refresh():
|
||
html = DASHBOARD_PATH.read_text(encoding="utf-8")
|
||
|
||
assert "Flow status" in html
|
||
assert "Last updated" in html
|
||
assert "Refresh" in html
|
||
|
||
|
||
def test_dashboard_uses_mapped_river_network_instead_of_station_connections():
|
||
html = DASHBOARD_PATH.read_text(encoding="utf-8")
|
||
river_network = DASHBOARD_PATH.with_name("ping-river-network.geojson")
|
||
|
||
assert river_network.exists()
|
||
assert "fetch('/static/ping-river-network.geojson')" in html
|
||
assert "mainBasin.map" not in html
|
||
|
||
|
||
def test_dashboard_loads_additional_thaiwater_sensors():
|
||
html = DASHBOARD_PATH.read_text(encoding="utf-8")
|
||
|
||
assert "fetch('/sensors/thaiwater')" in html
|
||
assert "Additional ThaiWater sensor" in html
|
||
|
||
|
||
def test_dashboard_shows_hii_rainfall_layer():
|
||
html = DASHBOARD_PATH.read_text(encoding="utf-8")
|
||
|
||
assert "fetch('/api/hii/rainfall/latest')" in html
|
||
assert "fetch('/api/hii/waterlevel/latest')" in html
|
||
assert "renderRainLayer" in html
|
||
assert "rain-toggle" in html
|
||
assert "Rainfall · 24 h" in html
|
||
# TMD rain classes on the legend
|
||
assert "Heavy 35–90" in html
|
||
assert "Extreme > 150" in html
|
||
|
||
|
||
def test_dashboard_loads_postgresql_history_chart():
|
||
html = DASHBOARD_PATH.read_text(encoding="utf-8")
|
||
|
||
assert "PostgreSQL history" in html
|
||
assert "/measurements/history/" in html
|
||
assert "history-chart" in html
|