feat: 添加异常日志功能并优化UI样式

refactor: 重构后端查询逻辑和API响应处理

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

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

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

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

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

perf: 优化前端页面加载速度和响应时间
This commit is contained in:
张翔
2026-03-24 13:32:20 +08:00
parent a97d317e4a
commit be5d5ede90
184 changed files with 11231 additions and 1903 deletions
+30 -10
View File
@@ -10,10 +10,10 @@ export class LoginPage {
constructor(page: Page) {
this.page = page;
this.usernameInput = page.locator('input[placeholder*="用户名"]').or(page.locator('.el-input__inner[placeholder*="用户名"]'));
this.passwordInput = page.locator('input[type="password"]').or(page.locator('.el-input__inner[type="password"]'));
this.loginButton = page.locator('button[type="submit"]').or(page.locator('button:has-text("登录")'));
this.errorMessage = page.locator('.el-message--error').or(page.locator('.error-message'));
this.usernameInput = page.locator('input[placeholder="请输入用户名"]');
this.passwordInput = page.locator('input[placeholder="请输入密码"]');
this.loginButton = page.locator('button:has-text("登录")');
this.errorMessage = page.locator('.el-message--error .el-message__content');
this.logoutButton = page.getByRole('button', { name: '退出登录' });
}
@@ -23,25 +23,45 @@ export class LoginPage {
}
async login(username: string, password: string) {
console.log('Starting login process...');
await this.usernameInput.fill(username);
await this.passwordInput.fill(password);
console.log('Filled username and password');
await this.loginButton.click();
console.log('Clicked login button');
try {
await this.page.waitForURL('**/dashboard', { timeout: 10000 });
} catch {
console.log('Successfully navigated to dashboard');
await this.page.waitForLoadState('networkidle');
console.log('Network idle achieved');
await this.page.waitForTimeout(2000);
console.log('Wait completed');
} catch (error) {
console.log('Login failed or timeout:', error);
const currentUrl = this.page.url();
console.log('Current URL:', currentUrl);
await this.page.waitForTimeout(1000);
}
}
async getErrorMessage(): Promise<string | null> {
try {
await this.page.waitForSelector('.el-message', { timeout: 3000 });
const messageElement = await this.page.locator('.el-message').first();
await this.page.waitForSelector('.el-message--error', { timeout: 10000 });
await this.page.waitForTimeout(500);
const messageElement = await this.page.locator('.el-message--error .el-message__content').first();
const text = await messageElement.textContent();
return text;
} catch {
return null;
try {
await this.page.waitForSelector('.el-message', { timeout: 5000 });
await this.page.waitForTimeout(500);
const messageElement = await this.page.locator('.el-message .el-message__content').first();
const text = await messageElement.textContent();
return text;
} catch {
return null;
}
}
}
@@ -49,7 +69,7 @@ export class LoginPage {
const avatar = this.page.locator('.el-avatar');
await avatar.click();
await this.page.waitForTimeout(1000);
const logoutButton = this.page.locator('.el-dropdown-menu').getByText('退出登录');
await logoutButton.click();
await this.page.waitForURL('**/login', { timeout: 10000 });