前后端目录重命名: - reading-platform-java/ → lesingle-edu-reading-platform-backend/ - reading-platform-frontend/ → lesingle-edu-reading-platform-frontend/ 更新相关文件: - 所有 shell 脚本中的目录引用 - pom.xml 和 application.yml 中的项目名称 - package.json 中的项目名称 - .claude/CLAUDE.md 中的路径引用 - README 文档中的路径引用
55 lines
1.7 KiB
TypeScript
55 lines
1.7 KiB
TypeScript
/**
|
|
* 调试课程列表 API
|
|
*/
|
|
import { test, expect } from '@playwright/test';
|
|
import { loginAsAdmin } from './helpers';
|
|
|
|
test.describe('API 调试测试', () => {
|
|
test('调试课程列表 API', async ({ page }) => {
|
|
test.setTimeout(60000);
|
|
|
|
// 步骤 1: 登录
|
|
console.log('步骤 1: 开始登录...');
|
|
await loginAsAdmin(page);
|
|
await page.waitForTimeout(2000);
|
|
|
|
// 验证登录成功
|
|
const currentUrl = page.url();
|
|
console.log('登录后的 URL:', currentUrl);
|
|
|
|
// 步骤 2: 强制导航到课程列表页面
|
|
console.log('导航到课程列表页面...');
|
|
await page.goto('/admin/courses', { timeout: 30000, waitUntil: 'networkidle' });
|
|
await page.waitForTimeout(5000);
|
|
|
|
// 验证 URL
|
|
const courseListUrl = page.url();
|
|
console.log('课程列表页面 URL:', courseListUrl);
|
|
|
|
// 步骤 3: 检查表格状态
|
|
const table = page.locator('.ant-table').first();
|
|
const isTableAttached = await table.isVisible().catch(() => false);
|
|
console.log('表格是否已附加到 DOM:', isTableAttached);
|
|
|
|
// 检查是否有课程数据
|
|
const rows = table.locator('tbody tr');
|
|
const rowCount = await rows.count();
|
|
console.log('表格行数:', rowCount);
|
|
|
|
if (rowCount > 0) {
|
|
// 输出第一行的内容
|
|
const firstRowText = await rows.first().textContent();
|
|
console.log('第一行内容:', firstRowText);
|
|
} else {
|
|
// 检查是否是空表
|
|
const emptyText = await table.locator('.ant-empty').textContent();
|
|
console.log('空表提示:', emptyText);
|
|
}
|
|
|
|
// 步骤 4: 截图
|
|
await page.screenshot({ path: 'test-results/debug-course-list.png' });
|
|
|
|
console.log('调试完成,截图已保存');
|
|
});
|
|
});
|