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