refactor(api): complete fastapi migration and related features

Finish native FastAPI controllers, drop vendored microdot, and add
Wi-Fi driver runtime, beat SSE, simulated BPM, sequence playback
improvements, bridge ESP-NOW sources, UI updates, and tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-11 22:55:28 +12:00
parent cb9758b97b
commit ace5770b3a
73 changed files with 4540 additions and 4487 deletions

View File

@@ -607,39 +607,45 @@ def test_profiles_ui(browser: BrowserTest) -> bool:
return passed == total
def test_mobile_tab_presets_two_columns():
def test_mobile_tab_presets_three_columns():
"""
Verify that the zone preset selecting area shows roughly two preset tiles per row
on a phone-sized viewport.
On a phone-sized viewport the zone strip is hidden; zones are chosen from the
header Zones menu. Preset tiles use a 3-column grid (see style.css).
"""
bt = BrowserTest(base_url=BASE_URL, headless=True)
if not bt.setup():
assert False, "Failed to start browser"
try:
# Simulate a mobile viewport
bt.driver.set_window_size(400, 800)
assert bt.navigate('/'), "Failed to load main page"
# Click the first zone button to load presets for that zone
first_tab = bt.wait_for_element(By.CSS_SELECTOR, '.zone-button', timeout=10)
assert first_tab is not None, "No zone buttons found"
first_tab.click()
# Desktop zone buttons live in .zones-container which is display:none on mobile.
WebDriverWait(bt.driver, 10).until(
EC.presence_of_element_located(
(By.CSS_SELECTOR, '#zones-menu-dropdown .zones-menu-item')
)
)
assert bt.click_element(By.ID, 'zones-menu-btn'), "Failed to open Zones menu"
assert bt.click_element(
By.CSS_SELECTOR, '#zones-menu-dropdown .zones-menu-item'
), "Failed to select zone from mobile menu"
_browser_sleep(1)
container = bt.wait_for_element(By.ID, 'presets-list-zone', timeout=10)
assert container is not None, "presets-list-zone not found"
tiles = bt.driver.find_elements(By.CSS_SELECTOR, '#presets-list-zone .preset-tile-row')
# Need at least 2 presets to make this meaningful
tiles = bt.driver.find_elements(
By.CSS_SELECTOR, '#presets-list-zone .preset-tile-row'
)
assert len(tiles) >= 2, "Fewer than 2 presets found for zone"
container_width = container.size['width']
first_width = tiles[0].size['width']
# Each tile should be about half the container width (tolerate some margin)
assert 0.4 * container_width <= first_width <= 0.6 * container_width, (
f"Preset tile width {first_width} not ~half of container {container_width}"
# Three columns on max-width 600px (~one third of the row, minus gaps).
assert 0.22 * container_width <= first_width <= 0.42 * container_width, (
f"Preset tile width {first_width} not ~third of container {container_width}"
)
finally:
bt.teardown()