🐛(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:
Anthony LC
2024-04-18 13:21:08 +02:00
committed by Anthony LC
parent 64cc2a9f2b
commit 82463be8ec
4 changed files with 37 additions and 4 deletions

View File

@@ -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();
});
});