feat(frontend): split test assistant nav into cases and batch pages

Make 测试助手 a sidebar section like 监控观察, with placeholder routes for 测试用例 and 批量测试.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Xin Wang
2026-08-07 16:00:50 +08:00
parent b2e99baa19
commit 36117b976e
7 changed files with 77 additions and 19 deletions

View File

@@ -0,0 +1,5 @@
import { BatchTestPage } from "@/components/pages/BatchTestPage";
export default function Page() {
return <BatchTestPage />;
}

View File

@@ -0,0 +1,5 @@
import { TestCasesPage } from "@/components/pages/TestCasesPage";
export default function Page() {
return <TestCasesPage />;
}

View File

@@ -1,5 +1,5 @@
import { TestPage } from "@/components/pages/TestPage";
import { redirect } from "next/navigation";
export default function Page() {
return <TestPage />;
redirect("/test/cases");
}

View File

@@ -9,9 +9,11 @@ import {
Brain,
ChevronLeft,
ChevronUp,
ClipboardList,
Clock3,
Database,
HelpCircle,
Layers,
Wrench,
Home,
LogOut,
@@ -51,6 +53,11 @@ const monitorSubItems: NavItem[] = [
{ href: "/dashboard", label: "数据看板", icon: Database },
];
const testSubItems: NavItem[] = [
{ href: "/test/cases", label: "测试用例", icon: ClipboardList },
{ href: "/test/batch", label: "批量测试", icon: Layers },
];
export function Sidebar({ collapsed, onToggle }: SidebarProps) {
const pathname = usePathname();
const router = useRouter();
@@ -62,6 +69,7 @@ export function Sidebar({ collapsed, onToggle }: SidebarProps) {
const componentActive = componentSubItems.some((item) => isActive(item.href));
const monitorActive = monitorSubItems.some((item) => isActive(item.href));
const testActive = testSubItems.some((item) => isActive(item.href));
async function handleLogout() {
await logout();
@@ -201,13 +209,43 @@ export function Sidebar({ collapsed, onToggle }: SidebarProps) {
</div>
<div className="pt-2">
<NavButton
active={isActive("/test")}
collapsed={collapsed}
icon={PlayCircle}
label="测试助手"
href="/test"
/>
{collapsed ? (
<div
className="flex h-8 items-center justify-center"
aria-hidden="true"
title="测试助手"
>
<span className="h-px w-6 rounded-full bg-hairline-strong" />
</div>
) : (
<div
className={[
"flex h-11 w-full items-center gap-3 rounded-full px-3 text-sm",
testActive ? "text-foreground" : "text-muted-foreground",
].join(" ")}
>
<PlayCircle size={18} />
<span className="font-medium"></span>
</div>
)}
<div
className={[
"mt-1 space-y-1 transition-[padding] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)]",
collapsed ? "pl-0" : "pl-5",
].join(" ")}
>
{testSubItems.map((item) => (
<NavButton
key={item.href}
active={isActive(item.href)}
collapsed={collapsed}
icon={item.icon}
label={item.label}
href={item.href}
/>
))}
</div>
</div>
</div>

View File

@@ -0,0 +1,10 @@
import { PlaceholderPage } from "./PlaceholderPage";
export function BatchTestPage() {
return (
<PlaceholderPage
title="批量测试"
description="按用例集批量跑测助手,汇总通过率与失败详情。"
/>
);
}

View File

@@ -0,0 +1,10 @@
import { PlaceholderPage } from "./PlaceholderPage";
export function TestCasesPage() {
return (
<PlaceholderPage
title="测试用例"
description="管理助手的测试用例,覆盖典型问答与边界场景。"
/>
);
}

View File

@@ -1,10 +0,0 @@
import { PlaceholderPage } from "./PlaceholderPage";
export function TestPage() {
return (
<PlaceholderPage
title="测试助手"
description="在发布前通过实时视频对话测试助手的表现与交互体验。"
/>
);
}