diff --git a/e2e/pages/shared-lending-platform/NonAssociatedUserProfile.spec.ts b/e2e/pages/shared-lending-platform/NonAssociatedUserProfile.spec.ts index e40bd2f7f..9afe6dd4a 100644 --- a/e2e/pages/shared-lending-platform/NonAssociatedUserProfile.spec.ts +++ b/e2e/pages/shared-lending-platform/NonAssociatedUserProfile.spec.ts @@ -9,6 +9,19 @@ const expectedNoAssociationsSummaryUrl = // Test with isNonAssociatedUser true test.use({ isNonAssociatedUser: true }); +test('Complete User Profile -- Validate Nav Menu', async ({ page }) => { + await test.step('Verify nav options', async () => { + const navContainer = page.locator('nav#nav-links'); + await expect(navContainer).toBeVisible(); + await expect( + navContainer.getByRole('button', { name: 'LOG OUT' }), + ).toBeVisible(); + await expect( + navContainer.getByRole('link', { name: 'Filing', exact: true }), + ).not.toBeVisible(); + }); +}); + test('Complete User Profile -- No Associations -- process', async ({ page, }) => { diff --git a/e2e/pages/shared-lending-platform/UserProfile.spec.ts b/e2e/pages/shared-lending-platform/UserProfile.spec.ts index 8e7f06c4d..62921b65b 100644 --- a/e2e/pages/shared-lending-platform/UserProfile.spec.ts +++ b/e2e/pages/shared-lending-platform/UserProfile.spec.ts @@ -9,6 +9,17 @@ test('User Profile Page', async ({ page, navigateToFilingHome }) => { await expect(page.locator('h1')).toContainText('View your user profile'); }); + await test.step('Verify nav options', async () => { + const navContainer = page.locator('nav#nav-links'); + await expect(navContainer).toBeVisible(); + await expect( + navContainer.getByRole('button', { name: 'LOG OUT' }), + ).toBeVisible(); + await expect( + navContainer.getByRole('link', { name: 'Filing', exact: true }), + ).toBeVisible(); + }); + // Verify Name + Email await test.step('Name & Email', async () => { await expect( diff --git a/e2e/pages/shared-lending-platform/unauthenticated-homepage/NavMenu.spec.ts b/e2e/pages/shared-lending-platform/unauthenticated-homepage/NavMenu.spec.ts new file mode 100644 index 000000000..706320c6f --- /dev/null +++ b/e2e/pages/shared-lending-platform/unauthenticated-homepage/NavMenu.spec.ts @@ -0,0 +1,8 @@ +import { expect, test } from '@playwright/test'; + +test('Unauthenticated homepage: Validate Nav Menu', async ({ page }) => { + await test.step('Verify nav options', async () => { + const navContainer = page.locator('nav#nav-links'); + await expect(navContainer).not.toBeVisible(); + }); +}); diff --git a/src/utils/useHeaderAuthLinks.tsx b/src/utils/useHeaderAuthLinks.tsx index 97952524b..40910659e 100644 --- a/src/utils/useHeaderAuthLinks.tsx +++ b/src/utils/useHeaderAuthLinks.tsx @@ -3,12 +3,15 @@ import { Button } from 'design-system-react'; import type { ReactElement } from 'react'; import { NavLink, useLocation } from 'react-router-dom'; -const AUTH_LINKS_EXCLUDED = new Set(['/', '/profile/complete', '/summary']); +const AUTH_LINKS_EXCLUDED = new Set([ + '/', + '/privacy-notice', + '/paperwork-reduction-act-notice', +]); export const useHeaderAuthLinks = (): ReactElement[] => { const { pathname } = useLocation(); const auth = useSblAuth(); - const headerLinks = []; const onLogout = (): void => { // Works well without waiting @@ -16,33 +19,43 @@ export const useHeaderAuthLinks = (): ReactElement[] => { auth.onLogout(); }; - if (auth.isLoading || !auth.isAuthenticated) return []; - - if (!AUTH_LINKS_EXCLUDED.has(pathname)) { - // Logged in - headerLinks.push( - - Home - , - - Filing - , - - - {auth.user?.profile.name ?? - auth.user?.profile.email ?? - 'User profile'} - - , -