feat: 创建冒烟测试(快速层)
新增文件: - e2e/smoke/health-check.spec.ts - 健康检查测试 - e2e/smoke/critical-paths.spec.ts - 关键路径测试 测试内容: - 应用启动验证 - 健康检查API验证 - 静态资源访问验证 - 首页加载验证 - 管理员登录验证 - 新闻/产品/联系页面访问验证 特性: - 使用 @smoke @critical 标签,支持按标签运行 - 快速验证核心功能,适合CI/CD流水线 - 测试执行时间短,无复杂依赖
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test.describe('健康检查 @smoke @critical', () => {
|
||||
test('应用能够正常启动', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
await expect(page).toHaveTitle(/四川睿新致远科技有限公司/);
|
||||
});
|
||||
|
||||
test('健康检查API正常', async ({ request }) => {
|
||||
const response = await request.get('/api/health');
|
||||
expect(response.status()).toBe(200);
|
||||
|
||||
const body = await response.json();
|
||||
expect(body.status).toBe('ok');
|
||||
});
|
||||
|
||||
test('静态资源可访问', async ({ request }) => {
|
||||
const response = await request.get('/favicon.svg');
|
||||
expect(response.status()).toBe(200);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user