From 0e5127df05d5c2c572f525d91769ed73c478f23b Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 15 Sep 2026 13:49:32 +0800 Subject: [PATCH] =?UTF-8?q?fix(e2e):=20=E6=9B=BF=E6=8D=A2=E5=B7=B2?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=9A=84=20POST=20/templates=20=E4=B8=BA=20G?= =?UTF-8?q?ET=20/templates=20=E8=8E=B7=E5=8F=96=E9=BB=98=E8=AE=A4=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=20(#1931)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: xiaoxia Co-committed-by: xiaoxia --- 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(