feat(登录): 添加路由守卫和异步导航处理

fix(表单验证): 为用户、角色和菜单管理添加表单验证规则

test(e2e): 增加页面导航超时时间和网络空闲等待

refactor(数据库): 移除Flyway配置并更新数据源配置
This commit is contained in:
张翔
2026-03-27 14:40:55 +08:00
parent af44c23f21
commit a05368d306
9 changed files with 168 additions and 58 deletions
+29 -19
View File
@@ -35,83 +35,93 @@ export class DashboardPage {
async navigateToUserManagement() {
const systemMenu = this.page.locator('.el-sub-menu__title:has-text("系统管理")');
await systemMenu.click();
await this.page.waitForTimeout(500);
await this.page.waitForTimeout(1000);
await this.userManagementLink.click();
await this.page.waitForURL('**/users', { timeout: 10000 });
await this.page.waitForURL('**/users', { timeout: 30000 });
await this.page.waitForLoadState('networkidle');
}
async navigateToRoleManagement() {
const systemMenu = this.page.locator('.el-sub-menu__title:has-text("系统管理")');
await systemMenu.click();
await this.page.waitForTimeout(500);
await this.page.waitForTimeout(1000);
await this.roleManagementLink.click();
await this.page.waitForURL('**/roles', { timeout: 10000 });
await this.page.waitForURL('**/roles', { timeout: 30000 });
await this.page.waitForLoadState('networkidle');
}
async navigateToMenuManagement() {
const systemMenu = this.page.locator('.el-sub-menu__title:has-text("系统管理")');
await systemMenu.click();
await this.page.waitForTimeout(500);
await this.page.waitForTimeout(1000);
await this.menuManagementLink.click();
await this.page.waitForURL('**/menus', { timeout: 10000 });
await this.page.waitForURL('**/menus', { timeout: 30000 });
await this.page.waitForLoadState('networkidle');
}
async navigateToSystemConfig() {
const configMenu = this.page.locator('.el-sub-menu__title:has-text("系统配置")');
await configMenu.click();
await this.page.waitForTimeout(500);
await this.page.waitForTimeout(1000);
await this.systemConfigLink.click();
await this.page.waitForURL('**/sys/config', { timeout: 10000 });
await this.page.waitForURL('**/sys/config', { timeout: 30000 });
await this.page.waitForLoadState('networkidle');
}
async navigateToNoticeManagement() {
const notifyMenu = this.page.locator('.el-sub-menu__title:has-text("通知中心")');
await notifyMenu.click();
await this.page.waitForTimeout(500);
await this.page.waitForTimeout(1000);
await this.noticeManagementLink.click();
await this.page.waitForURL('**/notice', { timeout: 10000 });
await this.page.waitForURL('**/notice', { timeout: 30000 });
await this.page.waitForLoadState('networkidle');
}
async navigateToFileManagement() {
const fileMenu = this.page.locator('.el-sub-menu__title:has-text("文件管理")');
await fileMenu.click();
await this.page.waitForTimeout(500);
await this.page.waitForTimeout(1000);
await this.fileManagementLink.click();
await this.page.waitForURL('**/files', { timeout: 10000 });
await this.page.waitForURL('**/files', { timeout: 30000 });
await this.page.waitForLoadState('networkidle');
}
async navigateToAudit() {
const auditMenu = this.page.locator('.el-sub-menu__title:has-text("审计中心")');
await auditMenu.click();
await this.page.waitForTimeout(500);
await this.page.waitForTimeout(1000);
}
async navigateToOperationLog() {
await this.navigateToAudit();
await this.operationLogLink.click();
await this.page.waitForURL('**/oplog', { timeout: 10000 });
await this.page.waitForURL('**/oplog', { timeout: 30000 });
await this.page.waitForLoadState('networkidle');
}
async navigateToLoginLog() {
await this.navigateToAudit();
await this.loginLogLink.click();
await this.page.waitForURL('**/loginlog', { timeout: 10000 });
await this.page.waitForURL('**/loginlog', { timeout: 30000 });
await this.page.waitForLoadState('networkidle');
}
async navigateToNotification() {
const notifyMenu = this.page.locator('.el-sub-menu__title:has-text("通知中心")');
await notifyMenu.click();
await this.page.waitForTimeout(500);
await this.page.waitForTimeout(1000);
await this.noticeManagementLink.click();
await this.page.waitForURL('**/notification', { timeout: 10000 });
await this.page.waitForURL('**/notification', { timeout: 30000 });
await this.page.waitForLoadState('networkidle');
}
async navigateToDictionary() {
const configMenu = this.page.locator('.el-sub-menu__title:has-text("系统配置")');
await configMenu.click();
await this.page.waitForTimeout(500);
await this.page.waitForTimeout(1000);
await this.dictionaryLink.click();
await this.page.waitForURL('**/dict', { timeout: 10000 });
await this.page.waitForURL('**/dict', { timeout: 30000 });
await this.page.waitForLoadState('networkidle');
}
async getUsername(): Promise<string | null> {
+1 -1
View File
@@ -31,7 +31,7 @@ export class LoginPage {
console.log('Clicked login button');
try {
await this.page.waitForURL('**/dashboard', { timeout: 10000 });
await this.page.waitForURL('**/dashboard', { timeout: 30000 });
console.log('Successfully navigated to dashboard');
await this.page.waitForLoadState('networkidle');
console.log('Network idle achieved');