From 8e9e8a1c8eda5c11cb814e145bc1b43ce9fd75c7 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 15 Sep 2026 13:38:02 +0800 Subject: [PATCH] fix(e2e): replace removed POST /templates with GET /templates (#1926 auto-default) --- apps/web/e2e/core-generation.spec.ts | 34 +++++++++------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/apps/web/e2e/core-generation.spec.ts b/apps/web/e2e/core-generation.spec.ts index c282269f3..57881e185 100755 --- a/apps/web/e2e/core-generation.spec.ts +++ b/apps/web/e2e/core-generation.spec.ts @@ -40,7 +40,6 @@ async function loginWithRetry( type ProjectResponse = { id: string } type LibraryResponse = { id: string } -type TemplateResponse = { id: string } type AssetListResponse = { items: Array<{ id: string @@ -126,28 +125,17 @@ test.describe("Core generation flow", () => { ) .toBe("ready") - // Create an editing template so the generate page has at least one template - // (templates are now loaded from API; new users have none by default) - const template = await request.post(`${apiBase}/templates`, { - headers, - data: { - name: `E2E 测试模板 ${suffix}`, - mode: "pip", - estimated_duration: 30, - segments: [ - { - segment_order: 1, - duration_min: 5, - duration_max: 30, - material_type: "video", - }, - ], - tags: ["e2e"], - }, - }) - expect(template.status(), await template.text()).toBe(201) - const templateData = (await template.json()) as TemplateResponse - expect(templateData.id).toBeTruthy() + // #1926 P0 fix: POST /templates CRUD endpoint removed; GET /templates + // now auto-creates a default template for new users. Use the first one. + const templatesResp = await request.get(`${apiBase}/templates`, { headers }) + expect(templatesResp.status(), await templatesResp.text()).toBe(200) + const templatesData = (await templatesResp.json()) as { + items: Array<{ id: string }> + } + expect(Array.isArray(templatesData.items)).toBe(true) + expect(templatesData.items.length).toBeGreaterThan(0) + const templateId = templatesData.items[0].id + expect(templateId).toBeTruthy() // Set auth in localStorage await page.addInitScript( -- 2.54.0