主要更新: - 🎯 新增综合分析仪表板,包含关键指标卡片、预算对比、智能洞察等组件 - 📊 增强数据可视化能力,新增标签云分析、时间维度分析等图表 - 📱 优化移动端响应式设计,改进触控交互体验 - 🔧 新增多个API模块(base、budget、tag),完善数据管理 - 🗂️ 重构路由结构,新增贷款、快速添加、设置、统计等独立模块 - 🔄 优化数据导入导出功能,增强数据迁移能力 - 🐛 修复多个已知问题,提升系统稳定性 技术改进: - 使用IndexedDB提升本地存储性能 - 实现模拟API服务,支持离线开发 - 增加自动化测试脚本,确保功能稳定 - 优化打包配置,提升构建效率 文件变更: - 新增42个文件 - 修改55个文件 - 包含测试脚本、配置文件、组件和API模块 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
116 lines
3.5 KiB
JavaScript
116 lines
3.5 KiB
JavaScript
import { chromium } from 'playwright';
|
||
|
||
(async () => {
|
||
const browser = await chromium.launch({
|
||
headless: false,
|
||
slowMo: 300,
|
||
});
|
||
|
||
const page = await browser.newPage();
|
||
|
||
// 只监听错误
|
||
page.on('pageerror', (error) => {
|
||
console.log('[页面错误]', error.message);
|
||
});
|
||
|
||
try {
|
||
console.log('========== 测试新建交易 ==========\n');
|
||
|
||
// 1. 访问页面
|
||
console.log('1. 访问交易管理页面...');
|
||
await page.goto('http://localhost:5667/finance/transaction');
|
||
await page.waitForTimeout(3000);
|
||
|
||
// 2. 点击新建
|
||
console.log('2. 点击新建按钮...');
|
||
const createBtn = await page
|
||
.locator('button')
|
||
.filter({ hasText: '新建' })
|
||
.first();
|
||
await createBtn.click();
|
||
await page.waitForTimeout(1500);
|
||
|
||
// 3. 填写表单
|
||
console.log('3. 填写交易信息...');
|
||
|
||
// 金额
|
||
const amountInput = await page
|
||
.locator('input.ant-input-number-input')
|
||
.first();
|
||
await amountInput.clear();
|
||
await amountInput.fill('888.88');
|
||
console.log(' 金额: 888.88');
|
||
|
||
// 选择分类
|
||
const categorySelect = await page.locator('.ant-select').nth(1);
|
||
await categorySelect.click();
|
||
await page.waitForTimeout(500);
|
||
|
||
const categoryOption = await page
|
||
.locator('.ant-select-dropdown:visible .ant-select-item')
|
||
.first();
|
||
if (await categoryOption.isVisible()) {
|
||
await categoryOption.click();
|
||
console.log(' 分类: 已选择');
|
||
}
|
||
|
||
// 描述
|
||
const descInput = await page.locator('textarea').first();
|
||
if (await descInput.isVisible()) {
|
||
await descInput.fill(`测试交易 - ${new Date().toLocaleTimeString()}`);
|
||
console.log(' 描述: 已填写');
|
||
}
|
||
|
||
// 4. 提交
|
||
console.log('4. 提交交易...');
|
||
const submitBtn = await page
|
||
.locator('.ant-modal-footer button.ant-btn-primary')
|
||
.first();
|
||
await submitBtn.click();
|
||
await page.waitForTimeout(2000);
|
||
|
||
// 5. 检查结果
|
||
console.log('5. 检查结果...');
|
||
|
||
// 检查成功消息
|
||
const successMsg = await page.locator('.ant-message-success').first();
|
||
const hasSuccess = await successMsg.isVisible();
|
||
|
||
// 检查弹窗是否关闭
|
||
const modal = await page.locator('.ant-modal').first();
|
||
const modalClosed = !(await modal.isVisible());
|
||
|
||
// 检查新记录
|
||
await page.waitForTimeout(1000);
|
||
const newRecord = await page.locator('td:has-text("888.88")').first();
|
||
const recordFound = await newRecord.isVisible();
|
||
|
||
console.log('\n========== 测试结果 ==========');
|
||
console.log(`✅ 弹窗打开: 成功`);
|
||
console.log(
|
||
`${hasSuccess ? '✅' : '❌'} 成功提示: ${hasSuccess ? '显示' : '未显示'}`,
|
||
);
|
||
console.log(
|
||
`${modalClosed ? '✅' : '❌'} 弹窗关闭: ${modalClosed ? '已关闭' : '未关闭'}`,
|
||
);
|
||
console.log(
|
||
`${recordFound ? '✅' : '❌'} 新记录: ${recordFound ? '已创建' : '未找到'}`,
|
||
);
|
||
|
||
if (hasSuccess && modalClosed && recordFound) {
|
||
console.log('\n🎉 新建交易功能正常!');
|
||
} else {
|
||
console.log('\n⚠️ 新建交易功能存在问题');
|
||
await page.screenshot({ path: 'transaction-issue.png' });
|
||
console.log('已保存截图: transaction-issue.png');
|
||
}
|
||
} catch (error) {
|
||
console.error('\n❌ 测试失败:', error.message);
|
||
await page.screenshot({ path: 'error.png' });
|
||
} finally {
|
||
console.log('\n浏览器将在5秒后关闭...');
|
||
await page.waitForTimeout(5000);
|
||
await browser.close();
|
||
}
|
||
})();
|