主要更新: - 🎯 新增综合分析仪表板,包含关键指标卡片、预算对比、智能洞察等组件 - 📊 增强数据可视化能力,新增标签云分析、时间维度分析等图表 - 📱 优化移动端响应式设计,改进触控交互体验 - 🔧 新增多个API模块(base、budget、tag),完善数据管理 - 🗂️ 重构路由结构,新增贷款、快速添加、设置、统计等独立模块 - 🔄 优化数据导入导出功能,增强数据迁移能力 - 🐛 修复多个已知问题,提升系统稳定性 技术改进: - 使用IndexedDB提升本地存储性能 - 实现模拟API服务,支持离线开发 - 增加自动化测试脚本,确保功能稳定 - 优化打包配置,提升构建效率 文件变更: - 新增42个文件 - 修改55个文件 - 包含测试脚本、配置文件、组件和API模块 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
106 lines
3.3 KiB
JavaScript
106 lines
3.3 KiB
JavaScript
import { chromium } from 'playwright';
|
||
|
||
(async () => {
|
||
const browser = await chromium.launch({
|
||
headless: false, // 有头模式,方便观察
|
||
});
|
||
const context = await browser.newContext();
|
||
const page = await context.newPage();
|
||
|
||
console.log('开始测试财务管理系统...\n');
|
||
|
||
try {
|
||
// 访问首页
|
||
console.log('1. 访问系统首页...');
|
||
await page.goto('http://localhost:5666/', {
|
||
waitUntil: 'networkidle',
|
||
timeout: 30_000,
|
||
});
|
||
|
||
console.log(' ✓ 页面加载成功');
|
||
console.log(' 当前URL:', page.url());
|
||
|
||
// 检查是否重定向到登录页
|
||
if (page.url().includes('/auth/login')) {
|
||
console.log('\n2. 系统重定向到登录页面,执行登录...');
|
||
|
||
// 等待页面稳定
|
||
await page.waitForTimeout(2000);
|
||
|
||
// 填写登录表单
|
||
console.log(' 填写用户名: vben');
|
||
await page.fill(
|
||
'input[placeholder*="用户名" i], input[placeholder*="account" i], input[type="text"]',
|
||
'vben',
|
||
);
|
||
|
||
console.log(' 填写密码: 123456');
|
||
await page.fill(
|
||
'input[placeholder*="密码" i], input[placeholder*="password" i], input[type="password"]',
|
||
'123456',
|
||
);
|
||
|
||
// 提交登录
|
||
console.log(' 提交登录...');
|
||
await page.keyboard.press('Enter');
|
||
|
||
// 等待登录完成
|
||
await page.waitForTimeout(3000);
|
||
|
||
if (page.url().includes('/auth/login')) {
|
||
console.log(' ⚠️ 可能需要验证码或其他验证');
|
||
} else {
|
||
console.log(' ✓ 登录成功');
|
||
}
|
||
}
|
||
|
||
console.log('\n3. 测试主要功能模块...\n');
|
||
|
||
// 测试各个模块
|
||
const modules = [
|
||
{ name: '财务概览', url: '/finance/dashboard' },
|
||
{ name: '交易管理', url: '/finance/transaction' },
|
||
{ name: '分类管理', url: '/finance/category' },
|
||
{ name: '人员管理', url: '/finance/person' },
|
||
{ name: '贷款管理', url: '/finance/loan' },
|
||
{ name: '数据概览', url: '/analytics/overview' },
|
||
];
|
||
|
||
for (const module of modules) {
|
||
console.log(`测试 ${module.name}...`);
|
||
|
||
try {
|
||
await page.goto(`http://localhost:5666${module.url}`, {
|
||
waitUntil: 'networkidle',
|
||
timeout: 15_000,
|
||
});
|
||
|
||
await page.waitForTimeout(2000);
|
||
|
||
// 检查页面元素
|
||
const hasError = (await page.locator('.ant-alert-error').count()) > 0;
|
||
const hasTable = (await page.locator('.ant-table').count()) > 0;
|
||
const hasChart = (await page.locator('canvas').count()) > 0;
|
||
const hasCard = (await page.locator('.ant-card').count()) > 0;
|
||
|
||
console.log(` ✓ 页面加载成功`);
|
||
if (hasTable) console.log(` - 包含数据表格`);
|
||
if (hasChart) console.log(` - 包含数据图表`);
|
||
if (hasCard) console.log(` - 包含卡片组件`);
|
||
if (hasError) console.log(` ⚠️ 发现错误提示`);
|
||
} catch (error) {
|
||
console.log(` ✗ 加载失败: ${error.message}`);
|
||
}
|
||
}
|
||
|
||
console.log('\n测试完成!系统基本功能正常。');
|
||
} catch (error) {
|
||
console.error('测试失败:', error);
|
||
}
|
||
|
||
// 保持浏览器打开10秒供查看
|
||
console.log('\n浏览器将在10秒后关闭...');
|
||
await page.waitForTimeout(10_000);
|
||
await browser.close();
|
||
})();
|