From 82463be8ec122ffc859519aba01ff88d0704038d Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Thu, 18 Apr 2024 13:21:08 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(app-impress)=20fix=20all=20the=20r?= =?UTF-8?q?esources=20were=20public?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All the resources were public. We now update correctly depend the user's choice. We add a test. --- .../__tests__/app-impress/pad-create.spec.ts | 22 +++++++++++++++++++ .../pads-create/components/CardCreatePad.tsx | 9 ++++++-- .../components/CardCreateTemplate.tsx | 9 ++++++-- .../eslint-config-impress/playwright.js | 1 + 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/frontend/apps/e2e/__tests__/app-impress/pad-create.spec.ts b/src/frontend/apps/e2e/__tests__/app-impress/pad-create.spec.ts index 4bc6aa87..4b235bd5 100644 --- a/src/frontend/apps/e2e/__tests__/app-impress/pad-create.spec.ts +++ b/src/frontend/apps/e2e/__tests__/app-impress/pad-create.spec.ts @@ -28,6 +28,8 @@ test.describe('Pad Create', () => { }), ).toBeVisible(); + await expect(card.getByText('Is it public ?')).toBeVisible(); + await expect( card.getByRole('button', { name: 'Create the pad', @@ -105,4 +107,24 @@ test.describe('Pad Create', () => { timeout: 15000, }); }); + + test('checks that the pad is public', async ({ page, browserName }) => { + const responsePromisePad = page.waitForResponse( + (response) => + response.url().includes('/documents/') && response.status() === 201, + ); + + const panel = page.getByLabel('Pads panel').first(); + + await panel.getByRole('button', { name: 'Add a pad' }).click(); + + const padName = `My routing pad ${browserName}-${Math.floor(Math.random() * 1000)}`; + await page.getByText('Pad name').fill(padName); + await page.getByText('Is it public ?').click(); + await page.getByRole('button', { name: 'Create the pad' }).click(); + + const responsePad = await responsePromisePad; + const is_public = (await responsePad.json()).is_public; + expect(is_public).toBeTruthy(); + }); }); diff --git a/src/frontend/apps/impress/src/features/pads/pads-create/components/CardCreatePad.tsx b/src/frontend/apps/impress/src/features/pads/pads-create/components/CardCreatePad.tsx index 221da8ff..42bc1919 100644 --- a/src/frontend/apps/impress/src/features/pads/pads-create/components/CardCreatePad.tsx +++ b/src/frontend/apps/impress/src/features/pads/pads-create/components/CardCreatePad.tsx @@ -25,6 +25,7 @@ export const CardCreatePad = () => { }, }); const [padName, setPadName] = useState(''); + const [padPublic, setPadPublic] = useState(false); const { colorsTokens } = useCunninghamTheme(); return ( @@ -52,14 +53,18 @@ export const CardCreatePad = () => { label={t('Pad name')} {...{ error, isError, isPending, setPadName }} /> - + setPadPublic(!padPublic)} + />