Files
kt-financial-system/temp-tests/test-simple.js
woshiqp465 9683b940bf feat: 配置开发环境和清理项目结构
- 修改默认路由重定向到首页 (/home)
- 配置开发服务器使用5667端口
- 整理测试文件到temp-tests目录
- 优化项目结构便于开发和部署

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-15 21:35:49 +08:00

52 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { chromium } from 'playwright';
(async () => {
const browser = await chromium.launch({
headless: false,
slowMo: 500,
});
const page = await browser.newPage();
try {
console.log('访问交易管理页面...');
await page.goto('http://localhost:5667/finance/transaction');
await page.waitForTimeout(3000);
console.log('点击新建按钮...');
const createBtn = await page
.locator('button')
.filter({ hasText: '新建' })
.first();
await createBtn.click();
console.log('等待弹窗...');
await page.waitForTimeout(2000);
console.log('填写金额...');
const amountInput = await page
.locator('input.ant-input-number-input')
.first();
await amountInput.clear();
await amountInput.fill('100');
console.log('点击提交...');
const submitBtn = await page
.locator('button')
.filter({ hasText: '确定' })
.first();
await submitBtn.click();
console.log('等待结果...');
await page.waitForTimeout(3000);
console.log('测试完成!');
} catch (error) {
console.error('错误:', error.message);
} finally {
console.log('浏览器将保持打开10秒请手动检查...');
await page.waitForTimeout(10_000);
await browser.close();
}
})();