|
@@ -27,21 +27,31 @@ export class DashboardPage {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async navigateToUserManagement() {
|
|
async navigateToUserManagement() {
|
|
|
- await this.userManagementCard.click();
|
|
|
|
|
|
|
+ // 使用更具体的定位器来避免重复元素问题
|
|
|
|
|
+ const userManagementCard = this.page.locator('text=用户管理').first();
|
|
|
|
|
+ await userManagementCard.click();
|
|
|
await this.page.waitForLoadState('networkidle');
|
|
await this.page.waitForLoadState('networkidle');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async navigateToSystemSettings() {
|
|
async navigateToSystemSettings() {
|
|
|
- await this.systemSettingsCard.click();
|
|
|
|
|
|
|
+ // 使用更具体的定位器来避免重复元素问题
|
|
|
|
|
+ const systemSettingsCard = this.page.locator('text=系统设置').first();
|
|
|
|
|
+ await systemSettingsCard.click();
|
|
|
await this.page.waitForLoadState('networkidle');
|
|
await this.page.waitForLoadState('networkidle');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async getActiveUsersCount(): Promise<string> {
|
|
async getActiveUsersCount(): Promise<string> {
|
|
|
- return await this.activeUsersCard.locator('xpath=following-sibling::div//div[contains(@class, "text-2xl")]').textContent() || '';
|
|
|
|
|
|
|
+ // 使用更可靠的定位器来获取活跃用户统计数字
|
|
|
|
|
+ const countElement = this.page.locator('text=活跃用户').locator('xpath=following::div[contains(@class, "text-2xl")][1]');
|
|
|
|
|
+ await expect(countElement).toBeVisible({ timeout: 10000 });
|
|
|
|
|
+ return await countElement.textContent() || '';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async getSystemMessagesCount(): Promise<string> {
|
|
async getSystemMessagesCount(): Promise<string> {
|
|
|
- return await this.systemMessagesCard.locator('xpath=following-sibling::div//div[contains(@class, "text-2xl")]').textContent() || '';
|
|
|
|
|
|
|
+ // 使用更可靠的定位器来获取系统消息统计数字
|
|
|
|
|
+ const countElement = this.page.locator('text=系统消息').locator('xpath=following::div[contains(@class, "text-2xl")][1]');
|
|
|
|
|
+ await expect(countElement).toBeVisible({ timeout: 10000 });
|
|
|
|
|
+ return await countElement.textContent() || '';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async logout() {
|
|
async logout() {
|