Files
novalon-manage-system/novalon-manage-web/e2e/basic.spec.ts
T
张翔 dc53a233b9 refactor(domain): 将领域模型移动到common模块
重构项目结构,将分散在各模块的领域模型统一移动到manage-common模块
更新相关依赖和引用路径
调整docker-compose配置和测试标记
添加新的Playwright测试配置
优化Dockerfile构建过程
2026-03-13 19:58:57 +08:00

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);
});
});