5237dfc1cb
- e2e-tests API 路径统一更新为 /api/admin/ 和 /api/member/ 前缀 - Gateway isPublicPath 更新为 /api/admin/auth/ 和 /api/member/auth/ - Gateway 签名白名单路径更新 - 移除已废弃的 /api/checkIn/ 和 /api/auth/login 公开路径
64 lines
1.8 KiB
TypeScript
64 lines
1.8 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('字典管理功能测试', () => {
|
|
let authToken: string;
|
|
|
|
test.beforeAll(async ({ request }) => {
|
|
const response = await request.post('http://localhost:8080/api/admin/auth/login', {
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
username: 'admin',
|
|
password: 'Test@123'
|
|
}
|
|
});
|
|
|
|
expect(response.status()).toBe(200);
|
|
const data = await response.json();
|
|
authToken = data.token;
|
|
});
|
|
|
|
test('字典管理列表显示测试', async ({ page }) => {
|
|
await test.step('导航到字典管理页面', async () => {
|
|
await page.goto('http://localhost:3002/');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
// 点击系统管理菜单
|
|
const systemMenu = page.locator('.el-sub-menu:has-text("系统管理")').first();
|
|
if (await systemMenu.count() > 0) {
|
|
await systemMenu.click();
|
|
await page.waitForTimeout(500);
|
|
}
|
|
|
|
// 点击字典管理
|
|
const dictManagement = page.locator('.el-menu-item:has-text("字典管理")').first();
|
|
if (await dictManagement.count() > 0) {
|
|
await dictManagement.click();
|
|
await page.waitForTimeout(1000);
|
|
}
|
|
});
|
|
|
|
await test.step('验证字典管理列表显示', async () => {
|
|
// 检查是否有字典管理列表或表格
|
|
const tableSelectors = [
|
|
'table',
|
|
'.el-table',
|
|
'[class*="table"]',
|
|
'.dict-list'
|
|
];
|
|
|
|
let foundTable = false;
|
|
for (const selector of tableSelectors) {
|
|
const count = await page.locator(selector).count();
|
|
if (count > 0) {
|
|
foundTable = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
expect(foundTable).toBe(true);
|
|
});
|
|
});
|
|
});
|