be5d5ede90
refactor: 重构后端查询逻辑和API响应处理 fix: 修复用户角色更新和文件上传问题 test: 添加前端性能测试脚本和E2E测试用例 chore: 更新依赖版本和配置文件 docs: 添加环境检查脚本和测试文档 style: 统一表格标签样式和路由命名 perf: 优化前端页面加载速度和响应时间
29 lines
1.0 KiB
TypeScript
29 lines
1.0 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('简单API测试', () => {
|
|
|
|
test('测试1: 后端健康检查', async ({ request }) => {
|
|
console.log('测试1: 检查后端健康状态');
|
|
const response = await request.get('http://localhost:8084/actuator/health');
|
|
console.log('响应状态:', response.status());
|
|
const body = await response.json();
|
|
console.log('响应体:', JSON.stringify(body, null, 2));
|
|
expect(response.status()).toBe(200);
|
|
expect(body.status).toBe('UP');
|
|
});
|
|
|
|
test('测试2: 登录API', async ({ request }) => {
|
|
console.log('测试2: 测试登录API');
|
|
const response = await request.post('http://localhost:8084/api/auth/login', {
|
|
data: {
|
|
username: 'admin',
|
|
password: 'admin123'
|
|
}
|
|
});
|
|
console.log('响应状态:', response.status());
|
|
const body = await response.json();
|
|
console.log('响应体:', JSON.stringify(body, null, 2));
|
|
expect(response.status()).toBe(200);
|
|
expect(body.token).toBeDefined();
|
|
});
|
|
}); |