新增e2e测试脚本,修复部分问题

This commit was merged in pull request #51.
This commit is contained in:
2026-07-22 20:00:13 +08:00
parent 53d1ce6fb2
commit 4c07ec5455
105 changed files with 21700 additions and 318 deletions
@@ -0,0 +1,66 @@
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数据已加载');
});
});
});