feat: Phase 1-3 全部完成 — 沙盒增强、学情分析、学习路径
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
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/);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user