c50ccd258f
refactor(tests): 将e2e_tests迁移到tests_suite和api_integration_tests style: 为Java类添加文档注释 docs: 更新.gitignore和配置文件 test: 添加性能测试和Playwright测试脚本 chore: 清理旧测试文件和配置
47 lines
1.7 KiB
TypeScript
47 lines
1.7 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('系统基础功能 E2E 测试', () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await page.goto('/');
|
|
});
|
|
|
|
test('首页加载测试', async ({ page }) => {
|
|
await expect(page).toHaveTitle(/Novalon 管理系统/);
|
|
await expect(page.locator('#app')).toBeVisible();
|
|
});
|
|
|
|
test('登录页面访问测试', async ({ page }) => {
|
|
await page.click('text=登录');
|
|
await expect(page).toHaveURL(/.*login/);
|
|
await expect(page.locator('input[type="text"]')).toBeVisible();
|
|
await expect(page.locator('input[type="password"]')).toBeVisible();
|
|
});
|
|
|
|
test('后端健康检查', async ({ request }) => {
|
|
const response = await request.get('http://localhost:8084/actuator/health');
|
|
expect(response.status()).toBe(200);
|
|
const body = await response.json();
|
|
expect(body.status).toBe('UP');
|
|
});
|
|
|
|
test('数据库连接检查', async ({ request }) => {
|
|
const response = await request.get('http://localhost:8084/actuator/health');
|
|
expect(response.status()).toBe(200);
|
|
const body = await response.json();
|
|
expect(body.components.r2dbc.status).toBe('UP');
|
|
expect(body.components.r2dbc.details.database).toBe('PostgreSQL');
|
|
});
|
|
|
|
test('前端页面可访问性', async ({ page }) => {
|
|
await page.goto('/');
|
|
await expect(page.locator('#app')).toBeVisible();
|
|
const title = await page.title();
|
|
expect(title).toContain('Novalon 管理系统');
|
|
});
|
|
|
|
test('API代理配置验证', async ({ page }) => {
|
|
await page.goto('/');
|
|
const response = await page.request.get('http://localhost:3002/api/actuator/health');
|
|
expect(response.status()).toBe(401);
|
|
});
|
|
}); |