🥅(app-desk) better error management

We don't know how the error body returned by the
api will be, so we handle it in a more generic way.
This commit is contained in:
Anthony LC
2024-02-19 17:18:02 +01:00
committed by Anthony LC
parent 195e738c3c
commit 51064ec236
11 changed files with 123 additions and 52 deletions

View File

@@ -95,6 +95,25 @@ test.describe('Teams Create', () => {
await expect(page).toHaveURL(/\/teams$/);
});
test('checks error when duplicate team', async ({ page, browserName }) => {
const panel = page.getByLabel('Teams panel').first();
await panel.getByRole('button', { name: 'Add a team' }).click();
const teamName = `My duplicate team ${browserName}-${Math.floor(Math.random() * 1000)}`;
await page.getByText('Team name').fill(teamName);
await page.getByRole('button', { name: 'Create the team' }).click();
await panel.getByRole('button', { name: 'Add a team' }).click();
await page.getByText('Team name').fill(teamName);
await page.getByRole('button', { name: 'Create the team' }).click();
await expect(
page.getByText('Team with this Slug already exists.'),
).toBeVisible();
});
test('checks 404 on teams/[id] page', async ({ page }) => {
await page.goto('/teams/some-unknown-team');
await expect(page.getByText('404 - Page not found')).toBeVisible({