diff --git a/src/frontend/apps/e2e/__tests__/app-impress/template-editor.spec.ts b/src/frontend/apps/e2e/__tests__/app-impress/template-editor.spec.ts index 5e5b2735..041ed437 100644 --- a/src/frontend/apps/e2e/__tests__/app-impress/template-editor.spec.ts +++ b/src/frontend/apps/e2e/__tests__/app-impress/template-editor.spec.ts @@ -59,4 +59,31 @@ test.describe('Template Editor', () => { timeout: 5000, }); }); + + test('it saves the html generated by the template', async ({ + page, + browserName, + }) => { + const randomTemplate = await createTemplate( + page, + 'template-html', + browserName, + 1, + ); + + await expect(page.locator('h2').getByText(randomTemplate[0])).toBeVisible(); + + const iframe = page.frameLocator('iFrame.gjs-frame'); + + await page.getByTitle('Open Blocks').click(); + await page + .locator('.gjs-editor .gjs-block[title="Text"]') + .dragTo(iframe.locator('body.gjs-dashed')); + + await iframe.getByText('Insert your text here').fill('Hello World'); + await iframe.locator('body.gjs-dashed').click(); + + await page.getByText('Save template').click(); + await expect(page.getByText('Template save successfully')).toBeVisible(); + }); }); diff --git a/src/frontend/apps/impress/src/features/templates/template/api/useUpdateTemplate.tsx b/src/frontend/apps/impress/src/features/templates/template/api/useUpdateTemplate.tsx index 3264e623..8e833410 100644 --- a/src/frontend/apps/impress/src/features/templates/template/api/useUpdateTemplate.tsx +++ b/src/frontend/apps/impress/src/features/templates/template/api/useUpdateTemplate.tsx @@ -7,16 +7,25 @@ import { Template } from '../types'; import { KEY_TEMPLATE } from './useTemplate'; -type UpdateTemplateProps = Pick; +type UpdateTemplateProps = { + id: Template['id']; + css?: string; + html?: string; + title?: Template['title']; +}; export const updateTemplate = async ({ - title, id, + title, + css, + html, }: UpdateTemplateProps): Promise