♻️(frontend) create a doc from a modal

We refacto the create doc feature to use a modal
instead of a page and a card component.
It is more consistent with the other features.
This commit is contained in:
Anthony LC
2024-07-08 13:35:23 +02:00
committed by Anthony LC
parent 8007c45a35
commit de922e1c04
9 changed files with 214 additions and 244 deletions

View File

@@ -14,18 +14,12 @@ test.describe('Doc Create', () => {
await buttonCreateHomepage.click();
await expect(buttonCreateHomepage).toBeHidden();
const card = page.getByLabel('Create new document card').first();
await expect(card.getByLabel('Document name')).toBeVisible();
await expect(card.getByLabel('icon group')).toBeVisible();
const card = page.getByRole('dialog').first();
await expect(
card.getByRole('heading', {
name: 'Name the document',
level: 3,
}),
card.locator('h2').getByText('Create a new document'),
).toBeVisible();
await expect(card.getByLabel('Document name')).toBeVisible();
await expect(card.getByText('Is it public ?')).toBeVisible();
@@ -35,13 +29,7 @@ test.describe('Doc Create', () => {
}),
).toBeVisible();
await expect(
card.getByRole('button', {
name: 'Cancel',
}),
).toBeVisible();
await expect(page).toHaveURL('/docs/create/');
await expect(card.getByLabel('Close the modal')).toBeVisible();
});
test('checks the cancel button interaction', async ({ page }) => {
@@ -51,13 +39,9 @@ test.describe('Doc Create', () => {
await buttonCreateHomepage.click();
await expect(buttonCreateHomepage).toBeHidden();
const card = page.getByLabel('Create new document card').first();
const card = page.getByRole('dialog').first();
await card
.getByRole('button', {
name: 'Cancel',
})
.click();
await card.getByLabel('Close the modal').click();
await expect(buttonCreateHomepage).toBeVisible();
});