|
|
@@ -13,64 +13,66 @@ test.describe('管理后台仪表盘', () => {
|
|
|
await dashboardPage.expectToBeVisible();
|
|
|
});
|
|
|
|
|
|
- // test('查看活跃用户统计', async ({ dashboardPage }) => {
|
|
|
- // const activeUsersCount = await dashboardPage.getActiveUsersCount();
|
|
|
- // expect(activeUsersCount).toBeTruthy();
|
|
|
- // expect(parseInt(activeUsersCount) >= 0).toBeTruthy();
|
|
|
- // });
|
|
|
+ test('查看活跃用户统计', async ({ dashboardPage }) => {
|
|
|
+ const activeUsersCount = await dashboardPage.getActiveUsersCount();
|
|
|
+ expect(activeUsersCount).toBeTruthy();
|
|
|
+ expect(parseInt(activeUsersCount) >= 0).toBeTruthy();
|
|
|
+ });
|
|
|
|
|
|
- // test('查看系统消息统计', async ({ dashboardPage }) => {
|
|
|
- // const systemMessagesCount = await dashboardPage.getSystemMessagesCount();
|
|
|
- // expect(systemMessagesCount).toBeTruthy();
|
|
|
- // expect(parseInt(systemMessagesCount) >= 0).toBeTruthy();
|
|
|
- // });
|
|
|
+ test('查看系统消息统计', async ({ dashboardPage }) => {
|
|
|
+ const systemMessagesCount = await dashboardPage.getSystemMessagesCount();
|
|
|
+ expect(systemMessagesCount).toBeTruthy();
|
|
|
+ expect(parseInt(systemMessagesCount) >= 0).toBeTruthy();
|
|
|
+ });
|
|
|
|
|
|
- // test('导航到用户管理', async ({ dashboardPage, userManagementPage }) => {
|
|
|
- // await dashboardPage.navigateToUserManagement();
|
|
|
- // await userManagementPage.expectToBeVisible();
|
|
|
- // });
|
|
|
+ test('导航到用户管理', async ({ dashboardPage, userManagementPage }) => {
|
|
|
+ await dashboardPage.navigateToUserManagement();
|
|
|
+ await userManagementPage.expectToBeVisible();
|
|
|
+ });
|
|
|
|
|
|
- // test('导航到系统设置', async ({ dashboardPage, page }) => {
|
|
|
- // await dashboardPage.navigateToSystemSettings();
|
|
|
- // await expect(page).toHaveURL(/.*settings.*/);
|
|
|
- // await expect(page.getByRole('heading', { name: /系统设置|设置/i })).toBeVisible();
|
|
|
- // });
|
|
|
+ test('导航到系统设置', async ({ dashboardPage, page }) => {
|
|
|
+ await dashboardPage.navigateToSystemSettings();
|
|
|
+ await expect(page).toHaveURL(/.*settings.*/);
|
|
|
+ await expect(page.getByRole('heading', { name: /系统设置|设置/i })).toBeVisible();
|
|
|
+ });
|
|
|
|
|
|
- // test('仪表盘数据刷新', async ({ dashboardPage, page }) => {
|
|
|
- // const initialActiveUsers = await dashboardPage.getActiveUsersCount();
|
|
|
+ test('仪表盘数据刷新', async ({ dashboardPage, page }) => {
|
|
|
+ // 获取初始数据
|
|
|
+ await dashboardPage.expectToBeVisible();
|
|
|
|
|
|
- // // 刷新页面
|
|
|
- // await page.reload();
|
|
|
- // await dashboardPage.expectToBeVisible();
|
|
|
+ // 刷新页面
|
|
|
+ await page.reload();
|
|
|
+ await dashboardPage.expectToBeVisible();
|
|
|
|
|
|
- // const refreshedActiveUsers = await dashboardPage.getActiveUsersCount();
|
|
|
- // expect(refreshedActiveUsers).toBeTruthy();
|
|
|
- // });
|
|
|
+ // 验证刷新后数据仍然存在
|
|
|
+ const refreshedActiveUsers = await dashboardPage.getActiveUsersCount();
|
|
|
+ expect(refreshedActiveUsers).toBeTruthy();
|
|
|
+ });
|
|
|
|
|
|
- // test('响应式布局 - 桌面端', async ({ dashboardPage, page }) => {
|
|
|
- // await page.setViewportSize({ width: 1200, height: 800 });
|
|
|
- // await dashboardPage.expectToBeVisible();
|
|
|
+ test('响应式布局 - 桌面端', async ({ dashboardPage, page }) => {
|
|
|
+ await page.setViewportSize({ width: 1200, height: 800 });
|
|
|
+ await dashboardPage.expectToBeVisible();
|
|
|
|
|
|
- // // 验证桌面端布局元素
|
|
|
- // await expect(dashboardPage.activeUsersCard).toBeVisible();
|
|
|
- // await expect(dashboardPage.systemMessagesCard).toBeVisible();
|
|
|
- // await expect(dashboardPage.onlineUsersCard).toBeVisible();
|
|
|
- // });
|
|
|
+ // 验证桌面端布局元素
|
|
|
+ await expect(dashboardPage.activeUsersCard).toBeVisible();
|
|
|
+ await expect(dashboardPage.systemMessagesCard).toBeVisible();
|
|
|
+ await expect(dashboardPage.onlineUsersCard).toBeVisible();
|
|
|
+ });
|
|
|
|
|
|
- // test('响应式布局 - 平板端', async ({ dashboardPage, page }) => {
|
|
|
- // await page.setViewportSize({ width: 768, height: 1024 });
|
|
|
- // await dashboardPage.expectToBeVisible();
|
|
|
+ test('响应式布局 - 平板端', async ({ dashboardPage, page }) => {
|
|
|
+ await page.setViewportSize({ width: 768, height: 1024 });
|
|
|
+ await dashboardPage.expectToBeVisible();
|
|
|
|
|
|
- // // 验证平板端布局
|
|
|
- // await expect(dashboardPage.activeUsersCard).toBeVisible();
|
|
|
- // await expect(dashboardPage.systemMessagesCard).toBeVisible();
|
|
|
- // });
|
|
|
+ // 验证平板端布局
|
|
|
+ await expect(dashboardPage.activeUsersCard).toBeVisible();
|
|
|
+ await expect(dashboardPage.systemMessagesCard).toBeVisible();
|
|
|
+ });
|
|
|
|
|
|
- // test('响应式布局 - 移动端', async ({ dashboardPage, page }) => {
|
|
|
- // await page.setViewportSize({ width: 375, height: 667 });
|
|
|
- // await dashboardPage.expectToBeVisible();
|
|
|
+ test('响应式布局 - 移动端', async ({ dashboardPage, page }) => {
|
|
|
+ await page.setViewportSize({ width: 375, height: 667 });
|
|
|
+ await dashboardPage.expectToBeVisible();
|
|
|
|
|
|
- // // 验证移动端布局
|
|
|
- // await expect(dashboardPage.pageTitle).toBeVisible();
|
|
|
- // });
|
|
|
+ // 验证移动端布局
|
|
|
+ await expect(dashboardPage.pageTitle).toBeVisible();
|
|
|
+ });
|
|
|
});
|