63 lines
2.6 KiB
Python
63 lines
2.6 KiB
Python
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
WEB = ROOT / "apps" / "web-console"
|
|
|
|
|
|
def source(name: str) -> str:
|
|
return (WEB / name).read_text(encoding="utf-8")
|
|
|
|
|
|
def test_workbench_is_a_standalone_development_surface() -> None:
|
|
html = source("firmware-workbench.html")
|
|
script = source("firmware-workbench.js")
|
|
|
|
assert "座椅固件开发工作台" in html
|
|
assert '<textarea id="instructionInput"' in html
|
|
assert 'id="startTaskButton"' in html
|
|
assert 'id="cancelTaskButton"' in html
|
|
assert 'id="pipeline"' in html
|
|
assert 'id="logStream"' in html
|
|
assert 'id="artifactTableBody"' in html
|
|
assert 'id="baselineSelect"' in html
|
|
assert 'id="targetCapabilities"' in html
|
|
assert "执行摘要" not in html
|
|
assert "单屏工作台" not in html
|
|
assert "相同指令只会复用同一任务" not in html
|
|
assert "固件交付流水线</h2>" not in html
|
|
assert html.count("<option") == 1
|
|
assert '<option value="time_only">时间控制</option>' in html
|
|
for english_label in ("DEVELOPMENT BRIEF", "DELIVERY PIPELINE", "LIVE EXECUTION", "SOFTWARE ARTIFACTS"):
|
|
assert english_label not in html
|
|
assert "普通聊天" not in html
|
|
for stage in ("指令输入", "需求解析", "基线检查", "代码生成", "编译构建", "测试验证", "固件打包", "发布服务器"):
|
|
assert stage in script or stage in html
|
|
for status in ("等待", "运行中", "待确认", "成功", "失败", "取消", "阻塞"):
|
|
assert status in script or status in html
|
|
|
|
|
|
def test_workbench_exposes_artifact_actions_and_always_starts_a_new_task() -> None:
|
|
html = source("firmware-workbench.html")
|
|
script = source("firmware-workbench.js")
|
|
entry = source("firmware-workbench-entry.js")
|
|
index = source("index.html")
|
|
worker = source("service-worker.js")
|
|
|
|
for label in ("查看详情", "能力差异", "代码差异", "验证记录", "下载固件", "发布到服务器", "删除固件产物"):
|
|
assert label in script
|
|
assert "检测到相同指令" not in script
|
|
assert "result.duplicate" not in script
|
|
assert "已发布,待车机端下载升级" not in script
|
|
assert 'id = "firmwareWorkbenchToggle"' in entry
|
|
assert 'className = "firmware-workbench-layer"' in entry
|
|
assert "/firmware-workbench-entry.js?v=2" in index
|
|
assert "/firmware-workbench-entry.css?v=1" in index
|
|
for asset in (
|
|
"/firmware-workbench-entry.css?v=1",
|
|
"/firmware-workbench-entry.js?v=2",
|
|
"/firmware-workbench.html",
|
|
"/firmware-workbench.css?v=5",
|
|
"/firmware-workbench.js?v=3",
|
|
):
|
|
assert f'"{asset}"' in worker
|