Files
KrzyszurandClaude Opus 5.5 bb933ff748 Serial monitor redesign: Test box button, InfluxDB row in the checklist
- Test box: restart + start-up capture + online InfluxDB check (data newer
  than the restart), with a status strip; checklist and findings are the
  main view, live log / guided troubleshooting / box details are tabs,
  rarely used actions in a More menu
- light palette on all systems (macOS dark mode made the colours unreadable)
- new rule influx.invalid_value: -inf from a silent microphone makes
  InfluxDB reject every upload (HTTP 400); guide end names it
- exclusive serial port on macOS/Linux: two tool windows no longer split
  the log between them
- InfluxDB check: `since` filter, neutral wording when nothing new arrives

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 00:06:48 +02:00

53 lines
2.3 KiB
Python

"""The whole window builds (catches errors that only show when the app starts)."""
import os
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
def test_main_window_builds_with_all_tabs():
from PySide6.QtWidgets import QApplication
from kota_tech.ui.main_window import MainWindow
app = QApplication.instance() or QApplication([])
w = MainWindow()
tabs = w.centralWidget()
assert [tabs.tabText(i) for i in range(tabs.count())] == \
["Quick start", "Serial monitor", "Flash firmware", "Wi-Fi (USB)", "SD card"]
assert not w.wifi_tab.write_btn.isEnabled() # nothing connected, nothing typed
settings = [a.text() for m in w.menuBar().actions() for a in m.menu().actions()]
assert "InfluxDB access..." in settings
w.serial_tab.shutdown()
app.processEvents()
def test_serial_tab_checklist_and_test_strip():
from PySide6.QtWidgets import QApplication
from kota_tech.core.logline import parse_line
from kota_tech.service import influx
from kota_tech.ui.main_window import INFLUX_ROW, MainWindow
app = QApplication.instance() or QApplication([])
w = MainWindow()
st = w.serial_tab
assert st.test_btn.text().endswith("Test box")
assert [st.side_tabs.tabText(i) for i in range(st.side_tabs.count())] == \
["Live log", "Guided troubleshooting", "Box details"]
st.influx_config = lambda: None # no token (never touch real settings)
rows = st._cloud_rows()
assert rows[0][0] == "off" and "not set up" in rows[0][1]
st.influx_config = lambda: influx.InfluxConfig("t") # pretend access is set up
assert st._cloud_rows()[0] == ("pending", f"{INFLUX_ROW} - press Test box")
st._on_influx(influx.InfluxCheck(influx.SENSORS_MISSING, "Status arrives, sensor data does not",
details=["SEN66 (air quality): no data"]))
rows = st._cloud_rows()
assert rows[0][0] == "bad" and rows[1][0] == "note"
st._engine.feed(parse_line("ESP-ROM:esp32s3-20210327"))
st._diag_dirty = True
st._refresh_diag()
texts = [st.diag.milestones.item(i).text() for i in range(st.diag.milestones.count())]
assert any(INFLUX_ROW in t for t in texts)
assert "Test box" in st.test_status.text()
st.shutdown()
app.processEvents()