test(frontend): UIUX E2E 测试 — 新增路由导航/创始人端/Admin端/工作台/移动端适配
新增 6 个 E2E 测试文件,覆盖 2-task-uiux.md 全部 50 项任务: - uiux-navigation.spec.ts: 8 tests (today/compare/threads/workspace/ooda/ai-plus/profiles) - sidebar-navigation.spec.ts: 6 tests (投资人 Sidebar 6 业务域) - founder-uiux.spec.ts: 7 tests (创始人端 6 域导航) - admin-uiux.spec.ts: 3 tests (Admin 6 管理域 + 商业秘密保护) - workbench-uiux.spec.ts: 5 tests (Highlights/WorkMode/Tab/InsightRail) - mobile-uiux.spec.ts: 5 tests (移动端抽屉导航 + 创始人底部导航) 同时修复全部 no-explicit-any 警告,替换为 TypeScript 接口定义。 测试结果: 41 E2E passed, 405 backend passed
This commit is contained in:
@@ -1,15 +1,22 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { BookOpen, Sparkles } from "lucide-react";
|
||||
import {Sparkles } from "lucide-react";
|
||||
import { listAARs, generateAAR } from "@/lib/api-v2";
|
||||
import { PageContainer, Card, Badge } from "@/components/shared/PageContainer";
|
||||
import { PageContainer, Card} from "@/components/shared/PageContainer";
|
||||
import { LoadingSpinner } from "@/components/shared/LoadingSpinner";
|
||||
import { EmptyState } from "@/components/shared/EmptyState";
|
||||
import { toast } from "sonner";
|
||||
|
||||
/** AAR 复盘记录项。 */
|
||||
interface AARItem {
|
||||
trigger_event: string;
|
||||
gap_analysis?: string;
|
||||
lessons?: string[];
|
||||
}
|
||||
|
||||
export default function AARsPage() {
|
||||
const [items, setItems] = useState<Record<string, any>[]>([]);
|
||||
const [items, setItems] = useState<AARItem[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [triggerEvent, setTriggerEvent] = useState("");
|
||||
const [originalPlan, setOriginalPlan] = useState("");
|
||||
@@ -17,7 +24,7 @@ export default function AARsPage() {
|
||||
|
||||
useEffect(() => {
|
||||
listAARs()
|
||||
.then((resp) => setItems((resp.data as Record<string, any>[]) ?? []))
|
||||
.then((resp) => setItems((resp.data as AARItem[]) ?? []))
|
||||
.catch(() => setItems([]))
|
||||
.finally(() => setIsLoading(false));
|
||||
}, []);
|
||||
@@ -29,7 +36,7 @@ export default function AARsPage() {
|
||||
}
|
||||
try {
|
||||
const resp = await generateAAR(triggerEvent, originalPlan, actualResult);
|
||||
setItems([resp.data as Record<string, any>, ...items]);
|
||||
setItems([resp.data as AARItem, ...items]);
|
||||
toast.success("AAR 复盘已生成");
|
||||
} catch {
|
||||
toast.error("生成失败");
|
||||
@@ -77,11 +84,11 @@ export default function AARsPage() {
|
||||
<div className="space-y-3">
|
||||
{items.map((item, i) => (
|
||||
<Card key={i}>
|
||||
<h3 className="font-medium text-gray-900">{item.trigger_event as string}</h3>
|
||||
{item.gap_analysis && <p className="mt-1 text-sm text-gray-600">{item.gap_analysis as string}</p>}
|
||||
<h3 className="font-medium text-gray-900">{item.trigger_event}</h3>
|
||||
{item.gap_analysis && <p className="mt-1 text-sm text-gray-600">{item.gap_analysis}</p>}
|
||||
{Array.isArray(item.lessons) && (
|
||||
<div className="mt-2 space-y-1">
|
||||
{(item.lessons as string[]).map((lesson, li) => (
|
||||
{item.lessons.map((lesson, li) => (
|
||||
<p key={li} className="text-xs text-gray-500">• {lesson}</p>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user