538de50bb1
- Prisma User 模型新增 username 字段(唯一索引) - 注册先查重复再创建,返回友好中文提示(非 500) - 登录支持用户名/手机号/邮箱三种方式 - 前端注册表单增加用户名输入框,预校验 2-20 位格式 - 新增 scripts/deploy.sh:一键构建并部署主站+镜像站+重启后端+重载 Nginx - 镜像站 www.yuzhiran.com.cn Nginx 配置与主站同步 - AI 助手架构升级:用户端/管理后台均采用完整 Tool Calling 架构 - 新增 UserAiAssistantService(18 工具)+ AiAssistantController - admin 助手新增 search + mark-all-notifications-read 工具 - 修复注册 500 错误:catch Prisma P2002 → BadRequestException - Baidu Analytics Script 注入 root layout
56 lines
1.6 KiB
TypeScript
Executable File
56 lines
1.6 KiB
TypeScript
Executable File
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('后台管理页面', () => {
|
|
const adminPages = [
|
|
'/admin',
|
|
'/admin/login',
|
|
'/admin/users',
|
|
'/admin/courses',
|
|
'/admin/prompts',
|
|
'/admin/contents',
|
|
'/admin/tools',
|
|
'/admin/orders',
|
|
'/admin/comments',
|
|
'/admin/enterprise',
|
|
];
|
|
|
|
for (const path of adminPages) {
|
|
test.describe(`${path}`, () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
await page.goto(path);
|
|
});
|
|
|
|
test('页面能正常加载', async ({ page }) => {
|
|
await expect(page.locator('body')).toBeVisible();
|
|
await expect(page.locator('body')).not.toHaveText(/500/);
|
|
await expect(page.locator('body')).not.toHaveText(/Application Error/);
|
|
await expect(page.locator('body')).not.toHaveText(/Cannot read properties/);
|
|
});
|
|
|
|
test('页面有内容展示', async ({ page }) => {
|
|
const anyHeading = page.locator('h1, h2, h3, h4, .text-2xl, .text-3xl');
|
|
const headingCount = await anyHeading.count();
|
|
const bodyText = await page.locator('body').textContent() || '';
|
|
expect(headingCount > 0 || bodyText.length > 50).toBeTruthy();
|
|
});
|
|
});
|
|
}
|
|
|
|
test.describe('管理后台编辑页面', () => {
|
|
const editPages = [
|
|
'/admin/courses/new',
|
|
'/admin/prompts/new',
|
|
'/admin/contents/new',
|
|
'/admin/tools/new',
|
|
];
|
|
|
|
for (const path of editPages) {
|
|
test(`${path} 渲染正常`, async ({ page }) => {
|
|
await page.goto(path);
|
|
await expect(page.locator('body')).toBeVisible();
|
|
await expect(page.locator('body')).not.toHaveText(/500/);
|
|
});
|
|
}
|
|
});
|
|
});
|