/** * L2 回归测试:评论系统 */ import { test, expect } from '@playwright/test'; import { apiGet, apiPost, apiDelete, initApiClient, disposeApiClient } from '../helpers/api-client'; test.describe('评论系统 (Comments)', () => { test.beforeAll(async () => { await initApiClient(); }); test.afterAll(async () => { await disposeApiClient(); }); test('C01: 获取评论列表 GET /api/comments', async () => { const res = await apiGet('/api/comments'); expect(res.code).toBe(0); }); test('C02: 创建评论 POST /api/comments', async () => { const res = await apiPost('/api/comments', { audioId: '1', content: '[自动化测试] 测试评论内容', }); expect([0, 400]).toContain(res.code); }); test('C03: 删除评论 DELETE /api/comments/:id', async () => { const res = await apiDelete('/api/comments/99999'); expect([0, 404]).toContain(res.code); }); });