🐛(app-impress) fix all the resources were public
All the resources were public. We now update correctly depend the user's choice. We add a test.
This commit is contained in:
@@ -28,6 +28,8 @@ test.describe('Pad Create', () => {
|
|||||||
}),
|
}),
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
|
|
||||||
|
await expect(card.getByText('Is it public ?')).toBeVisible();
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
card.getByRole('button', {
|
card.getByRole('button', {
|
||||||
name: 'Create the pad',
|
name: 'Create the pad',
|
||||||
@@ -105,4 +107,24 @@ test.describe('Pad Create', () => {
|
|||||||
timeout: 15000,
|
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();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ export const CardCreatePad = () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
const [padName, setPadName] = useState('');
|
const [padName, setPadName] = useState('');
|
||||||
|
const [padPublic, setPadPublic] = useState(false);
|
||||||
const { colorsTokens } = useCunninghamTheme();
|
const { colorsTokens } = useCunninghamTheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -52,14 +53,18 @@ export const CardCreatePad = () => {
|
|||||||
label={t('Pad name')}
|
label={t('Pad name')}
|
||||||
{...{ error, isError, isPending, setPadName }}
|
{...{ error, isError, isPending, setPadName }}
|
||||||
/>
|
/>
|
||||||
<Switch label={t('Is it public ?')} labelSide="right" />
|
<Switch
|
||||||
|
label={t('Is it public ?')}
|
||||||
|
labelSide="right"
|
||||||
|
onChange={() => setPadPublic(!padPublic)}
|
||||||
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
<Box $justify="space-between" $direction="row" $align="center">
|
<Box $justify="space-between" $direction="row" $align="center">
|
||||||
<StyledLink href="/">
|
<StyledLink href="/">
|
||||||
<Button color="secondary">{t('Cancel')}</Button>
|
<Button color="secondary">{t('Cancel')}</Button>
|
||||||
</StyledLink>
|
</StyledLink>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => createPad({ title: padName, is_public: true })}
|
onClick={() => createPad({ title: padName, is_public: padPublic })}
|
||||||
disabled={!padName}
|
disabled={!padName}
|
||||||
>
|
>
|
||||||
{t('Create the pad')}
|
{t('Create the pad')}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ export const CardCreateTemplate = () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
const [templateName, setTemplateName] = useState('');
|
const [templateName, setTemplateName] = useState('');
|
||||||
|
const [templatePublic, setTemplatePublic] = useState(false);
|
||||||
const { colorsTokens } = useCunninghamTheme();
|
const { colorsTokens } = useCunninghamTheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -52,7 +53,11 @@ export const CardCreateTemplate = () => {
|
|||||||
label={t('Template name')}
|
label={t('Template name')}
|
||||||
{...{ error, isError, isPending, setTemplateName }}
|
{...{ error, isError, isPending, setTemplateName }}
|
||||||
/>
|
/>
|
||||||
<Switch label={t('Is it public ?')} labelSide="right" />
|
<Switch
|
||||||
|
label={t('Is it public ?')}
|
||||||
|
labelSide="right"
|
||||||
|
onChange={() => setTemplatePublic(!templatePublic)}
|
||||||
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
<Box $justify="space-between" $direction="row" $align="center">
|
<Box $justify="space-between" $direction="row" $align="center">
|
||||||
<StyledLink href="/">
|
<StyledLink href="/">
|
||||||
@@ -60,7 +65,7 @@ export const CardCreateTemplate = () => {
|
|||||||
</StyledLink>
|
</StyledLink>
|
||||||
<Button
|
<Button
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
createTemplate({ title: templateName, is_public: true })
|
createTemplate({ title: templateName, is_public: templatePublic })
|
||||||
}
|
}
|
||||||
disabled={!templateName}
|
disabled={!templateName}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ module.exports = {
|
|||||||
plugins: ['playwright'],
|
plugins: ['playwright'],
|
||||||
rules: {
|
rules: {
|
||||||
'@typescript-eslint/no-unsafe-member-access': 'off',
|
'@typescript-eslint/no-unsafe-member-access': 'off',
|
||||||
|
'@typescript-eslint/no-unsafe-assignment': 'off',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user