feat: 更新UAT测试配置和修复数据库连接问题
refactor(测试): 重构用户数据加载逻辑以支持数组格式 fix(数据库): 修正数据库连接配置和凭证 test: 添加新的导航和用户管理测试场景 docs: 生成UAT测试报告和最终报告 ci: 更新Woodpecker CI配置和测试命令 build: 添加application-test.yml配置文件 chore: 清理旧的测试场景文件
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { LoginPage } from '../../novalon-manage-web/e2e/pages/LoginPage';
|
||||
|
||||
test.describe('UAT - 系统导航和菜单', () => {
|
||||
let loginPage: LoginPage;
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
loginPage = new LoginPage(page);
|
||||
await loginPage.goto();
|
||||
});
|
||||
|
||||
test('Dashboard页面可访问', async ({ page }) => {
|
||||
await loginPage.login('admin', 'admin123');
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
await page.goto('http://localhost:3003/dashboard');
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
const currentUrl = page.url();
|
||||
console.log('当前URL:', currentUrl);
|
||||
|
||||
expect(currentUrl).toContain('/dashboard');
|
||||
});
|
||||
|
||||
test('主要菜单项可访问', async ({ page }) => {
|
||||
await loginPage.login('admin', 'admin123');
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
const menuItems = [
|
||||
{ path: '/users', name: '用户管理' },
|
||||
{ path: '/roles', name: '角色管理' },
|
||||
{ path: '/menus', name: '菜单管理' },
|
||||
{ path: '/sys/config', name: '系统配置' },
|
||||
{ path: '/dict', name: '字典管理' }
|
||||
];
|
||||
|
||||
for (const item of menuItems) {
|
||||
console.log(`测试菜单: ${item.name}`);
|
||||
|
||||
await page.goto(`http://localhost:3003${item.path}`);
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
const currentUrl = page.url();
|
||||
expect(currentUrl).toContain(item.path);
|
||||
|
||||
const pageTitle = await page.title();
|
||||
console.log(` 页面标题: ${pageTitle}`);
|
||||
|
||||
expect(pageTitle).toBeTruthy();
|
||||
}
|
||||
});
|
||||
|
||||
test('侧边栏导航功能', async ({ page }) => {
|
||||
await loginPage.login('admin', 'admin123');
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
const sidebar = page.locator('.el-aside, .sidebar, [class*="sidebar"]');
|
||||
const sidebarVisible = await sidebar.count() > 0;
|
||||
|
||||
console.log('侧边栏存在:', sidebarVisible);
|
||||
|
||||
if (sidebarVisible) {
|
||||
const menuItems = sidebar.locator('a, .el-menu-item');
|
||||
const itemCount = await menuItems.count();
|
||||
console.log('菜单项数量:', itemCount);
|
||||
|
||||
expect(itemCount).toBeGreaterThan(0);
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user