| 12345678910111213141516171819202122232425262728293031323334353637 |
- /**
- * L2 回归测试:专辑管理
- */
- import { test, expect } from '@playwright/test';
- import { apiGet, apiPost, apiPut, apiDelete, initApiClient, disposeApiClient } from '../helpers/api-client';
- test.describe('专辑管理 (Album)', () => {
- test.beforeAll(async () => { await initApiClient(); });
- test.afterAll(async () => { await disposeApiClient(); });
- test('AL01: 获取专辑列表 GET /api/book-generator/albums', async () => {
- const res = await apiGet('/api/book-generator/albums');
- expect(res.code).toBe(0);
- });
- test('AL02: 获取专辑章节 GET /api/book-generator/albums/:id/chapters', async () => {
- const res = await apiGet('/api/book-generator/albums/1/chapters');
- expect([0, 404]).toContain(res.code);
- });
- test('AL03: 重命名专辑 PUT /api/book-generator/album/:id/rename', async () => {
- const res = await apiPut('/api/book-generator/album/1/rename', { title: '新名称' });
- expect([0, 404, 403]).toContain(res.code);
- });
- test('AL04: 重命名章节 PUT /api/book-generator/album/:bookId/chapters/:chapterId/rename', async () => {
- const res = await apiPut('/api/book-generator/album/1/chapters/1/rename', { title: '新章节' });
- // 可能成功(0)、未找到(404)、禁止(403)或需要认证(401)
- expect([0, 401, 403, 404]).toContain(res.code);
- });
- test('AL05: 移动章节 PUT /api/book-generator/album/:bookId/chapters/:chapterId/move', async () => {
- const res = await apiPut('/api/book-generator/album/1/chapters/1/move', { newNumber: 2 });
- // 可能成功(0)、未找到(404)、禁止(403)或需要认证(401)
- expect([0, 401, 403, 404]).toContain(res.code);
- });
- });
|