Add app navigation bars to Journal and Planner
Journal gets a nav bar in root.tsx with conditional links: Routes and Activities for authenticated users, Sign In and Register for guests. Active route is highlighted via useLocation(). User menu shows username linking to profile and a logout button. Planner SessionView header title becomes a home link back to /. Adds i18n keys (en + de) for all nav labels. Updates E2E tests to use scoped nav selectors now that links appear in both nav bar and page body. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a9e29b2950
commit
bb4f193405
7 changed files with 124 additions and 16 deletions
|
|
@ -9,8 +9,9 @@ test.describe("Journal", () => {
|
|||
|
||||
test("shows register and sign in when logged out", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await expect(page.getByRole("link", { name: "Register" })).toBeVisible();
|
||||
await expect(page.getByRole("link", { name: "Sign in" })).toBeVisible();
|
||||
// Nav bar has Register and Sign In links
|
||||
await expect(page.getByRole("navigation").getByRole("link", { name: "Register" })).toBeVisible();
|
||||
await expect(page.getByRole("navigation").getByRole("link", { name: "Sign In" })).toBeVisible();
|
||||
});
|
||||
|
||||
test("registration page renders correctly", async ({ page }) => {
|
||||
|
|
@ -29,6 +30,17 @@ test.describe("Journal", () => {
|
|||
await expect(page.getByText(/magic link/i)).toBeVisible();
|
||||
});
|
||||
|
||||
test("nav bar shows on all pages", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
const nav = page.getByRole("navigation");
|
||||
await expect(nav).toBeVisible();
|
||||
// Logo/title links home
|
||||
await expect(nav.getByRole("link", { name: "trails.cool" })).toBeVisible();
|
||||
// Logged-out nav does not show Routes or Activities
|
||||
await expect(nav.getByRole("link", { name: "Routes" })).not.toBeVisible();
|
||||
await expect(nav.getByRole("link", { name: "Activities" })).not.toBeVisible();
|
||||
});
|
||||
|
||||
test("routes page redirects to login when not authenticated", async ({ page }) => {
|
||||
await page.goto("/routes");
|
||||
await expect(page).toHaveURL(/auth\/login/);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue