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,21 +1,34 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { BarChart3, Sparkles } from "lucide-react";
|
||||
import {Sparkles } from "lucide-react";
|
||||
import { rebalancePortfolio, runMonteCarlo } from "@/lib/api-v2";
|
||||
import { PageContainer, Card, Badge } from "@/components/shared/PageContainer";
|
||||
import { toast } from "sonner";
|
||||
|
||||
/** 再平衡结果。 */
|
||||
interface RebalanceResult {
|
||||
irr_impact?: number;
|
||||
dpi_impact?: number;
|
||||
}
|
||||
|
||||
/** Monte Carlo 结果。 */
|
||||
interface MonteCarloResult {
|
||||
percentile_p5?: string;
|
||||
percentile_p50?: string;
|
||||
percentile_p95?: string;
|
||||
}
|
||||
|
||||
export default function PortfolioPage() {
|
||||
const [rebalanceResult, setRebalanceResult] = useState<Record<string, any> | null>(null);
|
||||
const [mcResult, setMcResult] = useState<Record<string, any> | null>(null);
|
||||
const [rebalanceResult, setRebalanceResult] = useState<RebalanceResult | null>(null);
|
||||
const [mcResult, setMcResult] = useState<MonteCarloResult | null>(null);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
const handleRebalance = async () => {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const resp = await rebalancePortfolio([]);
|
||||
setRebalanceResult(resp.data as Record<string, any>);
|
||||
setRebalanceResult(resp.data as RebalanceResult);
|
||||
} catch {
|
||||
toast.error("分析失败");
|
||||
} finally {
|
||||
@@ -27,7 +40,7 @@ export default function PortfolioPage() {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const resp = await runMonteCarlo([0.15, 0.22, 0.08, 0.35, 0.12]);
|
||||
setMcResult(resp.data as Record<string, any>);
|
||||
setMcResult(resp.data as MonteCarloResult);
|
||||
} catch {
|
||||
toast.error("模拟失败");
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user