(frontend) add logout button

Rework the header based on latest Johann's design, which introduced a
dropdown menu to mange user account.

In this menu, you can find a logout button, which ends up the backend
session by calling the logout endpoint. Please that automatic redirection
when receiving the backend response were disabled. We handle it in our
custom hook, which reload the page.

Has the session cookie have been cleared, on reloading the page, a new
loggin flow is initiated, and the user is redirected to the OIDC provider.

Please note, the homepage design/organization is still under discussion, I
prefered to ship a first increment. The logout feature will be quite useful
in staging to play and test our UI.
This commit is contained in:
Lebaud Antoine
2024-03-25 23:06:18 +01:00
committed by aleb_the_flash
parent 7db2faa072
commit 9ec7eddaed
12 changed files with 89 additions and 53 deletions

View File

@@ -34,4 +34,22 @@ test.describe('Header', () => {
await expect(header.getByAltText('Language Icon')).toBeVisible();
await expect(header.getByText('My account')).toBeVisible();
});
test('checks logout button', async ({ page }) => {
await page
.getByRole('button', {
name: 'My account',
})
.click();
await page
.getByRole('button', {
name: 'Logout',
})
.click();
// FIXME - assert the session has been killed in Keycloak
await expect(page.getByRole('button', { name: 'Sign in' })).toBeVisible();
});
});