import { test, expect } from '@playwright/test'; import { GroupCourseManagementPage } from '../pages/GroupCourseManagementPage'; import { CourseTypeManagementPage } from '../pages/CourseTypeManagementPage'; import { CourseLabelManagementPage } from '../pages/CourseLabelManagementPage'; import { CourseRecommendManagementPage } from '../pages/CourseRecommendManagementPage'; test.describe('团课管理工作流', () => { let coursePage: GroupCourseManagementPage; test.beforeEach(async ({ page }) => { coursePage = new GroupCourseManagementPage(page); }); test('查看团课列表', async () => { await test.step('导航到团课管理页面', async () => { await coursePage.goto(); }); await test.step('验证表格加载', async () => { await expect(coursePage.table).toBeVisible({ timeout: 10000 }); await coursePage.waitForTableReady(); const rowCount = await coursePage.getRowCount(); console.log(`团课列表包含 ${rowCount} 条记录`); expect(rowCount).toBeGreaterThanOrEqual(0); }); }); test('搜索团课', async () => { await test.step('导航到团课管理页面', async () => { await coursePage.goto(); }); await test.step('执行搜索', async () => { await coursePage.waitForTableReady(); await coursePage.search('瑜伽'); await coursePage.page.waitForTimeout(500); }); await test.step('验证搜索结果', async () => { const rowCount = await coursePage.getRowCount(); console.log(`搜索结果: ${rowCount} 条记录`); expect(rowCount).toBeGreaterThanOrEqual(0); }); }); }); test.describe('团课类型管理工作流', () => { let typePage: CourseTypeManagementPage; test.beforeEach(async ({ page }) => { typePage = new CourseTypeManagementPage(page); }); test('查看团课类型列表', async () => { await test.step('导航到团课类型页面', async () => { await typePage.goto(); }); await test.step('验证表格加载', async () => { await expect(typePage.table).toBeVisible({ timeout: 10000 }); await typePage.waitForTableReady(); const rowCount = await typePage.getRowCount(); console.log(`团课类型列表包含 ${rowCount} 条记录`); expect(rowCount).toBeGreaterThanOrEqual(0); }); }); }); test.describe('团课标签管理工作流', () => { let labelPage: CourseLabelManagementPage; test.beforeEach(async ({ page }) => { labelPage = new CourseLabelManagementPage(page); }); test('查看团课标签列表', async () => { await test.step('导航到团课标签页面', async () => { await labelPage.goto(); }); await test.step('验证表格加载', async () => { await expect(labelPage.table).toBeVisible({ timeout: 10000 }); await labelPage.waitForTableReady(); const rowCount = await labelPage.getRowCount(); console.log(`团课标签列表包含 ${rowCount} 条记录`); expect(rowCount).toBeGreaterThanOrEqual(0); }); }); }); test.describe('团课推荐管理工作流', () => { let recPage: CourseRecommendManagementPage; test.beforeEach(async ({ page }) => { recPage = new CourseRecommendManagementPage(page); }); test('查看团课推荐列表', async () => { await test.step('导航到团课推荐页面', async () => { await recPage.goto(); }); await test.step('验证表格加载', async () => { await expect(recPage.table).toBeVisible({ timeout: 10000 }); await recPage.waitForTableReady(); const rowCount = await recPage.getRowCount(); console.log(`团课推荐列表包含 ${rowCount} 条记录`); expect(rowCount).toBeGreaterThanOrEqual(0); }); }); });