Skip to content

Commit

Permalink
Add Logout Test
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesPeck committed Oct 25, 2024
1 parent 0611bfb commit 710237f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/lib/component/navigation/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,26 @@ userTest.describe('Logged in users', () => {
// Then
await expect(page.locator('#user-session-avatar')).toContainText('Login');
});
userTest('Clicking logout redirects to login page', async ({ page }) => {
// Given
await page.goto(mockLoginResponse);

// When
const popoutButton = page.locator('#user-session-popout');
await popoutButton.click();

const logoutButton = page.locator('#user-logout-btn');
await logoutButton.click();

// Then
await expect(page).toHaveURL('/login');
});
});

Object.entries(testCases).forEach(([testCase, privileges]) => {
const privTest = getUserTest({ ...picsureUser, privileges });
const testRoutes = routes.filter((route: Route) =>
route.privilege ? privileges.includes(route.privilege) : true,
route.privilege ? privileges.includes(route.privilege as unknown as PicsurePrivileges) : true,
);

privTest.describe(`${testCase} Navigation`, () => {
Expand Down

0 comments on commit 710237f

Please sign in to comment.