Files
novalon-manage-system/novalon-manage-web/e2e/pages/DashboardPage.ts
T
张翔 be5d5ede90 feat: 添加异常日志功能并优化UI样式
refactor: 重构后端查询逻辑和API响应处理

fix: 修复用户角色更新和文件上传问题

test: 添加前端性能测试脚本和E2E测试用例

chore: 更新依赖版本和配置文件

docs: 添加环境检查脚本和测试文档

style: 统一表格标签样式和路由命名

perf: 优化前端页面加载速度和响应时间
2026-03-24 13:32:20 +08:00

103 lines
3.4 KiB
TypeScript

import { Page, Locator } from '@playwright/test';
export class DashboardPage {
readonly page: Page;
readonly userInfo: Locator;
readonly userManagementLink: Locator;
readonly roleManagementLink: Locator;
readonly menuManagementLink: Locator;
readonly systemConfigLink: Locator;
readonly noticeManagementLink: Locator;
readonly fileManagementLink: Locator;
readonly operationLogLink: Locator;
readonly loginLogLink: Locator;
constructor(page: Page) {
this.page = page;
this.userInfo = page.locator('.el-avatar');
this.userManagementLink = page.getByRole('menuitem', { name: '用户管理' });
this.roleManagementLink = page.getByRole('menuitem', { name: '角色管理' });
this.menuManagementLink = page.getByRole('menuitem', { name: '菜单管理' });
this.systemConfigLink = page.getByRole('menuitem', { name: '参数配置' });
this.noticeManagementLink = page.getByRole('menuitem', { name: '通知公告' });
this.fileManagementLink = page.getByRole('menuitem', { name: '文件列表' });
this.operationLogLink = page.getByRole('menuitem', { name: '操作日志' });
this.loginLogLink = page.getByRole('menuitem', { name: '登录日志' });
}
async goto() {
await this.page.goto('/dashboard');
await this.page.waitForLoadState('networkidle');
}
async navigateToUserManagement() {
const systemMenu = this.page.locator('text=系统管理');
await systemMenu.click();
await this.page.waitForTimeout(500);
await this.userManagementLink.click();
await this.page.waitForURL('**/users');
}
async navigateToRoleManagement() {
const systemMenu = this.page.locator('text=系统管理');
await systemMenu.click();
await this.page.waitForTimeout(500);
await this.roleManagementLink.click();
await this.page.waitForURL('**/roles');
}
async navigateToMenuManagement() {
const systemMenu = this.page.locator('text=系统管理');
await systemMenu.click();
await this.page.waitForTimeout(500);
await this.menuManagementLink.click();
await this.page.waitForURL('**/menus');
}
async navigateToSystemConfig() {
const configMenu = this.page.locator('text=系统配置');
await configMenu.click();
await this.page.waitForTimeout(500);
await this.systemConfigLink.click();
await this.page.waitForURL('**/sysconfig');
}
async navigateToNoticeManagement() {
const notifyMenu = this.page.locator('text=通知中心');
await notifyMenu.click();
await this.page.waitForTimeout(500);
await this.noticeManagementLink.click();
await this.page.waitForURL('**/notice');
}
async navigateToFileManagement() {
const fileMenu = this.page.locator('text=文件管理');
await fileMenu.click();
await this.page.waitForTimeout(500);
await this.fileManagementLink.click();
await this.page.waitForURL('**/files');
}
async navigateToAudit() {
const auditMenu = this.page.locator('text=审计中心');
await auditMenu.click();
await this.page.waitForTimeout(500);
}
async navigateToOperationLog() {
await this.navigateToAudit();
await this.operationLogLink.click();
await this.page.waitForURL('**/oplog');
}
async navigateToLoginLog() {
await this.navigateToAudit();
await this.loginLogLink.click();
await this.page.waitForURL('**/loginlog');
}
async getUsername(): Promise<string | null> {
return await this.userInfo.textContent();
}
}