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,12 +1,20 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { Lightbulb } from "lucide-react";
|
||||
import { listWeakSignals } from "@/lib/api-v2";
|
||||
import { PageContainer, Badge, TableEmpty } from "@/components/shared/PageContainer";
|
||||
import { PageContainer, Badge} from "@/components/shared/PageContainer";
|
||||
import { LoadingSpinner } from "@/components/shared/LoadingSpinner";
|
||||
import { EmptyState } from "@/components/shared/EmptyState";
|
||||
|
||||
/** 弱信号项。 */
|
||||
interface WeakSignal {
|
||||
signal_type: string;
|
||||
content: string;
|
||||
confidence: number;
|
||||
risk_probability?: number;
|
||||
status: string;
|
||||
}
|
||||
|
||||
const SIGNAL_TYPE_LABELS: Record<string, string> = {
|
||||
technical: "技术",
|
||||
sentiment: "情绪",
|
||||
@@ -15,12 +23,12 @@ const SIGNAL_TYPE_LABELS: Record<string, string> = {
|
||||
};
|
||||
|
||||
export default function WeakSignalsPage() {
|
||||
const [items, setItems] = useState<Record<string, any>[]>([]);
|
||||
const [items, setItems] = useState<WeakSignal[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
listWeakSignals()
|
||||
.then((resp) => setItems((resp.data as Record<string, any>[]) ?? []))
|
||||
.then((resp) => setItems((resp.data as WeakSignal[]) ?? []))
|
||||
.catch(() => setItems([]))
|
||||
.finally(() => setIsLoading(false));
|
||||
}, []);
|
||||
@@ -47,20 +55,20 @@ export default function WeakSignalsPage() {
|
||||
{items.map((item, i) => (
|
||||
<tr key={i}>
|
||||
<td className="px-4 py-2">
|
||||
<Badge color="blue">{SIGNAL_TYPE_LABELS[item.signal_type as string] ?? item.signal_type}</Badge>
|
||||
<Badge color="blue">{SIGNAL_TYPE_LABELS[item.signal_type] ?? item.signal_type}</Badge>
|
||||
</td>
|
||||
<td className="px-4 py-2 text-gray-900 max-w-xs truncate">{item.content as string}</td>
|
||||
<td className="px-4 py-2 text-gray-600">{((item.confidence as number) * 100).toFixed(0)}%</td>
|
||||
<td className="px-4 py-2 text-gray-900 max-w-xs truncate">{item.content}</td>
|
||||
<td className="px-4 py-2 text-gray-600">{(item.confidence * 100).toFixed(0)}%</td>
|
||||
<td className="px-4 py-2">
|
||||
{item.risk_probability ? (
|
||||
<Badge color={(item.risk_probability as number) > 0.6 ? "red" : (item.risk_probability as number) > 0.3 ? "amber" : "green"}>
|
||||
{((item.risk_probability as number) * 100).toFixed(0)}%
|
||||
<Badge color={item.risk_probability > 0.6 ? "red" : item.risk_probability > 0.3 ? "amber" : "green"}>
|
||||
{(item.risk_probability * 100).toFixed(0)}%
|
||||
</Badge>
|
||||
) : "-"}
|
||||
</td>
|
||||
<td className="px-4 py-2">
|
||||
<Badge color={item.status === "alerted" ? "red" : item.status === "correlated" ? "amber" : "gray"}>
|
||||
{item.status as string}
|
||||
{item.status}
|
||||
</Badge>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user