新增 10 个管理端 E2E 测试文件和 1 个 Mock fixture: - admin.fixture.ts: Mock 数据 + 登录注入 + 组件预热 + 兜底 API 拦截 - login/contests/dashboard/navigation/registrations/works/reviews/users 等 9 个 spec 关键修复:route.fallback() 替代 route.continue() 修正 Mock 链式传递; review-rules/select Mock + 兜底拦截器防止未 mock 请求到达真实后端。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
62 lines
2.3 KiB
TypeScript
62 lines
2.3 KiB
TypeScript
import { test, expect } from '../fixtures/admin.fixture'
|
|
|
|
/**
|
|
* 评审管理测试
|
|
*/
|
|
|
|
test.describe('评审管理', () => {
|
|
test.beforeEach(async ({ adminPage }) => {
|
|
const page = adminPage
|
|
|
|
// 导航到活动管理 > 评审规则
|
|
const submenu = page.locator('.ant-menu-submenu').filter({ hasText: '活动管理' }).first()
|
|
await submenu.click()
|
|
await page.waitForTimeout(500)
|
|
await submenu.locator('.ant-menu-item').filter({ hasText: '评审规则' }).first().click()
|
|
await page.waitForURL(/contests\/reviews/, { timeout: 10_000 })
|
|
})
|
|
|
|
test('RV-01 评审规则列表正常加载', async ({ adminPage }) => {
|
|
const page = adminPage
|
|
|
|
// 验证页面内容加载
|
|
await expect(page.locator('.ant-table, .ant-card, .reviews-page').first()).toBeVisible({ timeout: 10_000 })
|
|
})
|
|
|
|
test('RV-02 新建评审规则弹窗', async ({ adminPage }) => {
|
|
const page = adminPage
|
|
|
|
// 查找新建/创建按钮
|
|
const createBtn = page.locator('button:has-text("新建"), button:has-text("创建"), button:has-text("添加")').first()
|
|
if (await createBtn.isVisible({ timeout: 5000 }).catch(() => false)) {
|
|
await createBtn.click()
|
|
|
|
// 验证弹窗/抽屉出现
|
|
await expect(page.locator('.ant-modal, .ant-drawer').first()).toBeVisible({ timeout: 5000 })
|
|
|
|
// 验证表单字段
|
|
const nameInput = page.locator('.ant-modal input, .ant-drawer input').first()
|
|
if (await nameInput.isVisible()) {
|
|
await nameInput.fill('E2E测试评审规则')
|
|
await expect(nameInput).toHaveValue('E2E测试评审规则')
|
|
}
|
|
}
|
|
})
|
|
|
|
test('RV-03 评委管理页面', async ({ adminPage }) => {
|
|
const page = adminPage
|
|
|
|
// 导航到评委管理
|
|
const submenu = page.locator('.ant-menu-submenu').filter({ hasText: '活动管理' }).first()
|
|
// 先确认子菜单已展开,再找评委管理
|
|
const judgeItem = submenu.locator('.ant-menu-item').filter({ hasText: '评委管理' }).first()
|
|
if (await judgeItem.isVisible({ timeout: 3000 }).catch(() => false)) {
|
|
await judgeItem.click()
|
|
await page.waitForURL(/contests\/judges/, { timeout: 10_000 })
|
|
|
|
// 验证页面加载
|
|
await expect(page.locator('.ant-table, .ant-card').first()).toBeVisible({ timeout: 10_000 })
|
|
}
|
|
})
|
|
})
|