67 lines
2.5 KiB
TypeScript
67 lines
2.5 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
import { CheckInManagementPage } from '../pages/CheckInManagementPage';
|
|
import { StatisticsDashboardPage } from '../pages/StatisticsDashboardPage';
|
|
|
|
test.describe('签到管理和数据统计验证', () => {
|
|
let checkInPage: CheckInManagementPage;
|
|
let statsPage: StatisticsDashboardPage;
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
checkInPage = new CheckInManagementPage(page);
|
|
statsPage = new StatisticsDashboardPage(page);
|
|
});
|
|
|
|
test('签到记录查看', async ({ page }) => {
|
|
await test.step('导航到数据统计页面', async () => {
|
|
await checkInPage.goto();
|
|
});
|
|
|
|
await test.step('验证签到统计区域可见', async () => {
|
|
await checkInPage.verifySignInDataLoaded();
|
|
console.log('签到统计区域数据已加载');
|
|
});
|
|
|
|
await test.step('获取签到数据', async () => {
|
|
const totalSignIns = await checkInPage.getTotalSignIns();
|
|
const successSignIns = await checkInPage.getSuccessSignIns();
|
|
console.log(`总签到: ${totalSignIns}, 成功: ${successSignIns}`);
|
|
});
|
|
});
|
|
|
|
test('数据统计页面数据加载验证', async ({ page }) => {
|
|
await test.step('导航到数据统计页面', async () => {
|
|
await statsPage.goto();
|
|
});
|
|
|
|
await test.step('验证统计卡片加载', async () => {
|
|
await statsPage.verifyStatCardsLoaded();
|
|
const memberCount = await statsPage.getCardValue(0);
|
|
const activeMember = await statsPage.getCardValue(1);
|
|
const bookings = await statsPage.getCardValue(2);
|
|
const violations = await statsPage.getCardValue(3);
|
|
console.log(`会员总数: ${memberCount}, 活跃会员: ${activeMember}, 预约总数: ${bookings}, 教练违规: ${violations}`);
|
|
});
|
|
|
|
await test.step('验证详细统计区域加载', async () => {
|
|
await statsPage.verifySectionCardsLoaded();
|
|
});
|
|
|
|
await test.step('切换统计区间', async () => {
|
|
await statsPage.switchRange('本周');
|
|
console.log('已切换到本周统计');
|
|
});
|
|
|
|
await test.step('验证切换区间后卡片仍可见', async () => {
|
|
await expect(statsPage.statCards.first()).toBeVisible({ timeout: 10000 });
|
|
console.log('切换区间后数据已刷新');
|
|
});
|
|
|
|
await test.step('切换到教练业绩Tab', async () => {
|
|
await statsPage.switchTab('教练业绩');
|
|
const coachTable = page.locator('.el-table');
|
|
await expect(coachTable).toBeVisible({ timeout: 10000 });
|
|
console.log('教练业绩Tab数据已加载');
|
|
});
|
|
});
|
|
});
|