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,17 +1,34 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { ShieldCheck, Sparkles } from "lucide-react";
|
||||
import {Sparkles } from "lucide-react";
|
||||
import { listPreMortems, runPreMortem, listRedTeams, runRedTeam } from "@/lib/api-v2";
|
||||
import { PageContainer, Card, Badge } from "@/components/shared/PageContainer";
|
||||
import { LoadingSpinner } from "@/components/shared/LoadingSpinner";
|
||||
import { EmptyState } from "@/components/shared/EmptyState";
|
||||
import { toast } from "sonner";
|
||||
|
||||
/** Pre-mortem 记录项。 */
|
||||
interface PreMortemItem {
|
||||
decision_context: string;
|
||||
failure_paths?: FailurePath[];
|
||||
}
|
||||
|
||||
/** 失败路径项。 */
|
||||
interface FailurePath {
|
||||
path?: string;
|
||||
}
|
||||
|
||||
/** Red Team 记录项。 */
|
||||
interface RedTeamItem {
|
||||
perspective: string;
|
||||
analysis: string;
|
||||
}
|
||||
|
||||
export default function PreMortemsPage() {
|
||||
const [tab, setTab] = useState<"pre-mortem" | "red-team">("pre-mortem");
|
||||
const [preMortems, setPreMortems] = useState<Record<string, any>[]>([]);
|
||||
const [redTeams, setRedTeams] = useState<Record<string, any>[]>([]);
|
||||
const [preMortems, setPreMortems] = useState<PreMortemItem[]>([]);
|
||||
const [redTeams, setRedTeams] = useState<RedTeamItem[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [input, setInput] = useState("");
|
||||
const [perspective, setPerspective] = useState("competitor");
|
||||
@@ -19,8 +36,8 @@ export default function PreMortemsPage() {
|
||||
useEffect(() => {
|
||||
Promise.all([listPreMortems(), listRedTeams()])
|
||||
.then(([pm, rt]) => {
|
||||
setPreMortems((pm.data as Record<string, any>[]) ?? []);
|
||||
setRedTeams((rt.data as Record<string, any>[]) ?? []);
|
||||
setPreMortems((pm.data as PreMortemItem[]) ?? []);
|
||||
setRedTeams((rt.data as RedTeamItem[]) ?? []);
|
||||
})
|
||||
.catch(() => {
|
||||
setPreMortems([]);
|
||||
@@ -37,11 +54,11 @@ export default function PreMortemsPage() {
|
||||
try {
|
||||
if (tab === "pre-mortem") {
|
||||
const resp = await runPreMortem(input);
|
||||
setPreMortems([resp.data as Record<string, any>, ...preMortems]);
|
||||
setPreMortems([resp.data as PreMortemItem, ...preMortems]);
|
||||
toast.success("Pre-mortem 分析完成");
|
||||
} else {
|
||||
const resp = await runRedTeam(input, perspective);
|
||||
setRedTeams([resp.data as Record<string, any>, ...redTeams]);
|
||||
setRedTeams([resp.data as RedTeamItem, ...redTeams]);
|
||||
toast.success("Red Team 分析完成");
|
||||
}
|
||||
} catch {
|
||||
@@ -103,7 +120,7 @@ export default function PreMortemsPage() {
|
||||
<h3 className="font-medium text-gray-900">{item.decision_context as string}</h3>
|
||||
{Array.isArray(item.failure_paths) && (
|
||||
<div className="mt-2 space-y-1">
|
||||
{(item.failure_paths as Record<string, any>[]).map((fp, fi) => (
|
||||
{(item.failure_paths as FailurePath[]).map((fp, fi) => (
|
||||
<p key={fi} className="text-xs text-gray-500">• {String(fp.path ?? fp)}</p>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user