feat: validate real-bench seat orchestration and self-repair
This commit is contained in:
@@ -5,6 +5,7 @@ import threading
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
from http.server import ThreadingHTTPServer
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -134,15 +135,15 @@ class TestSelfRepairApi:
|
||||
with urllib.request.urlopen(f"{self.base_url}/", timeout=3) as response:
|
||||
html = response.read().decode("utf-8")
|
||||
with urllib.request.urlopen(
|
||||
f"{self.base_url}/self-repair.js?v=repair-15", timeout=3
|
||||
f"{self.base_url}/self-repair.js?v=repair-17", timeout=3
|
||||
) as response:
|
||||
script = response.read().decode("utf-8")
|
||||
with urllib.request.urlopen(
|
||||
f"{self.base_url}/self-repair.css?v=repair-15", timeout=3
|
||||
f"{self.base_url}/self-repair.css?v=repair-17", timeout=3
|
||||
) as response:
|
||||
styles = response.read().decode("utf-8")
|
||||
with urllib.request.urlopen(
|
||||
f"{self.base_url}/self-repair-seat3d.js?v=repair-15", timeout=3
|
||||
f"{self.base_url}/self-repair-seat3d.js?v=repair-17", timeout=3
|
||||
) as response:
|
||||
seat3d = response.read().decode("utf-8")
|
||||
with urllib.request.urlopen(
|
||||
@@ -150,10 +151,15 @@ class TestSelfRepairApi:
|
||||
) as response:
|
||||
console_script = response.read().decode("utf-8")
|
||||
|
||||
assert 'href="/self-repair.css?v=repair-15"' in html
|
||||
assert 'src="/self-repair.js?v=repair-15"' in html
|
||||
assert 'src="/self-repair-seat3d.js?v=repair-15"' in html
|
||||
assert 'href="/self-repair.css?v=repair-17"' in html
|
||||
assert 'src="/self-repair.js?v=repair-17"' in html
|
||||
assert 'src="/self-repair-seat3d.js?v=repair-17"' in html
|
||||
assert "量产故障用例" in script
|
||||
assert 'id="repairConfirmDialog"' in script
|
||||
assert "confirmAction(" in script
|
||||
assert "window.confirm" not in script
|
||||
assert 'hardware.link?.adapter === "OK"' in script
|
||||
assert 'PASSED: ["21针通过", "online"]' in script
|
||||
assert "connectorRows" in script
|
||||
assert "Polling refreshes data only" in script
|
||||
assert "renderRecords();\n showView(activeView);" not in script
|
||||
@@ -172,3 +178,18 @@ class TestSelfRepairApi:
|
||||
assert 'window.addEventListener("self-repair-seat-reset"' in seat3d
|
||||
assert '["self-calibration", "self-repair"].includes(module)' in console_script
|
||||
assert 'roleSelect.disabled = ui.activeModule === "self-repair"' in console_script
|
||||
|
||||
|
||||
def test_self_repair_bridge_uses_the_backend_runtime_directory() -> None:
|
||||
source = (
|
||||
Path(__file__).resolve().parents[2]
|
||||
/ "tools"
|
||||
/ "zcan"
|
||||
/ "seat_self_repair_bridge.py"
|
||||
).read_text(encoding="utf-8")
|
||||
|
||||
assert '"artifacts", "tmp", "self-repair", "runtime"' in source
|
||||
assert 'os.path.join(BASE_DIR, "seat_function_runtime")' not in source
|
||||
assert "A silent or disconnected CAN bus must not kill" in source
|
||||
assert 'self.message("GUI STOP_ALL发送失败' in source
|
||||
assert 'self.message("GUI thermal off发送失败' in source
|
||||
|
||||
Reference in New Issue
Block a user