优化后端
This commit is contained in:
@@ -30,7 +30,7 @@ def test_frontend_only_exposes_user_orchestration_and_extension() -> None:
|
||||
assert not (web_root / removed).exists()
|
||||
assert removed not in html
|
||||
|
||||
assert "511工程-智能座舱" in console
|
||||
assert "511工程-智能座舱" not in console
|
||||
assert '["self-orchestration", "self-extension"]' in console
|
||||
assert 'id="vehicleExtensionSync"' in console
|
||||
assert 'getRole: () => "user"' in console
|
||||
@@ -174,6 +174,20 @@ def test_vehicle_device_status_cards_prioritize_seats_and_expose_manual_controls
|
||||
assert ".v2-device-control-apply" in styles
|
||||
|
||||
|
||||
def test_ambient_status_uses_its_own_power_feedback_not_combined_light_badge() -> None:
|
||||
console = source("console-v2.js")
|
||||
ambient_start = console.index('id: "ambient", name: "氛围灯"')
|
||||
ambient_end = console.index('id: "headlight", name: "前大灯"', ambient_start)
|
||||
ambient = console[ambient_start:ambient_end]
|
||||
|
||||
assert 'function ambientPowerState()' in console
|
||||
assert 'dataset.ambientPower' in console
|
||||
assert 'const powerState = ambientPowerState();' in ambient
|
||||
assert 'powerState === "on" ? "开启"' in ambient
|
||||
assert 'ambientPowerState() === "off" ? "off" : "on"' in ambient
|
||||
assert 'readText("#ambientPower")' not in ambient
|
||||
|
||||
|
||||
def test_passenger_can0_status_ui_uses_only_seat_ota_four_axis_contract() -> None:
|
||||
app = source("app.js")
|
||||
console = source("console-v2.js")
|
||||
@@ -207,7 +221,8 @@ def test_left_sidebar_exposes_collapsed_parsed_can_command_panel() -> None:
|
||||
assert "getParsedCanCommands: (result) => parsedCanCommands(result)" in console
|
||||
assert "const configurations = result.function_configs || {};" in console
|
||||
assert "if (!configurationEntries.length && result.function_config)" in console
|
||||
assert 'deliveryLabel: submitted ? "下发" : "未下发"' in console
|
||||
assert "const safetyBlocked = executionFailed && !submitted" in console
|
||||
assert 'safetyBlocked\n ? "安全阻止"' in console
|
||||
assert 'data-delivery-state="${escapeHtml(item.deliveryState)}"' in console
|
||||
assert 'const command = (category, text, channel = "CAN1", frame = "")' in console
|
||||
assert 'data-can-channel="${escapeHtml(item.channel)}"' in console
|
||||
@@ -247,6 +262,9 @@ def test_left_sidebar_exposes_collapsed_parsed_can_command_panel() -> None:
|
||||
"light reading all ${onOff}",
|
||||
"light ambient color ${color}",
|
||||
"light ambient brightness ${level}",
|
||||
"Ambient_RGB_Control_32B_2B(color=${color}, brightness=${brightness}%)",
|
||||
"Ambient_Mode_Control_496_04(mode=${mode})",
|
||||
"Climate_Control_064_04(${target}=${temperature}°C)",
|
||||
"shade position ${position}",
|
||||
"seat passenger ${axis[1]} position ${position}",
|
||||
"seat passenger dynamic ${dynamic}",
|
||||
@@ -705,6 +723,42 @@ def test_parsed_command_delivery_is_independent_of_transport_and_target() -> Non
|
||||
}
|
||||
}
|
||||
}
|
||||
blocked_shade = {
|
||||
"function_configs": {
|
||||
"native_roof": {
|
||||
"spec": {
|
||||
"operations": [
|
||||
{
|
||||
"id": "shade-position",
|
||||
"capability": "roof.set_shade_position",
|
||||
"target": {"zone": "vehicle"},
|
||||
"parameters": {"position_pct": 30},
|
||||
"parse_source": "local_rule",
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"execution_mode": "hardware",
|
||||
"control_transport": "wireless_mqtt",
|
||||
"execution_report": {
|
||||
"spec": {
|
||||
"results": [
|
||||
{
|
||||
"ref": "shade-position",
|
||||
"status": "failed",
|
||||
"message": (
|
||||
"no fresh valid 0x41A shade position; "
|
||||
"refusing blind motion"
|
||||
),
|
||||
"telemetry": {
|
||||
"verification_status": "failed_or_blocked"
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
samples = [
|
||||
{**base, "execution_mode": "dry_run", "control_transport": "wired_can"},
|
||||
{
|
||||
@@ -744,6 +798,7 @@ def test_parsed_command_delivery_is_independent_of_transport_and_target() -> Non
|
||||
}
|
||||
},
|
||||
},
|
||||
blocked_shade,
|
||||
]
|
||||
script = (
|
||||
f"{helpers}\n"
|
||||
@@ -761,19 +816,35 @@ def test_parsed_command_delivery_is_independent_of_transport_and_target() -> Non
|
||||
)
|
||||
|
||||
parsed = json.loads(completed.stdout)
|
||||
assert [len(commands) for commands in parsed] == [1, 1, 1, 1]
|
||||
assert [commands[0]["command"] for commands in parsed] == ["ac on"] * 4
|
||||
assert [len(commands) for commands in parsed] == [1, 1, 1, 1, 1]
|
||||
assert [commands[0]["command"] for commands in parsed] == [
|
||||
"ac on",
|
||||
"ac on",
|
||||
"ac on",
|
||||
"ac on",
|
||||
"shade position 30",
|
||||
]
|
||||
assert [commands[0]["deliveryLabel"] for commands in parsed] == [
|
||||
"未下发",
|
||||
"未下发",
|
||||
"下发",
|
||||
"下发",
|
||||
"安全阻止",
|
||||
]
|
||||
assert [commands[0]["deliveryState"] for commands in parsed] == [
|
||||
"not_submitted",
|
||||
"not_submitted",
|
||||
"submitted",
|
||||
"submitted",
|
||||
"blocked",
|
||||
]
|
||||
assert "0x41A 实时位置" in parsed[-1][0]["deliveryDetail"]
|
||||
assert [commands[0]["deliveryTransport"] for commands in parsed] == [
|
||||
"有线 CAN",
|
||||
"无线 CAN",
|
||||
"有线 CAN",
|
||||
"无线 CAN",
|
||||
"无线 CAN",
|
||||
]
|
||||
|
||||
|
||||
@@ -803,9 +874,11 @@ def test_mode_editor_renders_readable_commands_with_expandable_mqtt_sequences()
|
||||
assert "if (isDispatchTask(task))" in console
|
||||
assert "下发控制指令" in console
|
||||
assert "已解析控制指令" not in console
|
||||
assert "function executeSavedModeProfile(mode)" in app
|
||||
assert 'async function executeSavedModeProfile(mode, { command = "" } = {})' in app
|
||||
assert "/api/mode-profiles/${encodeURIComponent(mode.id)}/execute" in app
|
||||
assert '$("#utterance").value = mode.name || mode.id;' in app
|
||||
assert "assistant?.announceModeExecution?.(mode, payload" in app
|
||||
assert "void executeSavedModeProfile(mode, { command: modeCommand });" in app
|
||||
assert "announceModeExecution" in source("assistant-chat.js")
|
||||
assert 'const savedModeExecution = result.orchestration_route === "saved_mode_command_flow";' in app
|
||||
assert "`${result.mode_profile.name}执行完成`" in app
|
||||
|
||||
@@ -1021,6 +1094,14 @@ def test_interactive_console_uses_one_top_right_icon_dock_for_all_five_panels()
|
||||
assert console.index('id="v2DevicePanel"') < console.index('id="v2ExtensionPanel"')
|
||||
assert 'class="v2-side-status-stack"' in console
|
||||
assert 'class="v2-panel-control-dock"' in console
|
||||
assert "function buildModuleSwitcher(mainPanel, modeRail)" in console
|
||||
assert 'const modeRailBar = $(".mode-rail-bar", modeRail);' in console
|
||||
assert "if (modeRailBar) modeRailBar.prepend(switcher);" in console
|
||||
assert 'const homepageHeader = moduleSwitcher.closest(".v2-mode-rail") || moduleSwitcher;' in extension
|
||||
assert 'homepageHeader.insertAdjacentElement("afterend", root);' in extension
|
||||
assert 'class="v2-unified-brand"' not in console
|
||||
assert "网页控制链路" not in console
|
||||
assert '<div class="v2-sync-sidebar-heading">' not in console
|
||||
assert 'panelDock.append(sidebarToggle)' in console
|
||||
assert 'panelDock.append(deviceToggle, extensionToggle)' in console
|
||||
assert 'class="v2-side-panel-dock"' not in console
|
||||
@@ -1046,12 +1127,22 @@ def test_interactive_console_uses_one_top_right_icon_dock_for_all_five_panels()
|
||||
assert '.v2-panel-control-button[aria-pressed="true"]' in styles
|
||||
assert "background: var(--primary);" in styles
|
||||
assert "width: 38px !important;" in styles
|
||||
assert "Unified homepage header: panel controls and function modes share one row." in styles
|
||||
assert "grid-template-columns: auto auto minmax(0, 1fr) auto;" in styles
|
||||
final_styles = styles.split("/* AI assistant light-blue final override", 1)[1]
|
||||
assert 'data-open-panels="none"' in final_styles
|
||||
assert "grid-template-columns: minmax(0, 1fr);" in final_styles
|
||||
assert ".v2-unified-right-rail[hidden]" in final_styles
|
||||
|
||||
|
||||
def test_runtime_hardware_coverage_defines_the_linked_readiness_state() -> None:
|
||||
app = source("app.js")
|
||||
|
||||
definition = "const linkedHardwareReady = seatHardwareReady && vehicleHardwareReady;"
|
||||
assert definition in app
|
||||
assert app.index(definition) < app.index(": linkedHardwareReady")
|
||||
|
||||
|
||||
def test_left_sync_rail_can_collapse_and_log_aligns_with_lower_workspace() -> None:
|
||||
console = source("console-v2.js")
|
||||
styles = source("console-v2.css")
|
||||
@@ -1210,7 +1301,11 @@ def test_compact_mode_strip_supports_wheel_drag_and_keyboard_navigation() -> Non
|
||||
|
||||
assert 'group.addEventListener("pointerdown"' in scroller
|
||||
assert 'event.pointerType !== "mouse"' in scroller
|
||||
assert "group.setPointerCapture?.(pointerId)" in scroller
|
||||
assert "group.setPointerCapture(pointerId)" in scroller
|
||||
assert scroller.index("group.setPointerCapture(pointerId)") > scroller.index(
|
||||
"Math.abs(distance) < 5"
|
||||
)
|
||||
assert "let pointerCaptured = false;" in scroller
|
||||
assert 'group.addEventListener("pointermove"' in scroller
|
||||
assert "Math.abs(distance) < 5" in scroller
|
||||
assert 'group.classList.add("is-dragging")' in scroller
|
||||
|
||||
Reference in New Issue
Block a user