test: E2E 测试用例更新与新增
- 更新 Page Object 模型适配新字段名 - 新增 UAT 测试套件与 journey 测试用例 - 优化测试辅助工具与数据工厂 - 更新 playwright 认证状态
This commit is contained in:
@@ -15,16 +15,16 @@ export class DashboardPage {
|
||||
|
||||
constructor(page: Page) {
|
||||
this.page = page;
|
||||
this.userInfo = page.locator('.el-avatar');
|
||||
this.userManagementLink = page.locator('.el-menu-item:has-text("用户管理")');
|
||||
this.roleManagementLink = page.locator('.el-menu-item:has-text("角色管理")');
|
||||
this.menuManagementLink = page.locator('.el-menu-item:has-text("菜单管理")');
|
||||
this.systemConfigLink = page.locator('.el-menu-item:has-text("参数配置")');
|
||||
this.noticeManagementLink = page.locator('.el-menu-item:has-text("通知公告")');
|
||||
this.fileManagementLink = page.locator('.el-menu-item:has-text("文件列表")');
|
||||
this.operationLogLink = page.locator('.el-menu-item:has-text("操作日志")');
|
||||
this.loginLogLink = page.locator('.el-menu-item:has-text("登录日志")');
|
||||
this.dictionaryLink = page.locator('.el-menu-item:has-text("字典管理")');
|
||||
this.userInfo = page.locator('.ant-avatar');
|
||||
this.userManagementLink = page.locator('.ant-menu-item:has-text("用户管理")');
|
||||
this.roleManagementLink = page.locator('.ant-menu-item:has-text("角色管理")');
|
||||
this.menuManagementLink = page.locator('.ant-menu-item:has-text("菜单管理")');
|
||||
this.systemConfigLink = page.locator('.ant-menu-item:has-text("参数配置")');
|
||||
this.noticeManagementLink = page.locator('.ant-menu-item:has-text("通知公告")');
|
||||
this.fileManagementLink = page.locator('.ant-menu-item:has-text("文件列表")');
|
||||
this.operationLogLink = page.locator('.ant-menu-item:has-text("操作日志")');
|
||||
this.loginLogLink = page.locator('.ant-menu-item:has-text("登录日志")');
|
||||
this.dictionaryLink = page.locator('.ant-menu-item:has-text("字典管理")');
|
||||
}
|
||||
|
||||
async goto() {
|
||||
@@ -33,97 +33,76 @@ export class DashboardPage {
|
||||
}
|
||||
|
||||
async navigateToUserManagement() {
|
||||
const systemMenu = this.page.locator('.el-sub-menu__title:has-text("系统管理")');
|
||||
await systemMenu.click();
|
||||
await this.page.waitForTimeout(1000);
|
||||
await this.clickSubMenu('系统管理');
|
||||
await this.userManagementLink.click();
|
||||
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(1000);
|
||||
await this.clickSubMenu('系统管理');
|
||||
await this.roleManagementLink.click();
|
||||
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(1000);
|
||||
await this.clickSubMenu('系统管理');
|
||||
await this.menuManagementLink.click();
|
||||
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(1000);
|
||||
await this.clickSubMenu('系统配置');
|
||||
await this.systemConfigLink.click();
|
||||
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(1000);
|
||||
await this.clickSubMenu('通知中心');
|
||||
await this.noticeManagementLink.click();
|
||||
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(1000);
|
||||
await this.clickSubMenu('文件管理');
|
||||
await this.fileManagementLink.click();
|
||||
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(1000);
|
||||
}
|
||||
|
||||
async navigateToOperationLog() {
|
||||
await this.navigateToAudit();
|
||||
await this.clickSubMenu('审计中心');
|
||||
await this.operationLogLink.click();
|
||||
await this.page.waitForURL('**/oplog', { timeout: 30000 });
|
||||
await this.page.waitForLoadState('networkidle');
|
||||
}
|
||||
|
||||
async navigateToLoginLog() {
|
||||
await this.navigateToAudit();
|
||||
await this.clickSubMenu('审计中心');
|
||||
await this.loginLogLink.click();
|
||||
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(1000);
|
||||
await this.noticeManagementLink.click();
|
||||
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(1000);
|
||||
await this.clickSubMenu('系统配置');
|
||||
await this.dictionaryLink.click();
|
||||
await this.page.waitForURL('**/dict', { timeout: 30000 });
|
||||
await this.page.waitForLoadState('networkidle');
|
||||
}
|
||||
|
||||
private async clickSubMenu(label: string) {
|
||||
const subMenu = this.page.locator(`.ant-menu-submenu-title:has-text("${label}")`);
|
||||
if (await subMenu.isVisible()) {
|
||||
await subMenu.click();
|
||||
await this.page.waitForTimeout(500);
|
||||
}
|
||||
}
|
||||
|
||||
async getUsername(): Promise<string | null> {
|
||||
return await this.userInfo.textContent();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user